How frojasdev/taxi24-challenge works
Project type and purpose
• This is a full-stack REST API built with NestJS (TypeScript), Prisma (ORM) and PostgreSQL.
• Its goal is to provide taxi-fleet management: drivers, passengers, trips and invoices.
File structure and layers
• src/presentation
Controllers handle incoming HTTP requests and define Nest modules.
• src/application
Use-case classes implement business operations (find-drivers, trip-management, invoice-management).
• src/domain
Entity definitions and pure domain logic (Driver, Passenger, Trip, Invoice).
• src/infrastructure
PrismaService (database client) and repositories mapping domain entities to persistence.
• src/shared
DTOs, validation, exception filters, response interceptors (cross-cutting concerns).
• prisma
DB schema, migrations, seed script.
• docker-compose.yml
Spins up PostgreSQL in Docker.
• test
End-to-end tests with Jest.
README for insights
• Architecture is layered (presentation → application → domain → infrastructure).
• Uses Nest modules to wire controllers, use cases, repositories, and PrismaService together.
• Exposes endpoints for drivers, passengers, trips, invoices.
• DB migrations & seeding via Prisma.
Main components
a. External clients (Postman, front-end UI or other services)
• Send HTTP requests (REST).
b. API Gateway / NestJS Application
• Presentation Layer: Controller classes grouped in Modules.
• Application Layer: Use-case classes orchestrating operations.
• Domain Layer: Entity models and domain rules.
• Infrastructure Layer:
• PrismaService (wraps Prisma Client)
• Repository classes (DriverRepository, TripRepository, etc.)
c. PostgreSQL Database
• Deployed via Docker Compose.
• Schema defined in prisma/schema.prisma.
d. Development Tools (optional)
• Prisma Studio, migrations, seed scripts.
Relationships and interactions
1. Client → HTTP → NestJS Controller
2. Controller → (injects) → Use Case (application/use-cases)
3. Use Case → Domain Entities / Domain Services (pure logic)
4. Use Case → Repository Interface
5. Repository → PrismaService → PostgreSQL
6. Prisma → returns records → Repository → Use Case → Controller → HTTP Response
7. Shared interceptors & filters sit between controller and response/error pipeline.
Architectural patterns and design principles
• Layered (Onion/Clean) Architecture
• Domain core isolated from infrastructure.
• Application orchestrates domain.
• Presentation merely forwards requests.
• Infrastructure implements repository interfaces.
• Dependency Injection (NestJS modules wiring).
• Separation of Concerns: DTOs vs Entities vs Database schemas.
Technologies, frameworks, libraries
• Runtime & Framework: Node.js, NestJS
• Language: TypeScript
• ORM: Prisma
• Database: PostgreSQL (Docker Compose)
• Testing: Jest
• Validation & Error Handling: class-validator, custom filters/interceptors
• API testing: Postman collection
Essential elements
• All four layers with their main components.
• External client(s) invoking REST endpoints.
• Prisma migrations/seed script as part of Infrastructure or DevOps.
• Cross‐cutting filters/interceptors attached to controller layer.
• Docker Compose node for PostgreSQL.