Create these files based on the provided .env.example:
- Development Environment (
.env.development) - Test Environment (
.env.test)
- Create the files in your project root:
cp .env.example .env.development
cp .env.example .env.test- Configure each file appropriately:
# Application Settings
PORT=3000
NODE_ENV=development
# Database Configuration
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/driva?schema=public"
# Redis Configuration
REDIS_URL="redis://localhost:6379"
# RabbitMQ Configuration
RABBITMQ_URL="amqp://guest:guest@localhost:5672"
# External API Configuration
EXTERNAL_API_BASE_URL="http://localhost:3001"# Application Settings
PORT=3001
NODE_ENV=test
# Database Configuration - Use a separate test database!
DATABASE_URL="postgresql://postgres:postgres@localhost:5433/driva-test?schema=public"
# Redis Configuration
REDIS_URL="redis://localhost:6380"
# RabbitMQ Configuration
RABBITMQ_URL="amqp://guest:guest@localhost:5673"
# External API Configuration
EXTERNAL_API_BASE_URL="http://localhost:3002"- Docker and Docker Compose installed
- Node.js 20+
- Yarn
-
Clone the repository
git clone [your-repository] cd [project-folder] -
Start containers
docker-compose up -d
-
Install dependencies
yarn install
-
Set up the database (Dev)
yarn prisma:generate:dev yarn prisma:migrate:dev yarn prisma:seed:dev
-
Start the server
yarn start:dev
The server will be available at http://localhost:3000
- Clean Architecture with clear separation between:
- Domain (business rules)
- Application (use cases)
- Infrastructure (concrete implementations)
- NestJS - Node.js Backend framework
- Prisma - ORM for database access
- PostgreSQL - Relational database
- RabbitMQ - For async processing
- Jest - For unit and integration tests
- Repository Pattern for data access
- Command Pattern
- Dependency Injection
- SOLID
yarn test:unityarn test:intyarn test:coverageyarn test:unit:watch # For unit tests
yarn test:int:watch # For integration testsyarn prisma:generate:test
yarn prisma:migrate:test
yarn prisma:seed:testWith more time, we could implement:
- JWT-based authentication
- Role-based access control
- Transaction rollback for failed operations
- Circuit breakers for external service calls
- Retry mechanisms with exponential backoff
- Logging with correlation IDs
- Metrics collection (Prometheus)
- Distributed tracing
- CI/ CD
- GitHub Actions pipeline
- Internationalization (i18n) of error messages
