StrellerMinds Backend is a modern NestJS-based API server that powers a blockchain education platform built on the Stellar network. This backend provides a robust foundation for educational platforms focused on blockchain technology, offering secure user management, course delivery, and seamless Stellar blockchain integration for on-chain learning verification and credentialing.
The platform is designed for educational institutions, online learning platforms, and blockchain training providers who want to offer verifiable, on-chain certificates and credentials while maintaining a traditional learning management system experience.
- Modern Architecture: Built with NestJS for scalable, maintainable code
- Stellar Integration: Seamless blockchain interactions for credential verification
- RESTful APIs: Clean, well-documented endpoints for all platform features
- TypeScript: Full type safety and enhanced developer experience
- Modular Design: Clean separation of concerns with NestJS modules
- Auto-generated Documentation: Interactive Swagger/OpenAPI documentation
- Comprehensive Testing: Unit and integration tests with Jest
- Environment Configuration: Flexible configuration management
- 📊 Application Performance Monitoring: DataDog & New Relic integration with distributed tracing, performance profiling, and alerting
- 🔍 Performance Profiling: Memory, CPU, and operation profiling with hotspot detection
⚠️ Performance Alerting: Real-time alerts with Slack and PagerDuty integration
This backend includes a comprehensive Application Performance Monitoring (APM) system:
- Distributed Tracing: W3C standard trace context for cross-service debugging
- Performance Profiling: Memory leak detection, hotspot analysis, percentile calculations
- APM Integration: DataDog and New Relic support with automatic instrumentation
- Smart Alerting: Configurable alerts for memory, CPU, response time, error rates
- Real-time Dashboards: Monitor performance through Monitoring API endpoints
-
Set your APM provider credentials:
export DATADOG_API_KEY=your-key # or NEW_RELIC_LICENSE_KEY export APP_NAME=strellerminds-backend
-
Access monitoring endpoints:
# Performance profile curl http://localhost:3000/api/monitoring/profiling/report # Active traces curl http://localhost:3000/api/monitoring/tracing/active-spans # Current alerts curl http://localhost:3000/api/monitoring/alerts/active
See APM_IMPLEMENTATION.md for full documentation.
- Framework: NestJS (Node.js)
- Language: TypeScript
- Database: PostgreSQL with TypeORM
- Blockchain: Stellar Network
- Authentication: JWT-based auth
- Documentation: Swagger/OpenAPI
- Testing: Jest
- Code Quality: ESLint + Prettier
- Monitoring: DataDog/New Relic APM with distributed tracing
- Node.js v18 or higher
- npm or yarn package manager
- PostgreSQL database (v12 or higher)
- Git for version control
git clone https://github.com/https://github.com/StarkMindsHQ/strellerminds-backend.git
cd strellerminds-backendnpm install# Copy the example environment file
cp .env.example .env
# Edit .env with your configuration
# Required: Database connection, JWT secret, Stellar network settingsEnsure PostgreSQL is running and create the database:
CREATE DATABASE strellerminds;# Development mode with hot reload
npm run start:dev
# Production mode
npm run build
npm run start:prodThe API will be available at http://localhost:3000
# Check if server is running
curl http://localhost:3000
# Should return: {"message": "Hello World!"}# Development
npm run start:dev # Start in development mode with hot reload
npm run start:debug # Start in debug mode
npm run start # Start in production mode
# Building
npm run build # Build the application
npm run build:prod # Build for production
# Testing
npm run test # Run unit tests
npm run test:cov # Run tests with coverage report
npm run test:e2e # Run end-to-end tests
npm run test:watch # Run tests in watch mode
# Code Quality
npm run lint # Lint the codebase
npm run lint:fix # Fix linting issues automatically
npm run format # Format code with PrettierCreate a .env file from .env.example and configure these essential variables:
# Database Configuration
DATABASE_HOST=localhost
DATABASE_PORT=5432
DATABASE_USER=postgres
DATABASE_PASSWORD=your_password
DATABASE_NAME=strellerminds
# JWT Authentication
JWT_SECRET=your_super_secret_jwt_key_here
JWT_EXPIRES_IN=24h
# Stellar Blockchain
STELLAR_NETWORK=TESTNET
SOROBAN_RPC_URL=https://soroban-testnet.stellar.org
# Application
PORT=3000
NODE_ENV=developmentFor a complete list of all available environment variables, refer to .env.example.
The project follows a modular monolithic architecture, ensuring a clean separation of concerns while maintaining development velocity.
- Architecture Overview: High-level design and infrastructure diagrams.
- Module Interactions: Detailed dependency mapping between core modules.
- Architecture Decisions (ADR): Rationale behind key technical choices.
src/
├── app.module.ts # Root application module
├── main.ts # Application entry point
├── common/ # Shared utilities, validation, and security
├── modules/ # Domain-specific modules (Auth, User, Course, etc.)
└── config/ # Environment-specific configurations
A comprehensive documentation suite is available in the docs/ directory:
- Developer Onboarding: Setup, coding standards, and Git workflow.
- Deployment & Infrastructure: Docker, Redis, and Observability stack.
- API Documentation (Swagger): Interactive endpoint explorer.
Once the server is running, access the interactive API documentation:
- Swagger UI:
http://localhost:3000/api/docs - OpenAPI JSON:
http://localhost:3000/api/docs-json
The project includes comprehensive test coverage:
# Run all tests
npm run test
# Run tests with coverage
npm run test:cov
# Run specific test file
npm run test -- auth/auth.service.spec.ts
# Run tests in watch mode for development
npm run test:watch
# Load Testing (Artillery)
npm run perf:load # Run standard load test
npm run perf:stress # Run high-load stress test
npm run perf:check # Run performance regression check
# Benchmarking (Autocannon)
npm run perf:benchmark # Run benchmarks for critical endpointsThe application includes built-in Prometheus metrics. You can access them at:
- Metrics Endpoint:
http://localhost:3000/api/health/metrics - Dashboard: Use the provided
monitoring/grafana-dashboard.jsonfor Grafana.
Key metrics tracked:
http_requests_total: Total request volume by method/route/status.http_request_duration_seconds: Response time distributions.active_connections: Number of concurrent connections being processed.service_memory_usage_bytes: Real-time memory metrics.
- All sensitive data should be stored in environment variables
- JWT secrets must be strong and unique
- Database connections should use SSL in production
- API endpoints should implement proper authentication and authorization
- Regular security audits are recommended
# Build the application
npm run build
# Start production server
npm run start:prod# Build Docker image
docker build -t strellerminds-backend .
# Run container
docker run -p 3000:3000 strellerminds-backend- Development: Hot reload, detailed logging, relaxed security
- Staging: Production-like environment for testing
- Production: Optimized performance, enhanced security
We welcome contributions! Please follow these guidelines:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes with proper testing
- Follow the existing code style and patterns
- Run tests and ensure they pass:
npm run test - Commit your changes with descriptive messages
- Push to your fork:
git push origin feature/amazing-feature - Create a Pull Request
- Follow TypeScript best practices
- Write meaningful commit messages
- Include tests for new functionality
- Ensure all tests pass before submitting
- Follow the existing code formatting (Prettier)
- Use the GitHub issue tracker
- Provide detailed reproduction steps
- Include environment details
- Add relevant logs or screenshots
- NestJS Documentation: https://docs.nestjs.com/
- Stellar Developers: https://developers.stellar.org/
- TypeORM Documentation: https://typeorm.io/
- TypeScript Handbook: https://www.typescriptlang.org/docs/
-
Database Connection Errors
- Verify PostgreSQL is running
- Check database credentials in
.env - Ensure database exists
-
Module Import Errors
- Run
npm installto ensure dependencies - Check TypeScript configuration
- Verify file paths and module names
- Run
-
Port Already in Use
- Change PORT in
.envfile - Kill existing processes:
lsof -ti:3000 | xargs kill
- Change PORT in
- Check existing GitHub issues
- Review the documentation
- Join our community discussions
- Contact maintainers for support
This project is UNLICENSED - all rights reserved.
- NestJS team for the excellent framework
- Stellar Development Foundation for blockchain infrastructure
- Open source community for valuable tools and libraries
The application uses environment variables for configuration. All variables are required unless a default value is specified.
| Variable | Description | Default / Required |
|---|---|---|
| PORT | Server port | 3000 |
| Variable | Description | Required |
|---|---|---|
| DATABASE_HOST | PostgreSQL host | localhost |
| DATABASE_PORT | PostgreSQL port | 5432 |
| DATABASE_USER | PostgreSQL username | Required |
| DATABASE_PASSWORD | PostgreSQL password | Required |
| DATABASE_NAME | PostgreSQL database name | StrellerMinds |
| Variable | Description | Required |
|---|---|---|
| JWT_SECRET | Secret key for JWT authentication | mysecretJourney |
| Variable | Description | Required |
|---|---|---|
| CLOUDINARY_CLOUD_NAME | Cloudinary cloud name | ds3czwdtg |
| CLOUDINARY_API_KEY | Cloudinary API key | 377545627931675 |
| CLOUDINARY_API_SECRET | Cloudinary API secret | pFrg1_s63mhEQ_v9w-IVdDFq3jE |
| Variable | Description | Required |
|---|---|---|
| STELLAR_SECRET_KEY | Secret key for Stellar network (use secure key management) | <your_secure_key_from_secrets_manager> |
| Variable | Description | Required |
|---|---|---|
| EMAIL_ENABLED | Enable email sending | false |
| EMAIL_TRACKING_ENABLED | Enable tracking | true |
| EMAIL_TRACKING_SECRET | Secret for tracking | |
| EMAIL_TRACKING_BASE_URL | Base URL for email links | http://localhost:3000 |
| Variable | Description | Required |
|---|---|---|
| REDIS_HOST | Redis host | localhost |
| REDIS_PORT | Redis port | 6379 |
Built with ❤️ for the blockchain education community