Server side application for the Rydo platform, a ride-sharing service application. This backend handles authentication, user management, ride requests, and other core functionalities to power the Rydo app.
-
Authentication and Authorization
- User login and signup.
- Secure token-based authentication (access and refresh tokens).
-
User Management
- Manage customer and captain roles.
- Update user profiles.
-
Ride Management
- Create, update, and manage ride requests.
- Track ride statuses.
-
Notifications
- Send ride-related notifications to users.
-
Real-Time Updates
- Live location tracking for captains.
-
Payment Integration
- Seamless payment processing for rides.
Ensure you have the following installed on your system:
- Node.js (>= 16.x)
- npm or yarn
- MongoDB (>= 5.x)
-
Clone the repository:
git clone https://github.com/yourusername/rydo-backend.git cd rydo-backend -
Install dependencies:
npm install # or yarn install -
Set up environment variables: Create a
.envfile in the root directory and add the following variables:PORT=3000 BASE_URL=http://localhost:3000 MONGO_URI=mongodb://localhost:27017/rydo JWT_SECRET=your_jwt_secret JWT_REFRESH_SECRET=your_refresh_secret
-
Start the development server:
npm run dev # or yarn devThe server will run on
http://localhost:3000by default.
-
POST
/auth/signin- Sign in a user.
-
POST
/auth/signup- Sign up a new user.
-
POST
/auth/refresh-token- Refresh access tokens.
-
GET
/user/profile- Fetch user profile details.
-
PUT
/user/profile- Update user profile.
-
POST
/ride/request- Create a new ride request.
-
GET
/ride/status/:rideId- Get the status of a ride.
-
PUT
/ride/update/:rideId- Update ride details.
- POST
/notifications/send- Send a notification to a user.
rydo-backend/
├── src/
│ ├── controllers/
│ ├── models/
│ ├── routes/
│ ├── services/
│ ├── utils/
│ └── app.js
├── .env
├── .gitignore
├── package.json
├── README.md
└── server.js
- controllers/: Handles incoming HTTP requests and executes business logic.
- models/: Defines MongoDB schemas and models.
- routes/: API route definitions.
- services/: Contains reusable services (e.g., authentication, notification).
- utils/: Helper functions and utilities.
- app.js: Main application setup.
- server.js: Entry point for the application.
Run unit and integration tests using:
npm test
# or
yarn testTo deploy the backend, use any cloud provider or containerization platform. Below is an example using Docker:
-
Build the Docker image:
docker build -t rydo-backend . -
Run the Docker container:
docker run -p 3000:3000 --env-file .env rydo-backend
-
Access the backend at
http://localhost:3000.
- Fork the repository.
- Create a feature branch:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add a new feature" - Push the branch:
git push origin feature-name
- Create a pull request.