Backend microservices project built with ElysiaJS and Bun, using Firebase as NoSQL backend.
- Unit Tests: All services have complete test coverage
- CI/CD Pipeline: Automated testing and coverage reports
- Firebase Mocking: Isolated tests without external dependencies
- Coverage Reports: Automatic generation and deployment to GitHub Pages
- Multi-Service Architecture: Company, Forms, and User services
Test coverage reports are available at: Coverage Dashboard
- api-gateway: Entry point for all external requests. Redirects and controls access to internal microservices.
- user-service: Microservice dedicated to authentication and user management (registration, login, password recovery, etc.) using Firebase Auth and Firestore.
- company-service: Microservice for managing company information.
- forms-service: Microservice for handling NIST forms and audits.
Each microservice is independent and communicates through the API Gateway. Deployment is done using Docker and Docker Compose.
- Bun (ultra-fast runtime for JavaScript/TypeScript)
- ElysiaJS (web framework for Bun)
- Firebase (Auth and Firestore)
- Swagger/OpenAPI (interactive API documentation)
- Docker and Docker Compose
- Vitest (testing framework for Bun/Node.js)
- Elysia Swagger Plugin (automatic documentation generation)
- Already created .env files
- Bun (latest version)
- Docker / Docker Compose / Podman
-
Clone the repository:
git clone https://github.com/PostboxRetinal/proyectoNIST.git cd proyectoNIST -
Create the necessary
.envfiles in each microservice -
Install and run docker to start the complete project stack
docker-compose up --build
The API Gateway with nginx automatically redirects requests to the corresponding services:
User Service (via API Gateway: /api/users/)
├── POST /users/register - User registration
├── POST /users/login - Authentication
├── GET /users/profile - User profile
├── PUT /users/profile - Update profile
├── POST /users/forgot - Password recovery
└── GET /users/roles - Get available roles
Company Service (via API Gateway: /api/companies/)
├── POST /companies/ - Create company
├── GET /companies/ - List companies
├── GET /companies/:id - Get company by ID
├── PUT /companies/:id - Update company
├── DELETE /companies/:id - Delete company
└── GET /companies/types - Business types
Forms Service (via API Gateway: /api/forms/)
├── POST /forms/ - Create form
├── GET /forms/ - List forms
├── GET /forms/:id - Get form
├── PUT /forms/:id - Update form
├── POST /forms/:id/submit - Submit form
└── GET /forms/:id/report - Generate report💡 Note: All endpoints are available through the API Gateway at
http://localhost:3001. Internal service routes (ports 4001, 4002, 4003) are for direct development.
-
Start the services:
docker-compose up --build
-
Access documentation through API Gateway:
- User Service:
http://localhost:3000/api/docs/user - Company Service:
http://localhost:3000/api/docs/company - Forms Service:
http://localhost:3000/api/docs/forms
- User Service:
-
Explore and test endpoints:
- Navigate through available endpoints
- Test requests directly from the interface
- Visualize required data models
bun run dev— Start service in development mode with auto-reloaddocker-compose up --build— Start all services with Docker
bun test— Run all testsbun run test:coverage— Run tests with coverage reportbun test --watch— Run tests in watch modebun test --ui— Open Vitest web interface
- Reports are generated automatically in CI/CD
- Available at: Coverage Dashboard
- Unit Tests:
.github/workflows/unit-tests.yml- Runs tests on every push - Coverage Report:
.github/workflows/coverage-report.yml- Generates and publishes coverage reports
- Global Mocks: Configured in
tests/setup.tsfor each service - Test Isolation: Each test runs in an isolated environment
- No External Dependencies: Tests don't require real Firebase connection
- Vitest Configuration: Optimized for Bun runtime
- Setup Files: Global configuration of mocks and utilities
- Test Helpers: Auxiliary functions for testing in
tests/helpers/ - Coverage Reports: Automatic generation with detailed metrics
- Multi-Service Testing: Parallel tests for each microservice
- Artifact Management: Coverage stored and combined automatically
- GitHub Pages Deployment: Reports published automatically
Developed with ❤️ using Bun, ElysiaJS and Firebase.