# Configuration du Site Web - Documentation ComplĂšte ## 📋 Vue d'ensemble Ce site utilise une architecture full-stack moderne avec : - **Frontend** : Next.js avec TypeScript et Tailwind CSS - **Backend CMS** : Strapi - **API IA** : FastAPI avec intĂ©gration Ollama - **DĂ©marrage automatique** : Planificateur de tĂąches Windows ## đŸ—ïž Architecture ``` my-next-site/ ├── app/ # Application Next.js ├── cmsbackend/ # Backend Strapi ├── llm-api/ # API FastAPI pour IA ├── start-my-site.ps1 # Script de dĂ©marrage └── package.json # DĂ©pendances frontend ``` ## 🚀 DĂ©marrage Rapide ### Script Automatique (RecommandĂ©) ```powershell cd J:\my-next-site .\start-my-site.ps1 ``` Ce script lance automatiquement les 3 services dans des fenĂȘtres PowerShell sĂ©parĂ©es. ## 🔧 Commandes Manuelles ### 1. Frontend Next.js ```powershell cd J:\my-next-site npm run dev ``` - **URL** : http://localhost:3000 - **Mode** : DĂ©veloppement avec Turbopack - **Rechargement** : Automatique ### 2. Backend Strapi (CMS) ```powershell cd J:\my-next-site\cmsbackend npm run develop ``` - **Interface Admin** : http://localhost:1337/admin - **API** : http://localhost:1337/api - **Mode** : DĂ©veloppement ### 3. API FastAPI (IA) ```powershell cd J:\my-next-site\llm-api uvicorn api:app --host 0.0.0.0 --port 8000 --reload ``` - **API** : http://localhost:8000 - **Endpoint IA** : http://localhost:8000/ask?q=votre_question - **Documentation** : http://localhost:8000/docs ## 📊 Ports UtilisĂ©s | Service | Port | URL | |---------|------|-----| | Next.js | 3000 | http://localhost:3000 | | Strapi | 1337 | http://localhost:1337 | | FastAPI | 8000 | http://localhost:8000 | | Ollama | 11434 | http://localhost:11434 | ## 🔄 DĂ©marrage Automatique ### Configuration Actuelle - **MĂ©thode** : Planificateur de tĂąches Windows - **Nom de la tĂąche** : "Lancement site web dino" - **État** : Ready (PrĂȘt) ### Gestion de la TĂąche PlanifiĂ©e #### Voir les dĂ©tails ```powershell Get-ScheduledTask -TaskName "Lancement site web dino" | Get-ScheduledTaskInfo ``` #### DĂ©marrer manuellement ```powershell Start-ScheduledTask -TaskName "Lancement site web dino" ``` #### ArrĂȘter la tĂąche ```powershell Stop-ScheduledTask -TaskName "Lancement site web dino" ``` #### DĂ©sactiver/RĂ©activer ```powershell # DĂ©sactiver Disable-ScheduledTask -TaskName "Lancement site web dino" # RĂ©activer Enable-ScheduledTask -TaskName "Lancement site web dino" ``` #### Interface Graphique ``` Win + R → taskschd.msc ``` Cherchez "Lancement site web dino" dans la liste. ## đŸ› ïž DĂ©pannage ### ArrĂȘter Tous les Processus ```powershell # ArrĂȘter Node.js taskkill /f /im node.exe # ArrĂȘter Python/FastAPI taskkill /f /im python.exe ``` ### Nettoyer les Caches ```powershell # Cache Next.js cd J:\my-next-site Remove-Item .next -Recurse -Force -ErrorAction SilentlyContinue # Cache Strapi cd J:\my-next-site\cmsbackend Remove-Item .cache -Recurse -Force -ErrorAction SilentlyContinue ``` ### RĂ©installer les DĂ©pendances ```powershell # Frontend cd J:\my-next-site npm install # Backend Strapi cd J:\my-next-site\cmsbackend npm install # API Python (si environnement virtuel) cd J:\my-next-site\llm-api pip install fastapi uvicorn[standard] requests ``` ## 🐍 Configuration Python/FastAPI ### DĂ©pendances Requises ```txt fastapi==0.115.8 uvicorn[standard]==0.38.0 requests==2.32.3 ``` ### ProblĂšmes Courants - **Erreur uvicorn** : VĂ©rifiez l'installation avec `pip show uvicorn` - **Port occupĂ©** : Changez le port dans le script ou tuez le processus - **Ollama non disponible** : VĂ©rifiez que Ollama fonctionne sur le port 11434 ### Installation Propre (RecommandĂ©e) ```powershell cd J:\my-next-site\llm-api python -m venv venv venv\Scripts\activate pip install fastapi uvicorn[standard] requests ``` ## 📝 Scripts Disponibles ### Frontend (package.json) ```json { "dev": "next dev --turbopack", "build": "next build", "start": "next start", "lint": "next lint" } ``` ### Backend Strapi (cmsbackend/package.json) ```json { "develop": "strapi develop", "build": "strapi build", "start": "strapi start" } ``` ## 🔍 VĂ©rifications de SantĂ© ### VĂ©rifier que tous les services fonctionnent ```powershell # Next.js curl http://localhost:3000 # Strapi curl http://localhost:1337/admin # FastAPI curl http://localhost:8000/docs # Ollama curl http://localhost:11434/api/generate ``` ### VĂ©rifier les processus actifs ```powershell # Processus Node.js Get-Process node -ErrorAction SilentlyContinue # Processus Python Get-Process python -ErrorAction SilentlyContinue ``` ## 🌐 Configuration RĂ©seau ### AccĂšs Externe Si vous voulez accĂ©der au site depuis d'autres machines : - **Next.js** : Modifier `next.config.ts` pour accepter les connexions externes - **Strapi** : Configurer `config/server.ts` - **FastAPI** : DĂ©jĂ  configurĂ© avec `--host 0.0.0.0` ### Pare-feu Windows Assurez-vous que les ports sont ouverts : ```powershell # Ouvrir les ports dans le pare-feu New-NetFirewallRule -DisplayName "Next.js" -Direction Inbound -Port 3000 -Protocol TCP -Action Allow New-NetFirewallRule -DisplayName "Strapi" -Direction Inbound -Port 1337 -Protocol TCP -Action Allow New-NetFirewallRule -DisplayName "FastAPI" -Direction Inbound -Port 8000 -Protocol TCP -Action Allow ``` ## 📚 Ressources Utiles - **Next.js Documentation** : https://nextjs.org/docs - **Strapi Documentation** : https://docs.strapi.io - **FastAPI Documentation** : https://fastapi.tiangolo.com - **Ollama Documentation** : https://ollama.ai/docs ## 🔧 Maintenance ### Mise Ă  jour des dĂ©pendances ```powershell # Frontend cd J:\my-next-site npm update # Backend cd J:\my-next-site\cmsbackend npm update # Python packages pip list --outdated pip install --upgrade package_name ``` ### Sauvegarde Pensez Ă  sauvegarder rĂ©guliĂšrement : - Base de donnĂ©es Strapi (`cmsbackend/database/`) - Configuration (`cmsbackend/config/`) - Assets (`app/assets/`) --- **DerniĂšre mise Ă  jour** : $(Get-Date -Format "dd/MM/yyyy HH:mm") **Version Cursor** : 2.0.77 **OS** : Windows Server 2025