{"id":30810529,"url":"https://github.com/devsafix/ride-booking-system-backend","last_synced_at":"2026-04-13T06:02:42.118Z","repository":{"id":311412471,"uuid":"1028314058","full_name":"devsafix/ride-booking-system-backend","owner":"devsafix","description":"A full-featured ride-booking API developed using the MERN stack (Node.js, Express.js, MongoDB). This project supports multiple user roles (Rider, Driver, Admin) and provides a complete ride lifecycle, secure authentication, and a logical fare calculation system.","archived":false,"fork":false,"pushed_at":"2025-08-24T09:02:18.000Z","size":144,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-24T15:32:47.256Z","etag":null,"topics":["bcryptjs","cookie-parser","cors","dotenv","expressjs","jwt","mongodb","mongoose","nodejs","typescript","vercel-deployment","zod"],"latest_commit_sha":null,"homepage":"https://ride-booking-system-backend-by-safi.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devsafix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-29T10:48:20.000Z","updated_at":"2025-08-24T09:02:21.000Z","dependencies_parsed_at":"2025-08-24T15:32:53.901Z","dependency_job_id":"60e8f9bf-f703-4391-96cc-8e8540f912a0","html_url":"https://github.com/devsafix/ride-booking-system-backend","commit_stats":null,"previous_names":["devsafix/ride-booking-system-backend"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/devsafix/ride-booking-system-backend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsafix%2Fride-booking-system-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsafix%2Fride-booking-system-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsafix%2Fride-booking-system-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsafix%2Fride-booking-system-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devsafix","download_url":"https://codeload.github.com/devsafix/ride-booking-system-backend/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsafix%2Fride-booking-system-backend/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273858876,"owners_count":25180772,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bcryptjs","cookie-parser","cors","dotenv","expressjs","jwt","mongodb","mongoose","nodejs","typescript","vercel-deployment","zod"],"created_at":"2025-09-06T05:14:34.194Z","updated_at":"2026-04-13T06:02:42.053Z","avatar_url":"https://github.com/devsafix.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A Fullstack Ride Management System API (Backend)\n\n## Project Overview\n\nThis is a robust and scalable backend API for a ride-booking service, similar to Uber or Pathao. Built using **Node.js**, **Express.js**, and **Mongoose**, the system manages three distinct user roles: **Rider**, **Driver**, and **Admin**. It features secure authentication, complete ride lifecycle management, and role-based access control.\n\n---\n\n## Live Deployment\n\n- **Frontend:** https://ridaa.vercel.app\n- **Backend:** https://ride-booking-system-backend-by-safi.vercel.app\n- **Frontend Repository:** https://github.com/devsafix/ride-booking-system-client\n\n## Key Features\n\n- **Authentication \u0026 Authorization**\n\n  - Secure JWT-based authentication\n  - Password hashing using bcrypt\n  - Role-based access control middleware\n\n- **Ride Management**\n\n  - Full ride lifecycle management with status transitions:\n    - `requested → accepted → in_transit → completed`\n\n- **Driver Logic**\n\n  - Toggle availability status (Online/Offline)\n  - Accept or reject ride requests\n  - View earnings from completed rides\n\n- **Rider Logic**\n\n  - Request and cancel rides\n  - View ride history\n\n- **Admin Tools**\n\n  - Manage all user accounts\n  - Approve/Suspend drivers\n  - Generate system-wide reports\n\n- **Modular Architecture**\n\n  - Well-structured codebase: `auth`, `user`, `driver`, `ride`, `admin`\n\n- **Fare Calculation**\n  - Logical fare based on real distance using the **Haversine Formula**\n\n---\n\n## Technology Stack\n\n| Category        | Tech               |\n| --------------- | ------------------ |\n| Backend Runtime | Node.js            |\n| Web Framework   | Express.js         |\n| Database        | MongoDB + Mongoose |\n| Authentication  | JWT + bcrypt.js    |\n| Validation      | Zod                |\n\n---\n\n## Project Setup \u0026 Installation\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/devsafix/ride-booking-system-backend\ncd ride-booking-system-backend\n```\n\n### 2. Install Dependencies\n\n```bash\nnpm install\n```\n\n### 3. Configure Environment Variables\n\nCreate a `.env` file in the root directory and add the following:\n\n```env\nPORT=\nDATABASE_URL=\n\nFRONTEND_URL=http://localhost:5173\n\nJWT_ACCESS_SECRET=\nJWT_ACCESS_EXPIRES=\n\nBCRYPT_SALT_ROUND=\n\nADMIN_EMAIL=\nADMIN_PASSWORD=\n```\n\n### 4. Run the Server\n\n```bash\n# For development\nnpm run dev\n\n# For production\nnpm start\n```\n\n---\n\n## API Endpoints Summary\n\n\u003e All endpoints are prefixed with `/api/v1`\n\n---\n\n### Authentication Endpoints (`/api/v1/auth`)\n\n| Method | Endpoint  | Description             | Access |\n| ------ | --------- | ----------------------- | ------ |\n| POST   | /register | Register new user       | Public |\n| POST   | /login    | Login and get JWT token | Public |\n\n---\n\n### Ride Endpoints (`/api/v1/rides`)\n\n| Method | Endpoint     | Description                    | Access |\n| ------ | ------------ | ------------------------------ | ------ |\n| POST   | /request     | Request a new ride             | Rider  |\n| PATCH  | /accept/\\:id | Accept ride request            | Driver |\n| PATCH  | /reject/\\:id | Reject ride request            | Driver |\n| PATCH  | /cancel/\\:id | Cancel a ride                  | Rider  |\n| PATCH  | /status/\\:id | Update ride status             | Driver |\n| GET    | /pending     | View all pending ride requests | Driver |\n| GET    | /my          | View ride history              | Rider  |\n\n---\n\n### Driver Endpoints (`/api/v1/drivers`)\n\n| Method | Endpoint      | Description                    | Access |\n| ------ | ------------- | ------------------------------ | ------ |\n| PATCH  | /availability | Set availability status        | Driver |\n| GET    | /earnings     | View driver's earnings history | Driver |\n\n---\n\n### User Management Endpoints (`/api/v1/users`)\n\n| Method | Endpoint      | Description            | Access |\n| ------ | ------------- | ---------------------- | ------ |\n| GET    | /all-users    | List all users         | Admin  |\n| PATCH  | /block/\\:id   | Block a user           | Admin  |\n| PATCH  | /unblock/\\:id | Unblock a user         | Admin  |\n| PATCH  | /approve/\\:id | Approve driver account | Admin  |\n| PATCH  | /suspend/\\:id | Suspend driver account | Admin  |\n\n---\n\n### Admin Report Endpoints (`/api/v1/admin`)\n\n| Method | Endpoint       | Description                  | Access |\n| ------ | -------------- | ---------------------------- | ------ |\n| GET    | /reports/rides | Generate report of all rides | Admin  |\n\n---\n\n### Admin Report Endpoints (`/api/v1/feedbacks`)\n\n| Method | Endpoint                     | Description                      | Access |\n| ------ | ---------------------------- | -------------------------------- | ------ |\n| POST   | /feedbacks/submit            | Submit feedback                  | Rider  |\n| GET    | /feedbacks/driver/\\:driverId | Get driver ratings and feedbacks | Rider  |\n\n---\n\n## Testing\n\n- You can use tools like **Postman** or **Thunder Client** to test the endpoints.\n- Make sure MongoDB is running locally or use a cloud service like MongoDB Atlas.\n\n---\n\n## Author\n\n**Kawser Ferdous Safi** – [devsafix.vercel.app](https://devsafix.vercel.app)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevsafix%2Fride-booking-system-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevsafix%2Fride-booking-system-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevsafix%2Fride-booking-system-backend/lists"}