{"id":21832713,"url":"https://github.com/winterrdog/high-ride-api","last_synced_at":"2026-05-09T01:31:44.295Z","repository":{"id":191355584,"uuid":"682722694","full_name":"winterrdog/high-ride-api","owner":"winterrdog","description":"A simplified ride-sharing backend API developed in NestJS, which includes features like user registration, ride requests, and driver availability management. Something like the Uber trip system","archived":false,"fork":false,"pushed_at":"2023-08-29T05:43:18.000Z","size":343,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T13:54:14.041Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/winterrdog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-24T19:32:00.000Z","updated_at":"2023-11-15T08:09:35.000Z","dependencies_parsed_at":"2023-08-29T13:32:23.489Z","dependency_job_id":"52294f70-f386-476b-acb7-4a2f1556edaa","html_url":"https://github.com/winterrdog/high-ride-api","commit_stats":null,"previous_names":["winterrdog/high-ride-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/winterrdog/high-ride-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winterrdog%2Fhigh-ride-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winterrdog%2Fhigh-ride-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winterrdog%2Fhigh-ride-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winterrdog%2Fhigh-ride-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/winterrdog","download_url":"https://codeload.github.com/winterrdog/high-ride-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winterrdog%2Fhigh-ride-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32804072,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-11-27T19:25:06.268Z","updated_at":"2026-05-09T01:31:44.276Z","avatar_url":"https://github.com/winterrdog.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://github.com/winterrdog/\" target=\"blank\"\u003e\u003cimg src=\"./assets/bike-kick-push-scooter-svgrepo-com.svg\" width=\"200\" alt=\"high-ride Logo\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n  \u003cp align=\"center\"\u003eA simplified ride-sharing backend RESTFUL API developed in NestJS, which includes features like user registration, ride requests, and driver availability management. \u003c/p\u003e\n    \u003cp align=\"center\"\u003e\n\n## Description\n`high-ride-api` is a simplified ride-sharing backend API developed in NestJS, which includes features like user registration, ride requests, and driver availability management. The API is developed using NestJS, a progressive Node.js framework for building efficient, reliable, and scalable server-side applications. It uses `MongoDB` as the database service and is developed using TypeScript. \n\nThe API takes in the data in `JSON` format and returns the data in `JSON` format as well.\n\n## Requirements\n- `NodeJS`( `\u003e= 16.0.0` )\n- `MongoDB`( `\u003e= 4.4.6` )\n- `npm`( `\u003e= 7.10.0` )\n- `Git`( `\u003e= 2.25.1` )\n- `Postman`( `\u003e= 8.10.0` ) or any other API testing tool e.g. `Insomnia`, `HTTPie`( _I used this for testing the API_ ), etc.\n\n## Installation of NodeJS\n- Follow the instructions given [here](https://nodejs.org/en/download) to install NodeJS on your system.\n\n## Installation of MongoDB\n- Follow the instructions given [here](https://www.mongodb.com/docs/manual/administration/install-community/) to install MongoDB on your system.\n\n## Setting up database service\n- Create a `.env` file in the root directory of the project.\n- Copy the contents of `.env.example` to `.env` file.\n- Replace the value of `JWT_SECRET` to a random( _but secure_ ) string of your choice. This will be used to sign the JWT tokens.\n- By default, the database service is configured to run on `mongodb://localhost:27017/high-ride-api` which won't need any authentication. If you want to change the database service URL, replace the value of `DB_URI` in `.env` file.\n- On `Unix`, start the MongoDB service.\n  ```sh\n  sudo systemctl start mongod\n  ```\n- On `Windows`, in order to start the MongoDB service, follow the instructions given [here](https://medium.com/stackfame/run-mongodb-as-a-service-in-windows-b0acd3a4b712) or [here](https://stackoverflow.com/a/37548118/16357751).\n\n## Setting up the project\n- Clone the repository.\n  ```sh\n  git clone https://github.com/winterrdog/high-ride-api.git\n  ```\n- Navigate to the project's root directory.\n  ```sh\n  cd high-ride-api\n  ```\n- Install the dependencies.\n  ```sh\n  $ npm i\n  ```\n\n## Running the app\n- By default, the app is configured to run on `http://localhost:5000`. If you want to change the port, replace the value of `PORT` in your `.env` file.\n\n  ```bash\n  # development mode\n  $ npm start\n\n  # watch mode\n  $ npm run start:dev\n\n  # production mode\n  $ npm run start:prod\n  ```\n\n## Routes and their description\n### User management routes\n- `POST /user/register` - Register a new user. _Accessible to everyone_. Send a `POST` request with the following data in `JSON` format.\n  ```json\n  {\n    \"firstName\": \"John\",\n    \"lastName\": \"Doe\",\n    \"email\": \"johndoe@gmail.com\",\n    \"password\": \"johndoe123\",\n    \"phoneNumber\": \"07000000000\",\n    \"role\": \"passenger\"\n  }\n  ```\n  The `role` field can be either `passenger` or `driver`.\n\n  The server will respond with the registered user and a JWT token. Status code `201` will be returned if the user is successfully registered.\n\n- `GET /user/profile` - Get the profile of the logged-in user. _Only authenticated users can access this route_.\nThe server will return the profile of the logged-in user. Status code `200` will be returned if the user is successfully fetched. For instance:\n  ```json\n  {\n    \"firstName\": \"John\",\n    \"lastName\": \"Doe\",\n    \"email\": \"john23@example.com\",\n    \"phoneNumber\": \"1234567890\",\n    \"role\": \"driver\",\n    \"driverStatus\": \"not applicable\",\n    \"id\": \"64eb94ca0a86e88cd4d80944\",\n    \"dateCreated\": \"2023-08-27T18:24:10.598Z\",\n    \"lastModified\": \"2023-08-27T18:24:10.598Z\"\n  }\n  ```\n- `PATCH /user/profile/driver` - Update the profile of the logged-in user who's a `driver` roles. _Only authenticated `driver` role users can access this route_.\nSend a `PATCH` request with the following data in `JSON` format.\n  ```json\n  {\n    \"driverStatus\": \"available\"\n  }\n  ```\n  The `driverStatus` field can be either `available` or `unavailable`.\n\n  The server will respond with the updated profile of the logged-in user. Status code `200` will be returned if the user is successfully updated. For instance:\n  ```json\n    {\n      \"firstName\": \"John\",\n      \"lastName\": \"Doe\",\n      \"email\": \"john23@example.com\",\n      \"phoneNumber\": \"1234567890\",\n      \"role\": \"driver\",\n      \"driverStatus\": \"available\",\n      \"id\": \"64eb94ca0a86e88cd4d80944\",\n      \"dateCreated\": \"2023-08-27T18:24:10.598Z\",\n      \"lastModified\": \"2023-08-27T18:24:10.598Z\"\n    }\n  ```\n\n### Ride management routes\n- `GET /rides/` - Get the list of all available rides. Only authenticated `driver` role users can access this route. The server will return the list of all available rides. Status code `200` will be returned if the rides are successfully fetched otherwise it'll return a `404`. For instance:\n  ```json\n    [ \n      {\n        \"passenger\": {\n          \"firstName\": \"Lyndon\",\n          \"lastName\": \"Darren\",\n          \"email\": \"lyndon@example.com\",\n          \"phoneNumber\": \"1234567890\",\n          \"role\": \"passenger\",\n          \"driverStatus\": \"not applicable\",\n          \"id\": \"64ec26c23ef09575c4838c64\"\n        },\n        \"driver\": null,\n        \"pickUpLocation\": {\n          \"latitude\": 37.7749,\n          \"longitude\": -122.4194,\n          \"locationName\": \"San Francisco\",\n          \"country\": \"United States\"\n        },\n        \"dropOffLocation\": {\n          \"latitude\": 34.0522,\n          \"longitude\": -118.2437,\n          \"locationName\": \"Los Angeles\",\n          \"country\": \"United States\"\n        },\n        \"rideStatus\": \"accepted\",\n        \"createdAt\": \"2023-08-28T04:50:22.223Z\",\n        \"updatedAt\": \"2023-08-28T09:14:29.816Z\",\n        \"id\": \"64ec278e855903b8781efbc8\"\n      }\n  ]\n  ```\n\n  The driver field will be `null` if the ride is **not** accepted by any driver. Otherwise, it'll contain the driver's profile like in this case:\n  ```json\n    {\n      \"passenger\": {\n        \"firstName\": \"Lyndon\",\n        \"lastName\": \"Darren\",\n        \"email\": \"lyndon@example.com\",\n        \"phoneNumber\": \"1234567890\",\n        \"role\": \"passenger\",\n        \"driverStatus\": \"not applicable\",\n        \"id\": \"64ec26c23ef09575c4838c64\"\n      },\n      \"driver\": {\n        \"firstName\": \"John\",\n        \"lastName\": \"Doe\",\n        \"email\": \"\",\n        \"phoneNumber\": \"1234567890\",\n        \"role\": \"driver\",\n        \"driverStatus\": \"available\",\n        \"id\": \"64ec26c23ef09575c4838c65\"\n      },\n      \"pickUpLocation\": {\n        \"latitude\": 37.7749,\n        \"longitude\": -122.4194,\n        \"locationName\": \"San Francisco\",\n        \"country\": \"United States\"\n      },\n      \"dropOffLocation\": {\n        \"latitude\": 34.0522,\n        \"longitude\": -118.2437,\n        \"locationName\": \"Los Angeles\",\n        \"country\": \"United States\"\n      },\n      \"rideStatus\": \"accepted\",\n      \"createdAt\": \"2023-08-28T04:50:22.223Z\",\n      \"updatedAt\": \"2023-08-28T09:14:29.816Z\",\n      \"id\": \"64ec278e855903b8781efbc8\"\n    }\n  ```\n\n- `POST /rides/` - Create a new ride. Only authenticated `passenger` role users can create a ride. Send a `POST` request with the following data in `JSON` format.\n  ```json\n  {\n    \"pickUpLocation\": {\n      \"latitude\": 37.7749,\n      \"longitude\": -122.4194,\n      \"locationName\": \"San Francisco\",\n      \"country\": \"United States\"\n    },\n    \"dropOffLocation\": {\n      \"latitude\": 34.0522,\n      \"longitude\": -118.2437,\n      \"locationName\": \"Los Angeles\",\n      \"country\": \"United States\"\n    }\n  }\n  ```\n  The server will respond with the created ride. Status code `201` will be returned if the ride is successfully created. For instance:\n  ```json\n    {\n      \"passenger\": {\n        \"firstName\": \"Lyndon\",\n        \"lastName\": \"Darren\",\n        \"email\": \"lyndon@example.com\",\n        \"phoneNumber\": \"1234567890\",\n        \"role\": \"passenger\",\n        \"driverStatus\": \"not applicable\",\n        \"id\": \"64ec26c23ef09575c4838c64\"\n      },\n      \"driver\": null,\n      \"pickUpLocation\": {\n        \"latitude\": 37.7749,\n        \"longitude\": -122.4194,\n        \"locationName\": \"San Francisco\",\n        \"country\": \"United States\"\n      },\n      \"dropOffLocation\": {\n        \"latitude\": 34.0522,\n        \"longitude\": -118.2437,\n        \"locationName\": \"Los Angeles\",\n        \"country\": \"United States\"\n      },\n      \"rideStatus\": \"accepted\",\n      \"createdAt\": \"2023-08-28T04:50:22.223Z\",\n      \"updatedAt\": \"2023-08-28T09:14:29.816Z\",\n      \"id\": \"64ec278e855903b8781efbc8\"\n    }\n  ```\n- `PATCH /rides/:id` - Update a ride's status. Only authenticated users can update a ride's status. Passengers can only mark rides as `cancelled` and drivers can mark rides as `completed`, `accepted`, and `cancelled`. Send a `PATCH` request with the following data in `JSON` format.\n  ```json\n  {\n    \"rideStatus\": \"cancelled\"\n  }\n  ```\n  The `rideStatus` field can be either `cancelled`, `accepted`, or `completed`.\n\n  The server will respond with the updated ride. Status code `200` will be returned if the ride is successfully updated. For instance:\n  ```json\n    {\n      \"passenger\": {\n        \"firstName\": \"Lyndon\",\n        \"lastName\": \"Darren\",\n        \"email\": \"lyndon@example.com\",\n        \"phoneNumber\": \"1234567890\",\n        \"role\": \"passenger\",\n        \"driverStatus\": \"not applicable\",\n        \"id\": \"64ec26c23ef09575c4838c64\"\n      },\n      \"driver\": null,\n      \"pickUpLocation\": {\n        \"latitude\": 37.7749,\n        \"longitude\": -122.4194,\n        \"locationName\": \"San Francisco\",\n        \"country\": \"United States\"\n      },\n      \"dropOffLocation\": {\n        \"latitude\": 34.0522,\n        \"longitude\": -118.2437,\n        \"locationName\": \"Los Angeles\",\n        \"country\": \"United States\"\n      },\n      \"rideStatus\": \"cancelled\",\n      \"createdAt\": \"2023-08-28T04:50:22.223Z\",\n      \"updatedAt\": \"2023-08-28T09:14:29.816Z\",\n      \"id\": \"64ec278e855903b8781efbc8\"\n    }\n  ```\n\n  When the ride's accepted, the driver field will contain the driver's profile like in this case:\n  ```json\n    {\n      \"passenger\": {\n        \"firstName\": \"Lyndon\",\n        \"lastName\": \"Darren\",\n        \"email\": \"lyndon@example.com\",\n        \"phoneNumber\": \"1234567890\",\n        \"role\": \"passenger\",\n        \"driverStatus\": \"not applicable\",\n        \"id\": \"64ec26c23ef09575c4838c64\"\n      },\n      \"driver\": {\n        \"firstName\": \"John\",\n        \"lastName\": \"Doe\",\n        \"email\": \"john23@example.com\",\n        \"phoneNumber\": \"1234567890\",\n        \"role\": \"driver\",\n        \"driverStatus\": \"available\",\n        \"id\": \"64ec26c23ef09575c4838c65\"\n      },\n      \"pickUpLocation\": {\n        \"latitude\": 37.7749,\n        \"longitude\": -122.4194,\n        \"locationName\": \"San Francisco\",\n        \"country\": \"United States\"\n      },\n      \"dropOffLocation\": {\n        \"latitude\": 34.0522,\n        \"longitude\": -118.2437,\n        \"locationName\": \"Los Angeles\",\n        \"country\": \"United States\"\n      },\n      \"rideStatus\": \"accepted\",\n      \"createdAt\": \"2023-08-28T04:50:22.223Z\",\n      \"updatedAt\": \"2023-08-28T09:14:29.816Z\",\n      \"id\": \"64ec278e855903b8781efbc8\"\n    }\n  ```\n  **NOTE**: _A driver can only accept a ride if the driver's status is `available`. If the driver's status is `unavailable`, the server will respond with a `403` status code. A driver can only accept one ride at a time. If the driver tries to accept another ride, the server will respond with a `403` status code_.\n\n  When the ride's _completed_, the driver field will contain the driver's profile like in this case:\n  ```json\n    {\n      \"passenger\": {\n        \"firstName\": \"Lyndon\",\n        \"lastName\": \"Darren\",\n        \"email\": \"lyndon@example.com\",\n        \"phoneNumber\": \"1234567890\",\n        \"role\": \"passenger\",\n        \"driverStatus\": \"not applicable\",\n        \"id\": \"64ec26c23ef09575c4838c64\"\n      },\n      \"driver\": {\n        \"firstName\": \"John\",\n        \"lastName\": \"Doe\",\n        \"email\": \"john23@example.com\",\n        \"phoneNumber\": \"1234567890\",\n        \"role\": \"driver\",\n        \"driverStatus\": \"available\",\n        \"id\": \"64ec26c23ef09575c4838c65\"\n      },\n      \"pickUpLocation\":\n      {\n        \"latitude\": 37.7749,\n        \"longitude\": -122.4194,\n        \"locationName\": \"San Francisco\",\n        \"country\": \"United States\"\n      },\n      \"dropOffLocation\": {\n        \"latitude\": 34.0522,\n        \"longitude\": -118.2437,\n        \"locationName\": \"Los Angeles\",\n        \"country\": \"United States\"\n      },\n      \"rideStatus\": \"completed\",\n      \"createdAt\": \"2023-08-28T04:50:22.223Z\",\n      \"updatedAt\": \"2023-08-28T09:14:29.816Z\",\n      \"id\": \"64ec278e855903b8781efbc8\"\n    }\n  ```\n\n  When the ride's cancelled, the driver field will still be set to `null` like in this case:\n  ```json\n    {\n      \"passenger\": {\n        \"firstName\": \"Lyndon\",\n        \"lastName\": \"Darren\",\n        \"email\": \"lyndon@example.com\",\n        \"phoneNumber\": \"1234567890\",\n        \"role\": \"passenger\",\n        \"driverStatus\": \"not applicable\",\n        \"id\": \"64ec26c23ef09575c4838c64\"\n      },\n      \"driver\": null,\n      \"pickUpLocation\": {\n        \"latitude\": 37.7749,\n        \"longitude\": -122.4194,\n        \"locationName\": \"San Francisco\",\n        \"country\": \"United States\"\n      },\n      \"dropOffLocation\": {\n        \"latitude\": 34.0522,\n        \"longitude\": -118.2437,\n        \"locationName\": \"Los Angeles\",\n        \"country\": \"United States\"\n      },\n      \"rideStatus\": \"cancelled\",\n      \"createdAt\": \"2023-08-28T04:50:22.223Z\",\n      \"updatedAt\": \"2023-08-28T09:14:29.816Z\",\n      \"id\": \"64ec278e855903b8781efbc8\"\n    }\n  ```\n\n**NOTE**: _By default, the database will be **empty**. So you'll need to create a ride first otherwise you'll get `404` error status code with a message `No rides found`_.\n\n## Authentication and Authorization implementation\n- Every JWT token will contain the following fields:\n  ```json\n  {\n    \"sub\": \"64ec26c23ef09575c4838c64\",\n    \"role\": \"passenger\",\n    \"iat\": 1629999999,\n    \"exp\": 1630000000\n  }\n  ```\n  The `sub` field will contain the **user's id**, the `role` field will contain the **user's role**, the `iat` field will contain the _time at which the token was issued_, and the `exp` field will contain the _time at which the token will expire_.\n- The API uses `JWT` for authentication and authorization. The `JWT` tokens are signed using the `JWT_SECRET` value provided in the `.env` file.\n- The API uses `PassportJS` for authentication and authorization. The `PassportJS` strategy used is `JWTStrategy` which is configured in `src/auth/strategies/jwt.strategy.ts` file.\n- I chose to use `JWT` for authentication and authorization because it's stateless and can be used in microservices architecture. It's also scales well in case the API needs to be scaled in the future.\n\n## Testing the app\n```bash\n# run unit tests\n$ npm test\n```\n\n## Author\nwinterrdog - [GitHub](https://github.com/winterrdog)\n\n## License\n\n`high-ride-api` is of [Unlicense](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinterrdog%2Fhigh-ride-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwinterrdog%2Fhigh-ride-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinterrdog%2Fhigh-ride-api/lists"}