feat: initialisation projet React + Vite + TypeScript + Tailwind
This commit is contained in:
parent
f221daf542
commit
0a48428760
31 changed files with 4187 additions and 200 deletions
139
README.md
139
README.md
|
|
@ -1,92 +1,73 @@
|
|||
# expria-frontend
|
||||
# React + TypeScript + Vite
|
||||
|
||||
Interface utilisateur d'Expria — Coach IA de préparation au TCF Canada.
|
||||
Plateforme SaaS francophone ciblant les candidats à l'immigration Express Entry
|
||||
(Algérie, Maroc, Cameroun).
|
||||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
||||
|
||||
## Stack technique
|
||||
Currently, two official plugins are available:
|
||||
|
||||
- **React 18** + **Vite** — frontend pur, pas de logique serveur
|
||||
- **TypeScript** — typage strict
|
||||
- **Tailwind CSS** — styles utilitaires
|
||||
- **Supabase JS** — authentification côté client uniquement
|
||||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
|
||||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
|
||||
|
||||
## Documents de référence
|
||||
## React Compiler
|
||||
|
||||
Lire ces fichiers avant toute modification :
|
||||
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
||||
|
||||
| Fichier | Contenu |
|
||||
|---|---|
|
||||
| `docs/DEVELOPMENT_PRINCIPLES.md` | Cycle de travail, règles, conventions — **obligatoire** |
|
||||
| `docs/ARCHITECTURE.md` | Stack, structure, flux de données |
|
||||
| `docs/PLANS_TARIFAIRES.md` | Plans Free / Standard / Premium et permissions |
|
||||
| `docs/PARCOURS_UTILISATEURS.md` | Parcours exact de chaque type d'utilisateur |
|
||||
| `docs/GOLDEN_DATASET.md` | Tests manuels anti-régression |
|
||||
## Expanding the ESLint configuration
|
||||
|
||||
## Structure des dossiers
|
||||
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
||||
|
||||
```
|
||||
src/
|
||||
├── api/ # Fonctions d'appel API (une par domaine)
|
||||
├── components/ # Composants React réutilisables
|
||||
│ ├── ui/ # Composants génériques (Button, Modal, Badge)
|
||||
│ ├── simulation/ # Composants spécifiques aux simulations
|
||||
│ ├── rapport/ # Composants d'affichage des rapports
|
||||
│ ├── dashboard/ # Composants du dashboard utilisateur
|
||||
│ └── paywall/ # Composants de blocage / upgrade
|
||||
├── pages/ # Pages de l'application (une par route)
|
||||
├── hooks/ # Hooks React personnalisés
|
||||
├── lib/
|
||||
│ ├── access.ts # Source de vérité des permissions par plan ⚠️
|
||||
│ ├── supabase.ts # Client Supabase (auth uniquement)
|
||||
│ └── constants.ts # Constantes globales
|
||||
└── types/ # Types TypeScript partagés
|
||||
```js
|
||||
export default defineConfig([
|
||||
globalIgnores(['dist']),
|
||||
{
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
extends: [
|
||||
// Other configs...
|
||||
|
||||
// Remove tseslint.configs.recommended and replace with this
|
||||
tseslint.configs.recommendedTypeChecked,
|
||||
// Alternatively, use this for stricter rules
|
||||
tseslint.configs.strictTypeChecked,
|
||||
// Optionally, add this for stylistic rules
|
||||
tseslint.configs.stylisticTypeChecked,
|
||||
|
||||
// Other configs...
|
||||
],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
// other options...
|
||||
},
|
||||
},
|
||||
])
|
||||
```
|
||||
|
||||
> ⚠️ `src/lib/access.ts` est la source de vérité unique des permissions par plan.
|
||||
> Ce fichier doit rester identique à `src/lib/access.ts` dans `expria-backend`.
|
||||
> Toute modification des plans tarifaires met ce fichier à jour en premier.
|
||||
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
||||
|
||||
## Variables d'environnement
|
||||
|
||||
Créer un fichier `.env` à la racine (ne jamais committer) :
|
||||
```js
|
||||
// eslint.config.js
|
||||
import reactX from 'eslint-plugin-react-x'
|
||||
import reactDom from 'eslint-plugin-react-dom'
|
||||
|
||||
export default defineConfig([
|
||||
globalIgnores(['dist']),
|
||||
{
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
extends: [
|
||||
// Other configs...
|
||||
// Enable lint rules for React
|
||||
reactX.configs['recommended-typescript'],
|
||||
// Enable lint rules for React DOM
|
||||
reactDom.configs.recommended,
|
||||
],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
// other options...
|
||||
},
|
||||
},
|
||||
])
|
||||
```
|
||||
VITE_API_URL=http://localhost:3000 # URL backend en développement
|
||||
VITE_SUPABASE_URL=https://xxx.supabase.co
|
||||
VITE_SUPABASE_ANON_KEY=xxx # Clé publique uniquement
|
||||
```
|
||||
|
||||
> ❌ Aucune clé privée ne doit apparaître dans ce fichier ou dans le code frontend.
|
||||
|
||||
## Commandes
|
||||
|
||||
```bash
|
||||
# Installer les dépendances
|
||||
npm install
|
||||
|
||||
# Démarrer en développement
|
||||
npm run dev
|
||||
|
||||
# Builder pour la production
|
||||
npm run build
|
||||
|
||||
# Prévisualiser le build
|
||||
npm run preview
|
||||
```
|
||||
|
||||
## Déploiement
|
||||
|
||||
Plateforme : **Cloudflare Pages**
|
||||
Déploiement : manuel via CLI
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
npx wrangler pages deploy dist --project-name=expria
|
||||
```
|
||||
|
||||
Domaine : `expria.app`
|
||||
|
||||
## Dépôt lié
|
||||
|
||||
Backend : `https://codeberg.org/Hermann_Kitio/expria-backend`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue