This commit is contained in:
alorig
2025-12-03 19:02:28 +05:00
parent a9788820fd
commit 316f48d024
5 changed files with 0 additions and 1180 deletions

View File

@@ -1,116 +0,0 @@
# Site Builder → Sites Container Migration Summary
## Overview
Successfully merged Site Builder container into Sites container. Sites is now the primary container hosting both:
- **Public Site Renderer** (no auth required)
- **Site Builder** (auth required)
## Structure Changes
### New Directory Structure
```
sites/src/
├── builder/ # Site Builder (from site-builder/src/)
│ ├── pages/ # Wizard, Preview, Dashboard
│ ├── components/ # Builder-specific components
│ ├── state/ # Zustand stores
│ ├── api/ # API client with conditional auth
│ ├── types/ # TypeScript types
│ └── App.css # Builder styles
├── renderer/ # Sites Renderer (existing)
│ ├── pages/ # SiteRenderer component
│ ├── loaders/ # Site definition loaders
│ ├── utils/ # Layout renderer utilities
│ └── types/ # Renderer types
├── shared/ # Shared components
│ └── ProtectedRoute.tsx
├── App.tsx # Unified router
└── main.tsx # Entry point
```
## Routing Structure
### Public Routes (No Auth)
- `/:siteId/*` - Site renderer (public sites)
- `/` - Root page
### Builder Routes (Auth Required)
- `/builder` - Wizard page
- `/builder/preview` - Preview canvas
- `/builder/dashboard` - Blueprint history
## Key Changes
### 1. Unified Router (`App.tsx`)
- Single router handles both builder and renderer routes
- Builder routes wrapped in `ProtectedRoute` component
- Builder routes wrapped in `BuilderLayout` component
- Code-splitting for builder routes (lazy loading)
### 2. Authentication
- `ProtectedRoute` component checks for JWT token in localStorage
- Builder API client conditionally includes auth headers
- Public renderer routes have no authentication
### 3. API Clients
- Builder API (`builder/api/builder.api.ts`): Includes auth token if available
- Renderer API (`renderer/loaders/loadSiteDefinition.ts`): No auth required
### 4. Build Configuration
- Updated `vite.config.ts` with code-splitting
- Builder routes split into separate chunk
- Supports both `sites.igny8.com` and `builder.igny8.com` domains
### 5. Docker Configuration
- Removed `igny8_site_builder` service from docker-compose
- Updated `igny8_sites` service comment
- Single container now handles both functions
## Backend (No Changes)
- Backend Django views remain unchanged
- API endpoints: `/api/v1/site-builder/` (same as before)
- Database tables: No changes
- Authentication: Same JWT-based auth
## Migration Checklist
✅ Created merged directory structure
✅ Moved site-builder files to sites/src/builder/
✅ Created unified App.tsx with routing
✅ Created ProtectedRoute component
✅ Created BuilderLayout component
✅ Merged package.json dependencies
✅ Updated vite.config.ts with code-splitting
✅ Updated main.tsx entry point
✅ Updated docker-compose.app.yml (removed site_builder service)
✅ Updated API clients with conditional authentication
✅ Updated index.css with builder styles
## Next Steps
1. **Test Builder Functionality**
- Navigate to `/builder` (should require auth)
- Test wizard flow
- Test preview
- Test dashboard
2. **Test Renderer Functionality**
- Navigate to `/:siteId/*` (should work without auth)
- Test site loading from filesystem
- Test site loading from API
3. **Build & Deploy**
- Build Docker image: `docker build -t igny8-sites-dev:latest -f Dockerfile.dev .`
- Update docker-compose: `docker compose -f docker-compose.app.yml up -d igny8_sites`
4. **Cleanup** (Optional)
- Remove `/site-builder` directory after verification
- Update documentation
## Notes
- **No Backward Compatibility**: Old site-builder container is removed
- **Backend Unchanged**: All Django views and models remain the same
- **Code-Splitting**: Builder code is lazy-loaded, so public sites don't load builder code
- **Route Conflicts**: Builder routes are namespaced under `/builder/*` to avoid conflicts