Système complet de gestion et de suivi des agents de sécurité avec tracking GPS en temps réel.
- Database: MySQL → Railway (Déjà configuré)
- Backend: Node.js API + WebSocket → Render (Frankfurt)
- Frontend: React Dashboard → Vercel (CDN Global)
Pourquoi cette architecture ?
- ✅ Railway : MySQL natif, pas de migration nécessaire
- ✅ Render : Backend stable, WebSocket performant
- ✅ Vercel : Frontend ultra-rapide, CDN mondial gratuit
- 💰 Coût : ~$5-10/mois
| Architecture | Guide | Temps | Description |
|---|---|---|---|
| Railway DB + Render + Vercel ⭐ | Quick Start | 25 min | Recommandé - Architecture optimale |
| Railway DB + Render + Vercel | Guide Complet | - | Documentation détaillée hybride |
| Railway Complet | Railway Quick | 15 min | Tout sur Railway |
| Railway Complet | Railway Guide | - | Guide Railway détaillé |
| Render + Vercel | Render Quick | 25 min | Render avec PostgreSQL |
| Render + Vercel | Render Guide | - | Guide Render détaillé |
# Prérequis : Railway DB MySQL déjà configuré ✅
# 1. Backend sur Render
# → https://dashboard.render.com → New Web Service
# → Repo: betusn2/security-workforce-manager
# → Root: backend/
# → Variables: Utiliser infos Railway DB
# 2. Frontend sur Vercel
# → https://vercel.com/new
# → Root: web-dashboard/
# → Variables: URL Render
# 3. Mettre à jour les URLs croisées
# 4. Créer l'admin
# → Render Shell: node create-first-admin.js
- ✅ Authentification des agents et responsables
- ✅ Pointage via reconnaissance faciale
- ✅ Géolocalisation en temps réel
- ✅ Notifications automatiques WhatsApp/SMS
- ✅ Historique des présences et absences
- ✅ CRUD Agents, Responsables, Événements
- ✅ Stockage sécurisé des vecteurs faciaux (AES encryption)
- ✅ Gestion des présences et retards
- ✅ Envoi automatique de notifications (Twilio)
- ✅ Authentification JWT et contrôle d'accès par rôle
- ✅ Logs d'activités complets
- ✅ WebSocket pour temps réel
- ✅ Gestion des utilisateurs, événements et affectations
- ✅ Visualisation des présences et géolocalisation
- ✅ Rapports PDF/Excel
- ✅ Historique et logs d'activité
- ✅ Interface responsive
- ✅ users (agents et responsables)
- ✅ events (événements)
- ✅ assignments (affectations agents)
- ✅ attendance (pointages)
- ✅ notifications (messages)
- ✅ activity_logs (audit)
- ✅ Hashing mots de passe (bcrypt - 12 rounds)
- ✅ Cryptage vecteurs faciaux (AES-256)
- ✅ Rate limiting
- ✅ Helmet security headers
- ✅ Audit logs complets
security-guard-management/
├── backend/ # API Node.js/Express
│ ├── src/
│ │ ├── config/ # Configuration DB
│ │ ├── controllers/ # Contrôleurs API
│ │ ├── middlewares/ # Auth, validation, logs
│ │ ├── models/ # Modèles Sequelize
│ │ ├── routes/ # Routes API
│ │ ├── services/ # Services métier
│ │ └── server.js # Point d'entrée
│ ├── migrations/ # Scripts SQL
│ └── package.json
│
├── web-dashboard/ # Dashboard React.js
│ ├── src/
│ │ ├── components/ # Composants React
│ │ ├── pages/ # Pages
│ │ ├── services/ # API calls
│ │ └── hooks/ # Hooks personnalisés
│ └── package.json
│
├── mobile-app/ # App React Native/Expo
│ ├── src/
│ │ ├── screens/ # Écrans
│ │ ├── components/ # Composants
│ │ └── services/ # API & state
│ └── package.json
│
└── index.html # Page d'accueil projet
- XAMPP avec Apache et MySQL
- Node.js v18+ et npm
- Expo CLI (pour l'app mobile)
- Démarrez XAMPP (Apache et MySQL)
- Ouvrez http://localhost/phpmyadmin
- Exécutez le script SQL:
backend/migrations/001-create-tables-mysql.sql
cd C:\xampp\htdocs\security-guard-management\backend
npm install
npm run dev
Le serveur démarre sur http://localhost:5000
cd C:\xampp\htdocs\security-guard-management\web-dashboard
npm install
npm start
Le dashboard est accessible sur http://localhost:3000
cd C:\xampp\htdocs\security-guard-management\mobile-app
npm install
npx expo start
Scannez le QR code avec l'app Expo Go sur votre téléphone.
# Server
NODE_ENV=development
PORT=5000
# MySQL (XAMPP)
DB_HOST=localhost
DB_PORT=3306
DB_NAME=security_guard_db
DB_USER=root
DB_PASSWORD=
# JWT
JWT_SECRET=votre_cle_secrete_jwt
JWT_EXPIRES_IN=7d
# Encryption
ENCRYPTION_KEY=votre_cle_32_caracteres
# Twilio (optionnel)
TWILIO_ACCOUNT_SID=
TWILIO_AUTH_TOKEN=
TWILIO_PHONE_NUMBER=
TWILIO_WHATSAPP_NUMBER=
Éditez mobile-app/src/services/api.js et remplacez l'IP par celle de votre PC:
const API_URL = 'http://192.168.1.XXX:5000/api';
- Email: [email protected]
- Mot de passe: Admin@123
POST /api/auth/login- ConnexionPOST /api/auth/register- InscriptionPOST /api/auth/logout- DéconnexionGET /api/auth/profile- Profil utilisateur
GET /api/users- Liste des utilisateursPOST /api/users- Créer un utilisateurGET /api/users/:id- Détails utilisateurPUT /api/users/:id- Modifier utilisateurDELETE /api/users/:id- Supprimer utilisateur
GET /api/events- Liste des événementsPOST /api/events- Créer un événementGET /api/events/:id- Détails événementPUT /api/events/:id- Modifier événementDELETE /api/events/:id- Supprimer événement
GET /api/assignments- Liste des affectationsPOST /api/assignments- Créer une affectationPOST /api/assignments/bulk- Affectations multiplesPOST /api/assignments/:id/respond- Confirmer/Refuser
POST /api/attendance/check-in- Pointage arrivéePOST /api/attendance/check-out/:id- Pointage départGET /api/attendance- Liste des présencesGET /api/attendance/stats- Statistiques
GET /api/reports/dashboard- Stats dashboardGET /api/reports/attendance/pdf- Rapport PDFGET /api/reports/attendance/excel- Rapport Excel
| Rôle | Permissions |
|---|---|
admin |
Accès complet à toutes les fonctionnalités |
supervisor |
Gestion des agents, événements, affectations |
agent |
Pointage, consultation de ses données |
Accédez à http://localhost/security-guard-management/ pour voir la présentation du projet.
- Backend: Node.js, Express, Sequelize, MySQL
- Frontend: React.js, Tailwind CSS, Recharts
- Mobile: React Native, Expo
- Auth: JWT, bcrypt
- Notifications: Twilio (SMS/WhatsApp), Nodemailer
- Real-time: Socket.IO
- Reports: PDFKit, ExcelJS
Ce projet est fourni à des fins éducatives et de démonstration.