Skip to content

Folder Structure

Ridy's server-side code is organized as a modular NX monorepo, which simplifies development, sharing, and scaling of services. The structure is designed to support separation of concerns, reuse of shared logic, and clean Docker-based deployment.


🧱 Top-Level Folders

FolderDescription
apps/Contains all runnable backend services (APIs)
libs/Shared internal libraries and utilities used across backend services
RootContains the main docker-compose.yml and Docker-related setup files
.env.exampleStarter environment file with required config variables

🧩 apps/ – API Services

All major backend services live under the apps/ directory. Each service is independently runnable via NX commands and containerized in Docker.

App NamePurpose
rider-api/Handles all customer-facing requests
driver-api/Handles all driver-related operations
admin-api/Backend for the admin panel
payment-gateways/Payment microservice supporting 22 gateways

These apps can be started individually with:

bash
nx serve rider-api
nx serve driver-api
...

🧠 libs/ – Shared Logic & Utilities

The libs/ directory holds shared modules used across the various backend apps, ensuring DRY and consistent development practices.

Library PathPurpose
libs/database/Centralized DB access layer with internal submodules
libs/database/<submodule>/E.g., auth, booking, user, config, etc.

You can import any of these shared modules into the API services to reuse business logic or database access patterns.


🐳 Docker Files

  • The main docker-compose.yml file is located at the project root.
  • It references the apps in apps/ and builds them into Docker services.
  • It also defines containers for:
    • MySQL
    • Redis
    • NGINX

🔐 Other Key Files

FileDescription
.env.exampleSample environment config file; required variables are marked
install.shOne-line setup script used for Docker deployment
nx.json, workspace.jsonNX configuration files for workspace structure

This layout provides a clear, scalable architecture that works seamlessly in both development and production environments.