Aller au contenu principal

Prérequis

Environnement de Développement

Logiciels Requis

LogicielVersionUsage
Node.js20.x LTSRuntime JavaScript
npm10.xGestionnaire de paquets
Docker24.xContainerisation
Docker Compose2.xOrchestration locale
Git2.xContrôle de version

Installation Node.js

# Via nvm (recommandé)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm install 20
nvm use 20

# Vérification
node --version # v20.x.x
npm --version # 10.x.x

Installation Docker

# macOS
brew install --cask docker

# Ubuntu
sudo apt update
sudo apt install docker.io docker-compose-plugin

# Vérification
docker --version
docker compose version

Services Externes

Supabase

  1. Créer un compte sur supabase.com
  2. Créer un nouveau projet
  3. Récupérer les clés :
    • Project URL : https://xxx.supabase.co
    • Anon Key : Pour le frontend
    • Service Role Key : Pour le backend (secret)

Stripe

  1. Créer un compte sur stripe.com
  2. Activer le mode test
  3. Récupérer les clés :
    • Publishable Key : pk_test_...
    • Secret Key : sk_test_...
  4. Configurer un webhook :
    • URL : https://xxx.supabase.co/functions/v1/stripe-webhook
    • Événements : checkout.session.completed
  5. Récupérer le Webhook Secret : whsec_...

Domaines (Production)

  • Domaine principal : momentscollectifs.fr
  • Sous-domaine app : app.momentscollectifs.fr
  • Sous-domaine API : api.momentscollectifs.fr

Configuration DNS :

momentscollectifs.fr        A       <IP_SERVEUR>
app.momentscollectifs.fr A <IP_SERVEUR>
api.momentscollectifs.fr A <IP_SERVEUR>

Configuration Locale

Cloner le Projet

git clone https://github.com/user/momentscollectifs.git
cd momentscollectifs

Structure des Environnements

momentscollectifs/
├── front-dedicaces/
│ └── src/environments/
│ ├── environment.ts # Dev
│ └── environment.prod.ts # Prod
├── back-dedicaces/
│ ├── .env # Dev
│ └── .env.production # Prod
└── dedicace-generator/
└── .env # Config

Configuration Frontend

// front-dedicaces/src/environments/environment.ts
export const environment = {
production: false,
supabaseUrl: 'http://localhost:54321',
supabaseKey: 'eyJ...', // Anon key local
stripeKey: 'pk_test_...',
generatorUrl: 'http://localhost:5001'
};

Configuration Backend

# back-dedicaces/.env
POSTGRES_PASSWORD=postgres
JWT_SECRET=super-secret-jwt-token
ANON_KEY=eyJ...
SERVICE_ROLE_KEY=eyJ...
SITE_URL=http://localhost:4200

Configuration Video Generator

# dedicace-generator/.env
PORT=5001
NODE_ENV=development
SUPABASE_URL=http://localhost:54321
SUPABASE_SERVICE_KEY=eyJ...

Démarrage Local

1. Backend Supabase

cd back-dedicaces

# Démarrer Supabase local
npx supabase start

# Appliquer les migrations
npx supabase db push

# Vérifier le statut
npx supabase status

Supabase local expose :

  • API : http://localhost:54321
  • Studio : http://localhost:54323
  • DB : postgresql://postgres:postgres@localhost:54322/postgres

2. Frontend Angular

cd front-dedicaces

# Installer les dépendances
npm install

# Démarrer le serveur de développement
npm start

Frontend accessible sur : http://localhost:4200

3. Video Generator

cd dedicace-generator

# Installer les dépendances
npm install

# Démarrer en mode développement
npm run dev

API accessible sur : http://localhost:5001

4. Landing Page (optionnel)

cd landing-page-kazadedicate

# Via Python
python -m http.server 8000

# Ou via Docker
docker-compose up -d

Landing accessible sur : http://localhost:8000


Vérification

Checklist Développement

  • Node.js 20.x installé
  • Docker et Docker Compose installés
  • Compte Supabase créé
  • Compte Stripe créé (mode test)
  • Supabase local démarre correctement
  • Frontend accessible sur localhost:4200
  • Video Generator accessible sur localhost:5001
  • Connexion Supabase fonctionnelle

Tests de Santé

# Backend Supabase
curl http://localhost:54321/rest/v1/

# Video Generator
curl http://localhost:5001/health

# Frontend
curl http://localhost:4200