Requirements
Requirements
Section titled “Requirements”Purpose
Section titled “Purpose”This page documents what is required to run, develop, and deploy the new motmaina backend as it exists today. The requirements below are based on the current NestJS repository, its Docker workflow, Prisma setup, environment files, and project scripts.
Minimum Development Prerequisites
Section titled “Minimum Development Prerequisites”The repository currently assumes the following tools are available:
- Node.js and npm for local dependency installation, Prisma commands, and direct local execution
- Docker and Docker Compose for the recommended development workflow
- Make for the project shortcuts defined in the root
Makefile - MySQL 8.0 compatible database access
- OpenSSL or the provided certificate-generation container workflow for local HTTPS development
The documented and preferred local path is Docker-based development rather than a pure local Node process.
Application Runtime Requirements
Section titled “Application Runtime Requirements”The backend currently requires:
- a valid
.envfile in the backend root - installed npm dependencies from
package.json - generated Prisma client code
- access to a primary MySQL database
- access to a Prisma shadow database for migration workflows
Without both DATABASE_URL and SHADOW_DATABASE_URL, the local development and migration flow is incomplete.
Core Environment Variables
Section titled “Core Environment Variables”The checked-in environment templates show that the application currently depends on a non-trivial configuration surface. The required areas are:
Application Configuration
Section titled “Application Configuration”NODE_ENVPORTBASE_URLCONTENT_URLAPP_DEFAULT_LANGUAGEAPP_TIMEZONE
These values control runtime mode, exposed HTTP port, cross-service URLs, and locale behavior.
Database Configuration
Section titled “Database Configuration”MYSQL_HOSTMYSQL_PORTMYSQL_DATABASEMYSQL_SHADOW_DATABASEMYSQL_USERMYSQL_PASSWORDDATABASE_URLSHADOW_DATABASE_URL
The backend uses Prisma, so the URL-style connection strings are the real runtime inputs, while the split MySQL variables support local environment composition and Docker setup.
Authentication and Security Configuration
Section titled “Authentication and Security Configuration”JWT_SECRETJWT_EXPIRATIONJWT_REFRESH_EXPIRATIONOTP_EXPIRATION
These are required for authentication flows and token lifecycle behavior.
Integration and Messaging Configuration
Section titled “Integration and Messaging Configuration”- SMTP settings for outbound mail
- Mailhog-compatible local mail settings in development
- Deewan messaging credentials for SMS or WhatsApp style delivery
- Sentry DSN and environment values when observability is enabled
Some of these are optional in local development, but they are part of the expected production-ready configuration surface.
Database and Prisma Requirements
Section titled “Database and Prisma Requirements”The backend data layer is Prisma-first, so the following are required before the API can function reliably:
- the Prisma schema must be in sync with the MySQL schema
npm run generatemust be executed after dependency install and after Prisma schema changes- database migrations must be applied before serving traffic
- optional seeders may be run to populate local reference or test data
The repository scripts currently expose this flow directly:
npm run generatenpm run migratenpm run deploynpm run resetnpm run seednpm run studio
For development, the Makefile wraps part of this process through Docker so the normal path is:
- create
.envfrom.env.development - start containers with
make watchormake up - run
make generate - optionally run
make seed
Recommended Local Development Requirements
Section titled “Recommended Local Development Requirements”The repository strongly favors Docker-based local development. The current compose setup expects these services:
apifor the NestJS applicationdbfor MySQL 8.0proxyfor local HTTP and HTTPS terminationmailhogfor local email inspection
The local stack currently exposes:
https://api.localhostthrough the Nginx proxy- API container port
3000 - MySQL on port
3306 - Mailhog UI on port
8025 - Mailhog SMTP on port
1025
This means a complete local development environment is expected to include not only the API process and database, but also HTTPS termination and email capture.
Certificate and HTTPS Requirements
Section titled “Certificate and HTTPS Requirements”The Docker development flow is built around local HTTPS. The repository includes a make certs helper to generate self-signed certificates for:
api.localhostmailhog.localhost
The certificates must then be trusted by the local operating system if browser-based HTTPS access is expected to work without warnings.
Health and Operational Requirements
Section titled “Health and Operational Requirements”The development stack depends on the backend reporting as healthy. Docker Compose waits for:
- MySQL container health
- API health through
GET /health
This means the health module is not just observability infrastructure; it is part of the runtime readiness contract for local orchestration.
Documentation and Developer Tooling Requirements
Section titled “Documentation and Developer Tooling Requirements”The repository expects modern TypeScript and NestJS developer tooling:
- TypeScript compilation through Nest CLI
- ESLint for linting and lint checks
- Prettier for formatting
- Jest for unit and e2e testing
- Husky for Git hook preparation
These are not strictly required to boot the API, but they are part of the expected contribution workflow.
Testing Requirements
Section titled “Testing Requirements”The backend currently supports:
- unit tests with
npm run test - watch mode with
npm run test:watch - coverage with
npm run test:cov - e2e testing with
npm run test:e2e
The repository also defines coverage thresholds for parts of the auth module, which means backend changes are expected to maintain a measurable testing baseline rather than rely only on manual verification.
Production-Oriented Requirements
Section titled “Production-Oriented Requirements”The production container setup indicates additional expectations beyond local development:
- the backend is built into
dist/ - Prisma client generation happens during image build
- the application is started through PM2 runtime
- migrations should be applied with
npm run deployrather than development migration commands
This suggests the intended production model is:
- immutable application image
- environment-injected configuration
- separately managed MySQL infrastructure
- deployment-time migration execution
Requirement Summary
Section titled “Requirement Summary”To run the new backend successfully today, a team needs:
- Node.js, npm, Docker, Docker Compose, and Make
- MySQL 8.0 and a shadow database for Prisma
- valid environment variables for app, database, auth, and integrations
- Prisma generate and migration steps completed
- optional local HTTPS certificates for the recommended Docker workflow
- operational support for health checks, logging, and external messaging or monitoring integrations
In practical terms, this backend is not a single-process local app. It is a service-oriented NestJS API that already expects containerized development, structured environment management, and database lifecycle discipline.