Skip to content

Requirements

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.

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.

The backend currently requires:

  • a valid .env file 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.

The checked-in environment templates show that the application currently depends on a non-trivial configuration surface. The required areas are:

  • NODE_ENV
  • PORT
  • BASE_URL
  • CONTENT_URL
  • APP_DEFAULT_LANGUAGE
  • APP_TIMEZONE

These values control runtime mode, exposed HTTP port, cross-service URLs, and locale behavior.

  • MYSQL_HOST
  • MYSQL_PORT
  • MYSQL_DATABASE
  • MYSQL_SHADOW_DATABASE
  • MYSQL_USER
  • MYSQL_PASSWORD
  • DATABASE_URL
  • SHADOW_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.

  • JWT_SECRET
  • JWT_EXPIRATION
  • JWT_REFRESH_EXPIRATION
  • OTP_EXPIRATION

These are required for authentication flows and token lifecycle behavior.

  • 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.

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 generate must 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 generate
  • npm run migrate
  • npm run deploy
  • npm run reset
  • npm run seed
  • npm run studio

For development, the Makefile wraps part of this process through Docker so the normal path is:

  1. create .env from .env.development
  2. start containers with make watch or make up
  3. run make generate
  4. optionally run make seed
Section titled “Recommended Local Development Requirements”

The repository strongly favors Docker-based local development. The current compose setup expects these services:

  • api for the NestJS application
  • db for MySQL 8.0
  • proxy for local HTTP and HTTPS termination
  • mailhog for local email inspection

The local stack currently exposes:

  • https://api.localhost through 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.

The Docker development flow is built around local HTTPS. The repository includes a make certs helper to generate self-signed certificates for:

  • api.localhost
  • mailhog.localhost

The certificates must then be trusted by the local operating system if browser-based HTTPS access is expected to work without warnings.

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.

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.

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 deploy rather 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

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.