Graviton-Code-Editor /
Graviton-App
๐ A modern-looking Code Editor
Loading repository dataโฆ
mzubair481 / repository
๐ A modern, production-ready Express.js starter template built with TypeScript. Features JWT authentication, Prisma ORM, comprehensive testing, Docker support, and monitoring tools. Perfect for building scalable and secure REST APIs.
๐ A production-ready Express.js boilerplate with TypeScript, featuring robust authentication, logging, monitoring, and best practices for building secure and scalable APIs.
If this boilerplate helps your project take off, consider giving it a โญ๏ธ - it fuels my cosmic journey! ๐
git clone https://github.com/mzubair481/express-boilerplate.git
cd express-boilerplate
npm install
cp .env.example .env
npm run migrate:dev
npm run seed:dev
npm run dev
Run the entire stack using Docker Compose:
# Start all services
npm run docker:dev
# View logs
npm run docker:dev:logs
# Rebuild and start services
npm run docker:dev:build
# Stop services and remove volumes
npm run docker:dev:down
The development environment is configured with:
# Key configurations in docker-compose.dev.yml
services:
api:
volumes:
- ./src:/app/src:delegated # Source code
- ./prisma:/app/prisma:delegated # Prisma schema
- api_node_modules:/app/node_modules
environment:
- NODE_ENV=development
- CHOKIDAR_USEPOLLING=true
- CHOKIDAR_INTERVAL=1000
This will start:
Grafana:
adminadminPrometheus:
Alertmanager:
npm run dev - Start development servernpm run build - Build for productionnpm start - Start production server with GC metrics enablednpm test - Run testsnpm run test:e2e - Run E2E testsnpm run test:coverage - Generate test coveragenpm run migrate:dev - Run database migrationsnpm run seed:dev - Seed database with test datanpm run studio - Open Prisma Studio# Build and start services
docker-compose up -d --build
# Stop services
docker-compose down
# View logs
docker-compose logs -f [service]
# Restart a service
docker-compose restart [service]
# Remove volumes (database data)
docker-compose down -v
โโโ src/
โ โโโ __tests__/ # Test files
โ โโโ @types/ # TypeScript type definitions
โ โโโ config/ # Configuration files
โ โโโ controllers/ # Route controllers
โ โโโ middleware/ # Express middleware
โ โโโ routes/ # API routes
โ โโโ services/ # Business logic
โ โโโ utils/ # Utility functions
โ โโโ validators/ # Request validation schemas
โ โโโ app.ts # Express app setup
โ โโโ index.ts # Application entry point
โโโ prisma/ # Prisma schema and migrations
โโโ requests/ # REST client files
โโโ docker/ # Docker configuration files
The API is fully documented using OpenAPI/Swagger. You can access the interactive documentation at:
http://localhost:4300/api-docs
POST /api/auth/signup - Register new userPOST /api/auth/login - User loginPOST /api/auth/refresh - Refresh access tokenPOST /api/auth/logout - User logoutGET /api/auth/verify-email/:token - Verify emailPOST /api/auth/send-email-verification - Resend verification emailPOST /api/auth/forgot-password - Request password resetPOST /api/auth/reset-password/:token - Reset passwordGET /api/users - Get all users (Admin only)GET /api/users/:id - Get user by IDPOST /api/users - Create user (Admin only)PATCH /api/users/:id - Update userDELETE /api/users/:id - Delete user (Admin only)GET /health - Service health checkGET /api/monitoring/metrics - Prometheus metricsGET /api/monitoring/readiness - Readiness probeGET /api/monitoring/liveness - Liveness probeAll protected endpoints require a valid JWT token in the Authorization header:
Authorization: Bearer <your_jwt_token>
POST /api/auth/signup
{
"email": "user@example.com",
"password": "SecurePass123!",
"name": "John Doe"
}
Response 201:
{
"success": true,
"message": "User registered successfully",
"data": {
"id": "uuid",
"email": "user@example.com",
"name": "John Doe"
}
}
POST /api/auth/login
{
"email": "user@example.com",
"password": "SecurePass123!"
}
Response 200:
{
"success": true,
"message": "Login successful",
"data": {
"accessToken": "jwt_token",
"refreshToken": "refresh_token"
}
}
The API uses standardized error responses:
{
"success": false,
"message": "Error message",
"code": "ERR_XXXX",
"stack": "Error stack trace (development only)"
}
The API provides Prometheus metrics at /api/monitoring/metrics including:
Bearer <token>Connection
ws://localhost:4300wss://your-domain.com (production)Message Format:
{
"type": "message_type",
"data": {
// message payload
}
}
ping - Health check ping
// Client -> Server
{ "type": "ping" }
// Server -> Client
{
"type": "pong",
"data": { "timestamp": 1234567890 }
}
connection - Initial connection confirmation
// Server -> Client
{
"type": "connection",
"data": {
"clientId": "abc123",
"message": "Connected to WebSocket server"
}
}
// Connect to WebSocket server
const ws = new WebSocket('ws://localhost:4300');
// Handle connection open
ws.onopen = () => {
console.log('Connected to WebSocket server');
};
// Handle incoming messages
ws.onmessage = (event) => {
const message = JSON.parse(event.data);
console.log('Received:', message);
// Handle different message types
switch (message.type) {
case 'connection':
console.log('Connected with ID:', message.data.clientId);
break;
case 'pong':
console.log('Ping response received');
break;
}
};
// Handle errors
ws.onerror = (error) => {
console.error('WebSocket error:', error);
};
// Handle connection close
ws.onclose = () => {
console.log('Disconnected from WebSocket server');
};
// Send a ping message
ws.send(JSON.stringify({ type: 'ping' }));
The application uses structured error codes for better error handling:
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
Selected from shared topics, language and repository descriptionโnot editorial ratings.
Graviton-Code-Editor /
๐ A modern-looking Code Editor
devowlio /
๐WordPress Plugin Boilerplate using modern web techs like TypeScript, SASS, and so on... on top of a local development environment with Docker and predefined GitLab CI for continous integration and deployment!
pacholoamit /
Pachtop - a more modern system monitor ๐
wrappixel /
Flexy Lite, built on Next.js, Material UI, and TypeScript, is a sleek and powerful Admin Dashboard Template tailored for modern developers. ๐ Free to download and ready for personal or commercial use.
Dan-Duran /
๐ A modern, responsive portfolio template for cybersecurity professionals built with React, TypeScript, and Flowbite. Features include system-aware dark/light theme, SEO optimization, and clean component architecture.
Hazrat-Ali9 /
โ An ๐ intelligent โฝ and ๐ซ user ๐ฅ friendly ๐ chatbot ๐ฅ application ๐ณ designed ๐ช to deliver ๐ฎ seamless ๐งธ conversations ๐and ๐ real ๐ time ๐ฐ interactions โด modern ๐ frameworks ๐ฃ like ๐ฝ React ๐ค Node.js ๐ Integrates ๐ with APIs ๐ databases ๐ฆ and ๐งจ third ๐ party ๐ platforms โ