# Documentation ChartBastan 🎯 **Plateforme de prĂ©diction sportive basĂ©e sur l'analyse de l'Ă©nergie collective des rĂ©seaux sociaux** --- ## 📊 Vue d'ensemble **Type de rĂ©fĂ©rentiel:** Multi-part (Frontend + Backend sĂ©parĂ©s) **Parties du projet:** - **Partie 1:** Frontend Next.js (chartbastan/) - **Partie 2:** Backend FastAPI (backend/) **Langage principal:** - Frontend: TypeScript (Next.js 16.1.3) - Backend: Python (FastAPI 0.128.0) **Architecture:** Client-serveur avec REST API --- ## 🚀 DĂ©marrage Rapide ### Pour Tester l'Application 👉 **[README de Test Rapide](./README-TEST.md)** - Guide en 3 Ă©tapes pour dĂ©marrer l'application **DĂ©marrage rapide:** ```bash # Terminal 1 - Backend cd backend pip install -r requirements.txt python -m uvicorn app.main:app --reload --port 8000 # Terminal 2 - Frontend cd chartbastan npm install npm run dev ``` AccĂ©der Ă : http://localhost:3000 --- ## 📚 Documentation GĂ©nĂ©rĂ©e ### Documentation Principale - 📖 **[Structure du Projet](./project-structure.md)** - Vue d'ensemble de l'architecture - 🔧 **[MĂ©tadonnĂ©es des Parties](./project-parts-metadata.md)** - DĂ©tails techniques de chaque partie - đŸ’» **[Stack Technologique](./technology-stack.md)** - Technologies utilisĂ©es - đŸ—ïž **[Patterns d'Architecture](./architecture-patterns.md)** - Patterns de conception - 🌳 **[Analyse de l'Arbre Source](./source-tree-analysis.md)** - Structure dĂ©taillĂ©e des fichiers - đŸ› ïž **[Guide de DĂ©veloppement](./development-guide.md)** - Guide complet de dĂ©veloppement - đŸ§Ș **[README de Test Rapide](./README-TEST.md)** - Guide de testing ### Documentation Existante - 📋 **[Inventaire de Documentation Existante](./existing-documentation-inventory.md)** - 50+ fichiers trouvĂ©s - đŸ‘€ **[Contexte Utilisateur](./user-provided-context.md)** - Objectifs et prioritĂ©s --- ## 🎯 Parties du Projet ### Part 1: Frontend (chartbastan/) **Type:** Web Application (Next.js 16.1.3) **Technologie principale:** - Framework: Next.js 16.1.3 + TypeScript 5 - UI: Tailwind CSS v4 + shadcn/ui - State: Zustand 5.0.10 + React Query 5.90.18 - Database: Drizzle ORM 0.44.7 + SQLite - Visualization: D3.js 7.9.0 + Recharts 3.6.0 **Points d'entrĂ©e:** - Page d'accueil: `src/app/page.tsx` - Layout racine: `src/app/layout.tsx` - Configuration: `package.json`, `tsconfig.json` **Port:** 3000 **Documentation spĂ©cifique:** - 📄 [README Frontend](../chartbastan/README.md) --- ### Part 2: Backend (backend/) **Type:** API REST (FastAPI 0.128.0) **Technologie principale:** - Framework: FastAPI 0.128.0 + Python 3.11+ - ORM: SQLAlchemy 2.0.45 + Alembic 1.13.0 - Scraping: tweepy 4.14.0 + praw 7.8.1 + feedparser 6.0.11 - ML: vaderSentiment 3.3.2 + textblob 0.17.1 - Queue: pika 1.3.2 (RabbitMQ) **Points d'entrĂ©e:** - Application: `app/main.py` - API Endpoints: `app/api/` - Configuration: `requirements.txt`, `alembic.ini` **Port:** 8000 **API Documentation:** - Swagger: http://localhost:8000/docs - ReDoc: http://localhost:8000/redoc --- ## 🔗 IntĂ©gration entre Parties **Communication:** REST API (HTTP/HTTPS) **Format de donnĂ©es:** JSON **Base URL:** `http://localhost:8000` (dĂ©veloppement) **Points d'intĂ©gration:** 1. **Authentification** - better-auth (frontend) ↔ JWT (backend) 2. **DonnĂ©es de Matchs** - `src/services/matches.ts` ↔ `app/api/matches.py` 3. **PrĂ©dictions** - `src/services/predictions.ts` ↔ `app/api/predictions.py` 4. **Notifications** - Workers RabbitMQ ↔ Web Push --- ## 📂 Structure du Projet ``` chartbastan/ ├── chartbastan/ # Frontend Next.js │ ├── src/ │ │ ├── app/ # App Router (pages, layouts) │ │ ├── components/ # Composants React (72+) │ │ ├── services/ # Services API (27) │ │ ├── stores/ # Zustand stores (2) │ │ ├── hooks/ # React Hooks (9) │ │ └── lib/ # Utilitaires (7) │ └── package.json │ ├── backend/ # Backend FastAPI │ ├── app/ │ │ ├── api/ # Endpoints REST │ │ ├── models/ # ModĂšles SQLAlchemy (12) │ │ ├── schemas/ # SchĂ©mas Pydantic (14) │ │ ├── services/ # Services mĂ©tier (8) │ │ ├── scrapers/ # Scrapers (Twitter, Reddit, RSS) │ │ ├── ml/ # Services ML (sentiment, prĂ©dictions) │ │ ├── workers/ # Workers asynchrones (4) │ │ └── main.py # Application FastAPI │ ├── alembic/ # Migrations │ └── requirements.txt │ ├── _bmad-output/ # Documentation de planification │ ├── planning-artifacts/ # PRD, Architecture, Epics │ └── implementation-artifacts/ # 38 fichiers d'implĂ©mentation │ └── docs/ # Documentation (ce dossier) ``` --- ## 📖 Documentation de Planification et ImplĂ©mentation ### Artefacts de Planification - 📋 **[PRD Complet](../_bmad-output/planning-artifacts/prd.md)** - Product Requirements Document - đŸ—ïž **[Architecture](../_bmad-output/planning-artifacts/architecture.md)** - Documentation architecturale - 📝 **[Epics](../_bmad-output/planning-artifacts/epics.md)** - 9 Ă©pics complĂ©tĂ©s - 🎹 **[UX Design Directions](../_bmad-output/planning-artifacts/ux-design-directions.html)** - 🎹 **[UX Design Specification](../_bmad-output/planning-artifacts/ux-design-specification.md)** ### Artefacts d'ImplĂ©mentation đŸ› ïž **[Dossier d'Artefacts](../_bmad-output/implementation-artifacts/)** - 38 fichiers de documentation d'implĂ©mentation dĂ©taillĂ©e **Épics complĂ©tĂ©s:** 1. Authentification des utilisateurs 2. Collecte de donnĂ©es (Twitter, Reddit, RSS) 3. Analyse de sentiment et Ă©nergie collective 4. SystĂšme de prĂ©dictions ML 5. Dashboard principal en temps rĂ©el 6. SystĂšme de paris et prĂ©dictions utilisateurs 7. Gamification (badges, classements, parrainage) 8. Notifications push et alertes 9. API publique et calendrier Ă©nergĂ©tique --- ## 🚀 Getting Started ### 1. Pour Tester l'Application 👉 **[README de Test Rapide](./README-TEST.md)** - Guide en 3 Ă©tapes ### 2. Pour le DĂ©veloppement 👉 **[Guide de DĂ©veloppement](./development-guide.md)** - Guide complet de dĂ©veloppement **Étapes rapides:** 1. Installer les dĂ©pendances: `pip install -r requirements.txt` et `npm install` 2. Configurer les variables d'environnement (.env et .env.local) 3. DĂ©marrer le backend: `python -m uvicorn app.main:app --reload --port 8000` 4. DĂ©marrer le frontend: `npm run dev` 5. Ouvrir http://localhost:3000 ### 3. Pour Comprendre l'Architecture 👉 **[Patterns d'Architecture](./architecture-patterns.md)** - Patterns de conception dĂ©taillĂ©s 👉 **[Stack Technologique](./technology-stack.md)** - Technologies utilisĂ©es ### 4. Pour Explorer le Code 👉 **[Analyse de l'Arbre Source](./source-tree-analysis.md)** - Structure dĂ©taillĂ©e des fichiers 👉 **[Structure du Projet](./project-structure.md)** - Vue d'organisation --- ## đŸ§Ș Testing ### FonctionnalitĂ©s Ă  Tester Voir le **[README de Test Rapide](./README-TEST.md)** pour la checklist complĂšte: - ✅ Authentification (inscription, login, dĂ©connexion) - ✅ Dashboard principal (matchs, graphiques) - ✅ PrĂ©dictions (faire une prĂ©diction, voir l'Ă©nergie) - ✅ Classement (Top 100, rang personnel) - ✅ Badges et gamification - ✅ Notifications - ✅ Historique des prĂ©dictions - ✅ Parrainage - ✅ Comparaison Ă©nergie vs stats - ✅ Calendrier Ă©nergĂ©tique ### Tests AutomatisĂ©s **Frontend:** ```bash cd chartbastan npm run test ``` **Backend:** ```bash cd backend pytest tests/ -v ``` --- ## đŸ› ïž Scripts et Commandes ### Frontend (chartbastan/) | Commande | Description | |----------|-------------| | `npm run dev` | DĂ©marrer le serveur de dĂ©veloppement (port 3000) | | `npm run build` | Build de production | | `npm run start` | DĂ©marrer le serveur de production | | `npm run lint` | ExĂ©cuter ESLint | | `npm run type-check` | VĂ©rifier les types TypeScript | | `npm run test` | ExĂ©cuter les tests Vitest | ### Backend (backend/) | Commande | Description | |----------|-------------| | `python -m uvicorn app.main:app --reload --port 8000` | DĂ©marrer le serveur FastAPI | | `flake8 .` | Linting du code Python | | `black .` | Formatage du code Python | | `pytest tests/` | ExĂ©cuter les tests unitaires | | `alembic upgrade head` | Appliquer toutes les migrations | --- ## 📚 Ressources de RĂ©fĂ©rence ### Documentation API - **Swagger UI:** http://localhost:8000/docs - **ReDoc:** http://localhost:8000/redoc ### Documentation Externe - **Next.js:** https://nextjs.org/docs - **FastAPI:** https://fastapi.tiangolo.com/ - **React:** https://react.dev/ - **Tailwind CSS:** https://tailwindcss.com/docs - **Drizzle ORM:** https://orm.drizzle.team/ - **SQLAlchemy:** https://docs.sqlalchemy.org/ --- ## 📊 Statut du Projet **Phase:** Testing (tous les Ă©pics complĂ©tĂ©s) - ✅ PRD complet - ✅ Architecture implĂ©mentĂ©e - ✅ 9 Ă©pics complĂ©tĂ©s - ✅ Frontend et Backend prĂȘts - 🔄 Testing en cours **Technologie:** - Frontend: Next.js 16.1.3 + TypeScript 5 - Backend: FastAPI 0.128.0 + Python 3.11+ - Database: SQLite (Phase 1) → PostgreSQL (Phase 2+) - API: REST + Swagger documentation --- ## 🐛 DĂ©pannage Pour les problĂšmes courants, consulter: - **[Guide de DĂ©veloppement - DĂ©pannage](./development-guide.md#dĂ©pannage)** - **[README de Test Rapide - DĂ©pannage](./README-TEST.md#-dĂ©pannage)** **ProblĂšmes frĂ©quents:** - Backend ne dĂ©marre pas → VĂ©rifier le port 8000 - Frontend ne dĂ©marre pas → Nettoyer node_modules et rĂ©installer - Erreur de connexion → VĂ©rifier que backend tourne et .env.local est configurĂ© - Base de donnĂ©es vide → ExĂ©cuter `alembic upgrade head` --- ## đŸ€ Contribution Le projet est complet et en phase de testing. Pour contribuer: 1. Fork le repository 2. CrĂ©er une branche `feature/nouvelle-fonctionnalitĂ©` 3. DĂ©velopper la fonctionnalitĂ© 4. Commit avec des messages clairs 5. Push et crĂ©er une Pull Request --- ## 📄 Licence Ce projet est sous license MIT. --- ## 📞 Contact Pour toute question: - Consulter les artefacts d'implĂ©mentation: `_bmad-output/implementation-artifacts/` - VĂ©rifier la documentation API: http://localhost:8000/docs - Consulter le README principal: `chartbastan/README.md` --- **Date de crĂ©ation:** 2026-01-18 **Version:** 0.1.0 **Statut:** Testing (tous les Ă©pics complĂ©tĂ©s) âœ