Enterprise-grade backend service for the SaaS Benchmarks Platform providing benchmark data management, authentication, and API services.
The SaaS Benchmarks Platform backend is a Node.js-based microservices architecture that powers the benchmark data management and API services. It provides secure access to SaaS performance metrics across 14 key performance indicators (KPIs) with comprehensive filtering capabilities.
- RESTful API for benchmark data access and management
- Role-based access control with Google OAuth authentication
- Multi-tenant data management with PostgreSQL
- High-performance caching with Redis
- Comprehensive logging and monitoring
- Enterprise-grade security measures
- Runtime: Node.js 18.x LTS with TypeScript 5.x
- Database: PostgreSQL 14
- Caching: Redis 7.x
- Containerization: Docker & Docker Compose
- Authentication: Google OAuth 2.0
- Testing: Jest & Supertest
# Clone repository
git clone <repository_url>
cd saas-benchmarks-backend
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Start development environment
docker-compose up -d
npm run dev
- Node.js >= 18.0.0
- PostgreSQL 14
- Redis 7
- Docker >= 20.10.0
- Docker Compose >= 2.0.0
- Memory: 4GB RAM minimum
- Storage: 20GB available space
- CPU: 2 cores minimum
- Copy the environment template:
cp .env.example .env
- Configure required environment variables:
NODE_ENV=development
PORT=3000
DB_HOST=localhost
DB_PORT=5432
REDIS_HOST=localhost
REDIS_PORT=6379
GOOGLE_CLIENT_ID=your_google_client_id
JWT_SECRET=your_jwt_secret
# Run migrations
npm run migrate:latest
# Seed development data
npm run seed:run
# Start development environment
docker-compose up -d
# Start development server with hot reload
npm run dev
- API Gateway Service
- Authentication Service
- Metrics Service
- Export Service
- Data Management Service
- Request validation and authentication
- Business logic processing
- Data retrieval/manipulation
- Response formatting
- Caching strategy
- Google OAuth 2.0 for admin authentication
- JWT-based session management
- Rate limiting: 1000 requests/hour per IP
GET /api/v1/metrics
GET /api/v1/metrics/:id
GET /api/v1/benchmarks
GET /api/v1/sources
POST /api/v1/admin/metrics
PUT /api/v1/admin/metrics/:id
DELETE /api/v1/admin/metrics/:id
POST /api/v1/admin/import
# Create new migration
npm run migrate:make migration_name
# Run migrations
npm run migrate:latest
# Rollback migrations
npm run migrate:rollback
- Daily automated backups
- Point-in-time recovery
- 30-day retention period
# Run all tests
npm run test
# Run unit tests
npm run test:unit
# Run integration tests
npm run test:integration
# Generate coverage report
npm run test:coverage
- Unit tests for business logic
- Integration tests for API endpoints
- E2E tests for critical flows
- Performance testing for scalability
- TLS 1.3 encryption
- CORS policy enforcement
- Rate limiting
- Input validation
- SQL injection prevention
- XSS protection
- Google OAuth authentication
- JWT token generation
- Role-based access control
- Session management
# Build application
npm run build
# Start production server
npm run start
- Multi-stage Docker builds
- Environment-specific configurations
- Secrets management
- Health monitoring
- Database connection errors
- Redis connection issues
- Authentication failures
- Performance bottlenecks
# Enable debug logs
DEBUG=app:* npm run dev
# Check service health
docker-compose ps
docker-compose logs -f
Script | Description |
---|---|
npm start |
Start production server |
npm run dev |
Start development server with hot reload |
npm run build |
Build TypeScript to JavaScript |
npm run test |
Run all tests |
npm run lint |
Run ESLint for code quality |
npm run format |
Format code using Prettier |
Copyright © 2023 SaaS Benchmarks Platform. All rights reserved.