Accepté
Remplacement du backend PHP par une API REST moderne. Comparaison entre :
Choix : FastAPI (Python)
from fastapi import FastAPI, BackgroundTasks
from pydantic import BaseModel
app = FastAPI(title="WaouW API")
class SiteCreate(BaseModel):
domain: str
cms_type: Literal["wordpress", "joomla", "prestashop"]
ssl_enabled: bool = True
@app.post("/sites/")
async def create_site(site: SiteCreate, background_tasks: BackgroundTasks):
"""Créer un nouveau site de façon idempotente"""
background_tasks.add_task(provision_site, site)
return {"status": "provisioning", "site_id": generate_id()}
# requirements.txt
fastapi[all]==0.104.1
uvicorn[standard]==0.24.0
sqlalchemy==2.0.23
alembic==1.12.1
celery[redis]==5.3.4
pydantic==2.5.0
python-multipart==0.0.6
python-jose[cryptography]==3.3.0
passlib[bcrypt]==1.7.4
backend/
├── app/
│ ├── __init__.py
│ ├── main.py # FastAPI app
│ ├── core/
│ │ ├── config.py # Settings
│ │ ├── security.py # JWT, auth
│ │ └── database.py # SQLAlchemy
│ ├── api/
│ │ ├── sites.py # Sites endpoints
│ │ ├── devices.py # Device management
│ │ └── auth.py # Authentication
│ ├── models/
│ │ ├── site.py # SQLAlchemy models
│ │ └── device.py
│ ├── schemas/
│ │ ├── site.py # Pydantic schemas
│ │ └── device.py
│ └── services/
│ ├── provisioning.py # Business logic
│ └── docker_manager.py
├── tests/
├── alembic/ # DB migrations
└── scripts/ # Deployment helpers
subprocess avec validation2024-01-15
Architecture Team