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
| Folder | Description |
|---|---|
apps/ | Contains all runnable backend services (APIs) |
libs/ | Shared internal libraries and utilities used across backend services |
| Root | Contains the main docker-compose.yml and Docker-related setup files |
.env.example | Starter 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 Name | Purpose |
|---|---|
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:
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 Path | Purpose |
|---|---|
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.ymlfile 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
| File | Description |
|---|---|
.env.example | Sample environment config file; required variables are marked |
install.sh | One-line setup script used for Docker deployment |
nx.json, workspace.json | NX configuration files for workspace structure |
This layout provides a clear, scalable architecture that works seamlessly in both development and production environments.
