{"id":23937964,"url":"https://github.com/tanim-mishkat/uber-clone","last_synced_at":"2026-04-13T14:33:03.527Z","repository":{"id":270713022,"uuid":"911227676","full_name":"tanim-mishkat/Uber-Clone","owner":"tanim-mishkat","description":"Full-stack Uber Clone built with React, Node.js, Express, and MongoDB. Features real-time ride tracking with Socket.io, user and captain authentication, fare calculation, OTP verification, and interactive maps.","archived":false,"fork":false,"pushed_at":"2025-10-26T17:12:19.000Z","size":6563,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-16T14:30:27.236Z","etag":null,"topics":["express","fullstack","jwt","mongodb","nodejs","react","rest-api","socketio","uber"],"latest_commit_sha":null,"homepage":"https://uber-41vs.onrender.com/","language":"JavaScript","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/tanim-mishkat.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-02T14:30:34.000Z","updated_at":"2025-10-26T17:12:22.000Z","dependencies_parsed_at":"2025-02-24T03:40:28.628Z","dependency_job_id":"88d2d273-d3c3-4393-8a73-0fe6c846e6ff","html_url":"https://github.com/tanim-mishkat/Uber-Clone","commit_stats":null,"previous_names":["tanim-mishkat/uber-clone"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tanim-mishkat/Uber-Clone","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanim-mishkat%2FUber-Clone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanim-mishkat%2FUber-Clone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanim-mishkat%2FUber-Clone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanim-mishkat%2FUber-Clone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tanim-mishkat","download_url":"https://codeload.github.com/tanim-mishkat/Uber-Clone/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanim-mishkat%2FUber-Clone/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31757477,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T13:27:56.013Z","status":"ssl_error","status_checked_at":"2026-04-13T13:21:23.512Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["express","fullstack","jwt","mongodb","nodejs","react","rest-api","socketio","uber"],"created_at":"2025-01-06T02:17:06.252Z","updated_at":"2026-04-13T14:33:03.517Z","avatar_url":"https://github.com/tanim-mishkat.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Uber Clone Backend API Documentation\n\n## Table of Contents\n\n1. [Project Overview](#project-overview)\n2. [Getting Started](#getting-started)\n3. [Environment Variables](#environment-variables)\n4. [API Endpoints](#api-endpoints)\n   - [User Endpoints](#user-endpoints)\n   - [Captain Endpoints](#captain-endpoints)\n   - [Ride Endpoints](#ride-endpoints)\n   - [Maps Endpoints](#maps-endpoints)\n5. [WebSocket Events](#websocket-events)\n6. [Database Models](#database-models)\n7. [Authentication](#authentication)\n8. [Error Handling](#error-handling)\n9. [Project Structure](#project-structure)\n\n## Project Overview\n\nThis is a complete Uber-like ride-sharing application with both backend API and frontend client. The backend is built with Node.js, Express, MongoDB, and Socket.io, while the frontend uses React with Vite, Tailwind CSS, and Leaflet for maps.\n\n**[Demo video](https://youtu.be/XDW9JwIUwmc?si=1Cib6QIXHYRS2dmH)**\n**[Live Site](https://uber-41vs.onrender.com/)**\n\n### Features\n\n- **User \u0026 Captain Authentication**: JWT-based authentication with token blacklisting\n- **Real-time Communication**: Socket.io for live ride tracking and updates\n- **Map Services**: Integration with OpenStreetMap and OSRM for geocoding and routing\n- **Ride Management**: Complete ride lifecycle from booking to completion\n- **Fare Calculation**: Dynamic fare calculation based on distance and vehicle type\n- **Location Services**: Real-time captain location tracking\n- **OTP Verification**: Secure ride start with OTP validation\n\n### Tech Stack\n\n#### Backend\n\n- **Runtime**: Node.js\n- **Framework**: Express.js\n- **Database**: MongoDB with Mongoose\n- **Authentication**: JWT (JSON Web Tokens)\n- **Real-time**: Socket.io\n- **Validation**: Express-validator\n- **Maps**: OpenStreetMap, OSRM, Photon API\n\n#### Frontend\n\n- **Framework**: React 18 with Vite\n- **Styling**: Tailwind CSS\n- **Maps**: Leaflet with React-Leaflet\n- **HTTP Client**: Axios\n- **Real-time**: Socket.io-client\n- **Routing**: React Router DOM\n- **Animations**: GSAP\n\n## Getting Started\n\n### Prerequisites\n\n- Node.js (v14 or higher)\n- MongoDB (local or cloud instance)\n- npm or yarn package manager\n\n### Installation\n\n#### Backend Setup\n\n1. Navigate to the backend directory:\n\n```bash\ncd Backend\n```\n\n2. Install dependencies:\n\n```bash\nnpm install\n```\n\n3. Set up environment variables (see [Environment Variables](#environment-variables) section)\n\n4. Start the development server:\n\n```bash\nnpm start\n```\n\nThe backend server will start on port 3000 by default.\n\n#### Frontend Setup\n\n1. Navigate to the frontend directory:\n\n```bash\ncd Frontend\n```\n\n2. Install dependencies:\n\n```bash\nnpm install\n```\n\n3. Start the development server:\n\n```bash\nnpm run dev\n```\n\nThe frontend will start on port 5173 by default.\n\n### Available Scripts\n\n#### Backend\n\n- `npm start` - Start the development server\n- `npm test` - Run tests (not configured yet)\n\n#### Frontend\n\n- `npm run dev` - Start development server\n- `npm run build` - Build for production\n- `npm run preview` - Preview production build\n- `npm run lint` - Run ESLint\n\n## Environment Variables\n\nCreate a `.env` file in the Backend directory with the following variables:\n\n```env\n# Server Configuration\nPORT=3000\n\n# Database Configuration\nDB_CONNECT=mongodb://localhost:27017/uber-clone\n\n# JWT Configuration\nJWT_SECRET=your-super-secret-jwt-key\nJWT_EXPIRES_IN=24h\n\n# Optional: Production Configuration\nNODE_ENV=development\n```\n\n## API Endpoints\n\n### Base URL\n\nAll API endpoints are prefixed with the base URL:\n\n```\nhttp://localhost:3000\n```\n\n### Authentication\n\nMost endpoints require authentication. Include the JWT token in the Authorization header:\n\n```\nAuthorization: Bearer \u003cyour-jwt-token\u003e\n```\n\n---\n\n## User Endpoints\n\n### Register User\n\n**Endpoint**: `POST /users/register`\n\n**Description**: Register a new user account.\n\n**Request Body**:\n\n```json\n{\n  \"fullname\": {\n    \"firstname\": \"John\",\n    \"lastname\": \"Doe\"\n  },\n  \"email\": \"john.doe@example.com\",\n  \"password\": \"password123\"\n}\n```\n\n**Response**:\n\n```json\n{\n  \"user\": {\n    \"fullname\": {\n      \"firstname\": \"John\",\n      \"lastname\": \"Doe\"\n    },\n    \"email\": \"john.doe@example.com\",\n    \"_id\": \"64a1e7fd2d51a24b8c3f\",\n    \"socketId\": null\n  },\n  \"token\": \"\u003cJWT_AUTH_TOKEN\u003e\"\n}\n```\n\n### Login User\n\n**Endpoint**: `POST /users/login`\n\n**Description**: Authenticate a user and get access token.\n\n**Request Body**:\n\n```json\n{\n  \"email\": \"john.doe@example.com\",\n  \"password\": \"password123\"\n}\n```\n\n**Response**: Same as register response with cookie set.\n\n### Get User Profile\n\n**Endpoint**: `GET /users/profile`\n\n**Description**: Get authenticated user's profile information.\n\n**Headers**: `Authorization: Bearer \u003ctoken\u003e`\n\n**Response**:\n\n```json\n{\n  \"fullname\": {\n    \"firstname\": \"John\",\n    \"lastname\": \"Doe\"\n  },\n  \"email\": \"john.doe@example.com\",\n  \"_id\": \"64a1e7fd2d51a24b8c3f\",\n  \"socketId\": \"socket_id_here\"\n}\n```\n\n### Logout User\n\n**Endpoint**: `GET /users/logout`\n\n**Description**: Logout user and invalidate token.\n\n**Headers**: `Authorization: Bearer \u003ctoken\u003e`\n\n**Response**:\n\n```json\n{\n  \"message\": \"Logged out successfully\"\n}\n```\n\n---\n\n## Captain Endpoints\n\n### Register Captain\n\n**Endpoint**: `POST /captains/register`\n\n**Description**: Register a new captain with vehicle information.\n\n**Request Body**:\n\n```json\n{\n  \"fullname\": {\n    \"firstname\": \"Jane\",\n    \"lastname\": \"Doe\"\n  },\n  \"email\": \"jane.doe@example.com\",\n  \"password\": \"securepassword\",\n  \"vehicle\": {\n    \"color\": \"Red\",\n    \"plate\": \"ABC-123\",\n    \"capacity\": 4,\n    \"vehicleType\": \"car\"\n  }\n}\n```\n\n**Response**:\n\n```json\n{\n  \"captain\": {\n    \"fullname\": {\n      \"firstname\": \"Jane\",\n      \"lastname\": \"Doe\"\n    },\n    \"email\": \"jane.doe@example.com\",\n    \"vehicle\": {\n      \"color\": \"Red\",\n      \"plate\": \"ABC-123\",\n      \"capacity\": 4,\n      \"vehicleType\": \"car\"\n    },\n    \"_id\": \"64a1e7fd2d51a24b8c3f\",\n    \"socketId\": null,\n    \"status\": \"inactive\",\n    \"location\": {\n      \"type\": \"Point\",\n      \"coordinates\": [0, 0]\n    }\n  },\n  \"token\": \"\u003cJWT_AUTH_TOKEN\u003e\"\n}\n```\n\n### Login Captain\n\n**Endpoint**: `POST /captains/login`\n\n**Description**: Authenticate a captain and get access token.\n\n**Request Body**:\n\n```json\n{\n  \"email\": \"jane.doe@example.com\",\n  \"password\": \"securepassword\"\n}\n```\n\n**Response**: Same as register response with cookie set.\n\n### Get Captain Profile\n\n**Endpoint**: `GET /captains/profile`\n\n**Description**: Get authenticated captain's profile information.\n\n**Headers**: `Authorization: Bearer \u003ctoken\u003e`\n\n**Response**: Same as captain register response.\n\n### Logout Captain\n\n**Endpoint**: `GET /captains/logout`\n\n**Description**: Logout captain and invalidate token.\n\n**Headers**: `Authorization: Bearer \u003ctoken\u003e`\n\n**Response**:\n\n```json\n{\n  \"message\": \"Logged out successfully\"\n}\n```\n\n---\n\n## Ride Endpoints\n\n### Create Ride\n\n**Endpoint**: `POST /rides/create`\n\n**Description**: Create a new ride request.\n\n**Headers**: `Authorization: Bearer \u003ctoken\u003e`\n\n**Request Body**:\n\n```json\n{\n  \"pickup\": \"24B/AA-11, Dhaka\",\n  \"destination\": \"Sylhet Stadium, Sylhet\",\n  \"vehicleType\": \"car\"\n}\n```\n\n**Response**:\n\n```json\n{\n  \"_id\": \"64a1e7fd2d51a24b8c3f\",\n  \"user\": \"64a1e7fd2d51a24b8c3f\",\n  \"pickup\": \"24B/AA-11, Dhaka\",\n  \"destination\": \"Sylhet Stadium, Sylhet\",\n  \"vehicleType\": \"car\",\n  \"status\": \"pending\",\n  \"fare\": 120,\n  \"otp\": \"123456\",\n  \"createdAt\": \"2024-01-01T00:00:00.000Z\"\n}\n```\n\n### Get Fare\n\n**Endpoint**: `GET /rides/get-fare`\n\n**Description**: Calculate fare for a ride based on pickup and destination.\n\n**Headers**: `Authorization: Bearer \u003ctoken\u003e`\n\n**Query Parameters**:\n\n- `pickup` (required): Pickup location address\n- `destination` (required): Destination location address\n\n**Response**:\n\n```json\n{\n  \"car\": 120,\n  \"cng\": 50,\n  \"motorcycle\": 30\n}\n```\n\n### Confirm Ride\n\n**Endpoint**: `POST /rides/confirm`\n\n**Description**: Captain confirms a ride request.\n\n**Headers**: `Authorization: Bearer \u003ctoken\u003e`\n\n**Request Body**:\n\n```json\n{\n  \"rideId\": \"64a1e7fd2d51a24b8c3f\",\n  \"captainId\": \"64a1e7fd2d51a24b8c3f\"\n}\n```\n\n**Response**:\n\n```json\n{\n  \"_id\": \"64a1e7fd2d51a24b8c3f\",\n  \"user\": {\n    \"fullname\": {\n      \"firstname\": \"John\",\n      \"lastname\": \"Doe\"\n    },\n    \"email\": \"john.doe@example.com\",\n    \"_id\": \"64a1e7fd2d51a24b8c3f\",\n    \"socketId\": \"socket_id_here\"\n  },\n  \"captain\": {\n    \"fullname\": {\n      \"firstname\": \"Jane\",\n      \"lastname\": \"Doe\"\n    },\n    \"_id\": \"64a1e7fd2d51a24b8c3f\"\n  },\n  \"status\": \"accepted\",\n  \"otp\": \"123456\"\n}\n```\n\n### Start Ride\n\n**Endpoint**: `GET /rides/start-ride`\n\n**Description**: Captain starts the ride with OTP verification.\n\n**Headers**: `Authorization: Bearer \u003ctoken\u003e`\n\n**Query Parameters**:\n\n- `rideId` (required): Ride ID\n- `otp` (required): 6-digit OTP\n\n**Response**:\n\n```json\n{\n  \"_id\": \"64a1e7fd2d51a24b8c3f\",\n  \"status\": \"ongoing\",\n  \"user\": {\n    \"socketId\": \"socket_id_here\"\n  }\n}\n```\n\n### End Ride\n\n**Endpoint**: `POST /rides/end-ride`\n\n**Description**: Captain ends the ride.\n\n**Headers**: `Authorization: Bearer \u003ctoken\u003e`\n\n**Request Body**:\n\n```json\n{\n  \"rideId\": \"64a1e7fd2d51a24b8c3f\"\n}\n```\n\n**Response**:\n\n```json\n{\n  \"_id\": \"64a1e7fd2d51a24b8c3f\",\n  \"status\": \"completed\",\n  \"user\": {\n    \"socketId\": \"socket_id_here\"\n  }\n}\n```\n\n---\n\n## Maps Endpoints\n\n### Get Coordinates\n\n**Endpoint**: `GET /maps/get-coordinates`\n\n**Description**: Get coordinates for an address using OpenStreetMap.\n\n**Headers**: `Authorization: Bearer \u003ctoken\u003e`\n\n**Query Parameters**:\n\n- `address` (required): Address to get coordinates for\n\n**Response**:\n\n```json\n{\n  \"lat\": 23.8103,\n  \"lon\": 90.4125\n}\n```\n\n### Get Distance and Time\n\n**Endpoint**: `GET /maps/get-distance-time`\n\n**Description**: Get distance and travel time between two locations using OSRM.\n\n**Headers**: `Authorization: Bearer \u003ctoken\u003e`\n\n**Query Parameters**:\n\n- `origin` (required): Origin address\n- `destination` (required): Destination address\n\n**Response**:\n\n```json\n{\n  \"distance\": {\n    \"text\": \"15.2 km\",\n    \"value\": 15200\n  },\n  \"duration\": {\n    \"text\": \"25 mins\",\n    \"value\": 1500\n  }\n}\n```\n\n### Get Address Suggestions\n\n**Endpoint**: `GET /maps/get-suggestions`\n\n**Description**: Get address suggestions based on user input using Photon API.\n\n**Headers**: `Authorization: Bearer \u003ctoken\u003e`\n\n**Query Parameters**:\n\n- `input` (required): User input for address search\n\n**Response**:\n\n```json\n[\n  {\n    \"name\": \"Dhaka\",\n    \"city\": \"Dhaka\",\n    \"country\": \"Bangladesh\",\n    \"lat\": 23.8103,\n    \"lon\": 90.4125,\n    \"display_name\": \"Dhaka, Dhaka, Bangladesh\",\n    \"placeId\": \"123456\"\n  }\n]\n```\n\n---\n\n## WebSocket Events\n\nThe application uses Socket.io for real-time communication. Connect to the WebSocket server at the same port as the HTTP server.\n\n### Connection\n\n```javascript\nconst socket = io(\"http://localhost:3000\");\n```\n\n### Events\n\n#### User Join\n\n- `join` - User joins with userId and userType\n\n```javascript\nsocket.emit(\"join\", { userId: \"user_id\", userType: \"user\" });\n```\n\n#### Captain Join\n\n- `join` - Captain joins with userId and userType\n\n```javascript\nsocket.emit(\"join\", { userId: \"captain_id\", userType: \"captain\" });\n```\n\n#### Location Updates\n\n- `update-location-captain` - Captain updates their location\n\n```javascript\nsocket.emit(\"update-location-captain\", {\n  userId: \"captain_id\",\n  location: { lat: 23.8103, lon: 90.4125 },\n});\n```\n\n#### Ride Events\n\n- `new-ride` - New ride request sent to nearby captains\n- `ride-confirmed` - Ride confirmed by captain\n- `ride-started` - Ride started with OTP verification\n- `ride-ended` - Ride completed\n\n### Example Usage\n\n```javascript\n// Connect to socket\nconst socket = io(\"http://localhost:3000\");\n\n// User joins\nsocket.emit(\"join\", { userId: \"user_id\", userType: \"user\" });\n\n// Captain joins\nsocket.emit(\"join\", { userId: \"captain_id\", userType: \"captain\" });\n\n// Captain updates location\nsocket.emit(\"update-location-captain\", {\n  userId: \"captain_id\",\n  location: { lat: 23.8103, lon: 90.4125 },\n});\n\n// Listen for new ride requests (captains only)\nsocket.on(\"new-ride\", (rideData) =\u003e {\n  console.log(\"New ride request:\", rideData);\n});\n\n// Listen for ride updates\nsocket.on(\"ride-confirmed\", (data) =\u003e {\n  console.log(\"Ride confirmed:\", data);\n});\n```\n\n---\n\n## Database Models\n\n### User Model\n\n```javascript\n{\n  fullname: {\n    firstname: String, // required, min 3 chars\n    lastname: String   // optional, min 3 chars\n  },\n  email: String,       // required, unique, min 5 chars\n  password: String,    // required, hashed, select: false\n  socketId: String,    // for real-time communication\n  createdAt: Date,     // auto-generated\n  updatedAt: Date      // auto-generated\n}\n```\n\n### Captain Model\n\n```javascript\n{\n  fullname: {\n    firstname: String, // required, min 3 chars\n    lastname: String   // optional, min 3 chars\n  },\n  email: String,       // required, unique, min 5 chars\n  password: String,    // required, hashed, select: false\n  socketId: String,    // for real-time communication\n  status: String,      // enum: ['active', 'inactive'], default: 'inactive'\n  vehicle: {\n    color: String,     // required, min 3 chars\n    plate: String,     // required, min 3 chars\n    capacity: Number,  // required, min 1\n    vehicleType: String // enum: ['car', 'cng', 'motorcycle']\n  },\n  location: {\n    type: String,      // enum: ['Point'], default: 'Point'\n    coordinates: [Number] // [longitude, latitude], default: [0, 0]\n  },\n  createdAt: Date,     // auto-generated\n  updatedAt: Date      // auto-generated\n}\n```\n\n### Ride Model\n\n```javascript\n{\n  user: ObjectId,      // ref: 'user', required\n  captain: ObjectId,   // ref: 'captain', optional\n  pickup: String,      // required\n  destination: String, // required\n  vehicleType: String, // car, cng, motorcycle\n  fare: Number,        // required\n  status: String,      // enum: ['pending', 'accepted', 'ongoing', 'completed', 'cancelled']\n  duration: Number,    // in seconds\n  distance: Number,    // in meters\n  paymentId: String,   // optional\n  orderId: String,     // optional\n  signature: String,   // optional\n  otp: String,         // required, select: false\n  createdAt: Date,     // auto-generated\n  updatedAt: Date      // auto-generated\n}\n```\n\n### BlacklistToken Model\n\n```javascript\n{\n  token: String,       // required, unique\n  createdAt: Date      // auto-generated, expires: 24h\n}\n```\n\n---\n\n## Authentication\n\nThe API uses JWT (JSON Web Tokens) for authentication.\n\n### Token Structure\n\n- **Algorithm**: HS256\n- **Expiration**: 24 hours (configurable)\n- **Secret**: Environment variable `JWT_SECRET`\n- **Payload**: `{ _id: user/captain_id }`\n\n### Token Usage\n\nInclude the token in the Authorization header:\n\n```\nAuthorization: Bearer \u003cyour-jwt-token\u003e\n```\n\nOr use cookies (automatically set on login):\n\n```\nCookie: token=\u003cyour-jwt-token\u003e\n```\n\n### Token Blacklisting\n\nWhen users logout, their tokens are blacklisted to prevent reuse. Blacklisted tokens expire after 24 hours.\n\n### Middleware\n\n- `authUser` - Authenticates regular users\n- `authCaptain` - Authenticates captains\n\n---\n\n## Error Handling\n\n### Standard Error Responses\n\n#### 400 Bad Request (Validation Errors)\n\n```json\n{\n  \"errors\": [\n    {\n      \"msg\": \"First name must be at least 3 characters long\",\n      \"param\": \"fullname.firstname\",\n      \"location\": \"body\"\n    }\n  ]\n}\n```\n\n#### 401 Unauthorized\n\n```json\n{\n  \"error\": \"Unauthorized\"\n}\n```\n\n#### 404 Not Found\n\n```json\n{\n  \"message\": \"Coordinates not found\"\n}\n```\n\n#### 500 Internal Server Error\n\n```json\n{\n  \"message\": \"Failed to create ride\",\n  \"error\": \"Error details\"\n}\n```\n\n### Validation Rules\n\n- **Email**: Must be valid format, minimum 5 characters\n- **Password**: Minimum 6 characters\n- **Names**: Minimum 3 characters\n- **Vehicle Types**: Must be one of `car`, `cng`, `motorcycle`\n- **Vehicle Capacity**: Minimum 1 person\n- **Required Fields**: Must be present and not empty\n\n---\n\n## Project Structure\n\n```\nUber Clone/\n├── Backend/\n│   ├── db/\n│   │   ├── controllers/\n│   │   │   ├── user.controller.js\n│   │   │   ├── captain.controller.js\n│   │   │   ├── ride.controller.js\n│   │   │   └── maps.controller.js\n│   │   └── db.js\n│   ├── models/\n│   │   ├── user.model.js\n│   │   ├── captain.model.js\n│   │   ├── ride.model.js\n│   │   └── blacklistToken.model.js\n│   ├── services/\n│   │   ├── user.service.js\n│   │   ├── captain.service.js\n│   │   ├── ride.service.js\n│   │   └── maps.service.js\n│   ├── routes/\n│   │   ├── user.routes.js\n│   │   ├── captain.routes.js\n│   │   ├── ride.routes.js\n│   │   └── maps.routes.js\n│   ├── middlewares/\n│   │   └── auth.middleware.js\n│   ├── app.js\n│   ├── server.js\n│   ├── socket.js\n│   ├── package.json\n│   └── readme.md\n└── Frontend/\n    ├── src/\n    │   ├── components/\n    │   ├── pages/\n    │   ├── context/\n    │   ├── assets/\n    │   ├── App.jsx\n    │   └── main.jsx\n    ├── public/\n    ├── package.json\n    └── README.md\n```\n\n---\n\n## Key Features Implementation\n\n### Real-time Location Tracking\n\n- Captains update their location via WebSocket\n- Location stored as GeoJSON Point in MongoDB\n- Geospatial queries for finding nearby captains\n\n### Fare Calculation\n\n- Uses OpenStreetMap for geocoding\n- OSRM for route calculation\n- Dynamic pricing based on distance and vehicle type\n\n### OTP System\n\n- 6-digit OTP generated for each ride\n- Required for ride start verification\n- Cryptographically secure random generation\n\n### Socket.io Integration\n\n- Real-time ride updates\n- Location broadcasting\n- User and captain presence tracking\n\n---\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests if applicable\n5. Submit a pull request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanim-mishkat%2Fuber-clone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftanim-mishkat%2Fuber-clone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanim-mishkat%2Fuber-clone/lists"}