@TODO: add project description
- Features
- Installation
- Available Scripts
- Documentation
- CI/CD and Releases
- Logging System
- Contributions
- License
- Framework: Modular NestJS structure.
- Documentation: Interactive API documentation via Swagger.
- Database: PostgreSQL managed with MikroORM.
- Automation: CI/CD pipelines configured using GitHub Actions.
- Releases: Automated versioning and changelog management with Semantic Release.
- Developer Tools:
- ESLint, Prettier, Husky, Commitlint.
- Renovate for dependency updates.
- Node.js >= 22.
- Docker and Docker Compose.
-
Clone the repository:
git clone [email protected]:tineverse/eleve-base.git cd eleve-base
-
Create the .env file: Copy the provided
.env.exampletemplate to.env:cp .env.example .env
Update the variables in the .env file as needed.
-
Start the services with Docker:
make start
-
Install dependencies:
make install
-
Access the Swagger documentation:
http://localhost:3000/api/docs
npm run start:dev: Start the server in development mode.
npm run lint: Run ESLint to check for style errors.npm run format: Use Prettier to format the code.
npm run test: Run unit tests.npm run test:cov: Generate a coverage report.
npm run release: Generate a new version with Semantic Release.
npm run commit: Helps create commit messages following Conventional Commits.
The API documentation is available at: http://localhost:3000/api/docs
- x-correlation-id: Correlation identifier for tracing related requests.
- Type:
string - Required:
false - Scope: Request headers
- Type:
The API includes a middleware to ensure client compatibility based on the API version. For more details, see the Version Control Guide.
The healthcheck endpoint provides information about the application's status, including:
- Database Connection: Verifies if the database is reachable.
- Swagger Availability: Ensures the API documentation endpoint is accessible.
Endpoint: http://localhost:3000/health
src/
βββ application/ # Application layer for use cases, commands, and queries
βββ domain/ # Core business logic and domain models
β βββ entities/ # Business entities (e.g., User)
β βββ repositories/ # Interfaces for data access
β βββ value-objects/ # Immutable value objects (if needed in the future)
βββ infrastructure/ # Infrastructure layer for external dependencies
β βββ config/ # Configuration files (e.g., logging, database)
β βββ interceptors/ # Custom interceptors
β βββ logging/ # Centralized logging service
β βββ middleware/ # HTTP middleware (e.g., request context)
β βββ repositories/ # Repository implementations (e.g., MikroORM)
βββ presentation/ # Presentation layer for controllers and modules
β βββ controllers/ # REST API controllers
βββ app.module.ts # Root module
βββ main.ts # Application entry point
The API uses a centralized error handling system. All exceptions from the domain layer are transformed into HTTP exceptions and logged for observability.
- Domain Exceptions: Exceptions from the domain are mapped to HTTP exceptions using the
DomainToHttpExceptionMapper. - Logging: All exceptions are logged, including their stack trace, status, and response details.
NotFoundExceptionβ404 Not FoundValidationExceptionβ400 Bad Request
Refer to the Error Handling Guide for more details.
- Pull Request Guide: Checklist and best practices for submitting changes.
- Project Structure: Detailed project structure and architecture.
- Swagger Documentation: Configuration and usage of Swagger for API documentation.
- Style Guide: Backend coding conventions.
- CI/CD: Description of pipelines and automation.
- Run Tests: Executes tests on every push to
devandmain. - Validate PR: Validates Pull Requests in
devandmain, including:- Linting (
lint-staged). - Automated tests.
- Linting (
- Release: Creates new releases with Semantic Release.
Semantic Release manages versioning automatically:
- Analyzes commit messages.
- Generates a new version (
major,minor, orpatch). - Updates the changelog and creates a release on GitHub.
The API uses a structured logging system based on Winston. It provides:
- Console Logs: Pretty logs for development with colorized output.
- File Logs: Structured logs for error tracking and auditing.
- Request Tracing: Includes
Request IDandCorrelation IDfor debugging distributed requests.
-
Default log level:
debug. -
Set log level using the environment variable:
LOG_LEVEL=info
For detailed documentation, see the Logging System Guide.
This is a private project. Contributions are managed internally by the team.
- See our Contributing Guide for detailed instructions and guidelines.
This project is private and unlicensed.