npm installCopy .env.example to .env and configure:
cp .env.example .envEdit .env with your settings:
PORT=3000
NODE_ENV=development
# MongoDB Database
MONGODB_URI="mongodb://localhost:27017/safechat"
# JWT Secret (use a strong random string in production)
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
JWT_EXPIRES_IN=1h
# Face Recognition Threshold (lower = more strict)
FACE_RECOGNITION_THRESHOLD=0.6
# CORS Origin
CORS_ORIGIN=http://localhost:3000# Start MongoDB container
docker run --name safechat-mongo \
-p 27017:27017 \
-d mongo:7Make sure MongoDB is installed and running (default port: 27017).
No migrations are required. Collections are created automatically by Mongoose when data is inserted.
# Development mode (with auto-reload)
npm run dev
# Production mode
npm start- Health check: http://localhost:3000/health
- API Documentation: http://localhost:3000/api-docs
- Node.js v18+ installed
- PostgreSQL installed or Docker available
-
.envfile configured - Database migrations run successfully
- Face recognition models in
app/models/faceid/(optional, for FaceID features)
-
Verify MongoDB is running:
# Docker docker ps | grep mongo
-
Check MONGODB_URI in
.envmatches your setup
-
Ensure models are in
app/models/faceid/:ssd_mobilenetv1_model-weights_manifest.jsonface_landmark_68_model-weights_manifest.jsonface_recognition_model-weights_manifest.json- And corresponding
.binfiles
-
Check console for model loading errors
Change PORT in .env to a different port (e.g., 3001)
- Read the README.md for API documentation
- Check docs/WEBSOCKET_USAGE.md for WebSocket examples
- Explore the Swagger documentation at
/api-docs
curl -X POST http://localhost:3000/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"username": "testuser",
"email": "test@example.com",
"password": "Test1234"
}'curl -X POST http://localhost:3000/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "test@example.com",
"password": "Test1234"
}'curl -X POST http://localhost:3000/api/rooms \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-d '{
"name": "My Chat Room",
"description": "A test room",
"isPrivate": true
}'Your SafeChat API is now running and ready to use!