Skip to content

TerraProxi/Gateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TerraProxi Gateway

API Gateway pour la plateforme TerraProxi. Point d'entrée unique pour tous les services.

🌐 Architecture

                    ┌─────────────────────────────────────┐
                    │      gateway.terraproxi.fr          │
                    │         (Port 3000)                 │
                    └──────────────┬──────────────────────┘
                                   │
              ┌────────────────────┼────────────────────┐
              │                    │                    │
              ▼                    ▼                    ▼
     ┌────────────────┐   ┌────────────────┐   ┌────────────────┐
     │   /auth/*      │   │    /api/*      │   │   /health      │
     │   Auth API     │   │  Backend API   │   │   Status       │
     │  (Port 3001)   │   │  (Port 3002)   │   │                │
     └────────────────┘   └────────────────┘   └────────────────┘

🚀 Installation

bun install
cp env.example .env
bun run dev

📡 Routes

Route Service Description
/auth/* Auth API Authentification, profils, tokens
/api/* Backend API API principale TerraProxi
/health Gateway État de tous les services
/ Gateway Infos et liste des services

🔧 Configuration

Variable Description Défaut
PORT Port de la gateway 3000
AUTH_SERVICE_URL URL du service Auth http://localhost:3001
API_SERVICE_URL URL du service Backend http://localhost:3002
CORS_ORIGIN Origines CORS autorisées localhost:3000,5173

📋 Exemples

Authentification via Gateway

# Login
curl -X POST http://localhost:3000/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "user@test.com", "password": "User123!"}'

# Profil
curl http://localhost:3000/auth/profile \
  -H "Authorization: Bearer YOUR_TOKEN"

Health Check

curl http://localhost:3000/health

Réponse :

{
  "gateway": "healthy",
  "timestamp": "2024-01-01T00:00:00.000Z",
  "services": {
    "auth": { "name": "Auth API", "healthy": true, "latency": 5 },
    "api": { "name": "Backend API", "healthy": true, "latency": 8 }
  },
  "status": "all_services_up"
}

📄 Licence

MIT - TerraProxi Team

Releases

No releases published

Packages

No packages published