How martromeros/r.d.a-server works
Project type and purpose
• This is a monolithic, backend-only REST API server written in TypeScript using Express.
• It uses Prisma as an ORM to manage a relational database, and it includes authentication endpoints plus an email-sending service.
File structure
• Top‐level:
• docker-compose.yml – for bringing up related services (e.g., database)
• prisma/ – holds your schema and migration history
• src/ – all application code
• package.json, tsconfig.json – build and dependency definitions
• Within src/:
• server.ts & app.ts – Express app and HTTP server setup
• routes/ – defines route → controller mappings
• controllers/ – handle HTTP requests/responses
• services/ – business logic, external integrations (e.g., mail)
• models/ – TypeScript interfaces and Prisma model wrappers
Extract README insights
• “npm run dev” spins up ts-node in watch mode
• “npm run build” + “npm start” produce and run compiled JS
• Prisma is initialized and migrations are applied via “npx prisma init”
Main components
a. Clients (e.g., frontends or API consumers)
b. HTTP Server (Express)
c. Routing Layer (src/routes)
d. Controllers (src/controllers/auth.controller.ts, actividad.controller.ts)
e. Service Layer (src/services/authServices.ts, mailServices.ts)
f. ORM Layer (Prisma Client via src/models and schema.prisma)
g. Database (PostgreSQL, MySQL, etc. managed by docker‐compose)
h. External Email Service (SMTP, SendGrid, etc.)
Relationships and data flows
1. Client → HTTP Server (Express)
2. Server → Router (matches URL & HTTP method)
3. Router → Controller
4. Controller → Service (business logic)
5. Service → Prisma Client → Database (CRUD)
6. Service → External Email Service → Mail Provider
7. Service returns result → Controller → HTTP Response → Client
Architectural patterns & design principles
• Layered (Presentation → Controller → Service → Data)
• Single Responsibility per module: controllers only handle web concerns; services only contain business logic
• Prisma provides a clear data‐access abstraction
• Environment isolation via docker‐compose (database container)
Essential details to capture
• The entry point (app.ts → server.ts)
• How routes map to controllers
• How controllers delegate to services
• The singular role of Prisma in data access
• The existence of an external mail subsystem
• The database container managed by docker‐compose