A comprehensive electric bike rental platform built with Ballerina microservices architecture and a modern React frontend. The system provides bike sharing capabilities with real-time tracking, payment processing, review management, and notification services.
This project was developed by Team OrByte under the Team-OrByte GitHub Organization. All development activities, including individual service repositories, CI/CD workflows, and deployment pipelines, are maintained within this organization. Each microservice has its own repository with comprehensive documentation, automated builds..
The application follows a microservices architecture with the following components:
- Auth Service: JWT-based authentication and authorization
- User Service: User profile and account management
- Bike Service: Bike fleet management and reservation system
- Ride Service: Ride lifecycle management with real-time tracking
- Payment Service: Stripe integration for payment processing
- Review Service: User review and rating system
- Reward Service: Loyalty program and rewards management
- Notification Service: Real-time notifications and messaging
We utilized Ballerina extensively for microservices orchestration, API integration, cloud-native development, and event-driven architecture to create a seamless, scalable, and maintainable bike rental ecosystem. Ballerina's built-in cloud connectors, type-safe data binding, and native support for distributed systems simplified the complexity of managing inter-service communication, data persistence, and real-time event processing across our entire platform.
Our E-Bike Rental System leverages numerous Ballerina packages to implement comprehensive functionality:
ballerina/http: RESTful API development and HTTP client/server implementationballerina/websocket: Real-time communication for live tracking and notificationsballerina/jwt: JWT token issuance, validation, and authenticationballerina/crypto: Password hashing and cryptographic operationsballerina/log: Structured logging and observabilityballerina/time: Time and date operations for scheduling and timestampsballerina/uuid: Unique identifier generation for entitiesballerina/sql: SQL query building and database operationsballerina/persist: ORM-like data persistence layerballerina/io: Input/output operations and data streaming
ballerinax/kafka: Apache Kafka integration for event-driven architectureballerinax/postgresql: PostgreSQL database connectivity and operationsballerinax/mongodb: MongoDB integration for document storageballerinax/stripe: Stripe payment processing integrationballerinax/persist.sql: SQL persistence layer implementation
- Modern web interface built with Vite and TailwindCSS
- Real-time ride tracking with maps integration
- Admin dashboard for fleet management
- User portal for bike rentals and account management
- API Gateway: Nginx reverse proxy for service routing
- Message Queue: Apache Kafka for event-driven communication
- Databases: PostgreSQL for transactional data, MongoDB for document storage
- Container Orchestration: Docker Compose for local deployment
Before running the application, ensure you have the following installed:
- Docker Engine (v20.0+)
- Docker Compose (v2.0+)
- Node.js (v20.0+)
- Yarn package manager
git clone https://github.com/TheTharz/iwb25-262-orbyte
cd iwb25-262-orbyte-
Create an account at Cloudinary
-
Navigate to your dashboard to get the Cloud Name
-
Create an upload preset:
- Go to Settings → Upload → Upload Presets
- Create a new preset (e.g.,
ebike-image-store) - Set it as an unsigned preset for direct frontend uploads
-
Create environment file for the frontend:
cd e-bike-rental-client
cp env.example .env- Update the
.envfile with your Cloudinary credentials:
VITE_CLOUDINARY_CLOUD_NAME=your-cloud-name
VITE_CLOUDINARY_UPLOAD_PRESET=your-upload-preset- Create a Stripe account and obtain your Secret Key from the dashboard
- Configure the payment service:
cd deployment/payment-service- Update
Config.tomlwith your Stripe secret key:
stripeSecretKey = "sk_test_your_stripe_secret_key_here"cd deployment
docker compose pull
docker compose up -dWait approximately 2-3 minutes for all services to initialize and establish database connections.
cd e-bike-rental-client
yarn install
yarn dev- Frontend: http://localhost:5173
- API Gateway: http://localhost:8080
- Backend Services: Available through API Gateway routes
The system exposes the following API endpoints through the Nginx gateway:
| Service | Route | Internal Port | Description |
|---|---|---|---|
| Auth Service | /auth-api/* |
8080 | Authentication endpoints |
| User Service | /user-api/* |
5000 | User management |
| Bike Service | /bike-api/* |
8090 | Bike fleet operations |
| Ride Service | /ride-api/* |
8082 | Ride management |
| Payment Service | /payment-api/* |
9090 | Payment processing |
| Review Service | /review-api/* |
8090 | Review management |
| Reward Service | /reward-api/* |
9092 | Rewards system |
| Notification Service | /notification-api/* |
8084 | Notifications |
For local development, update the database host configurations in each service's Config.toml:
[service_name.repository]
host = "localhost"
port = 5432Use Stripe CLI to forward webhook events:
stripe listen --forward-to localhost:8080/payment-api/webhook- Deploy services to a publicly accessible server
- Configure webhook endpoint in Stripe Dashboard:
- Go to Developers → Webhooks → Add Endpoint
- URL:
https://yourdomain.com/payment-api/webhook - Events:
checkout.session.completed,payment_intent.payment_failed
The deployment includes the following infrastructure components:
- PostgreSQL: Used by Auth, User, Bike, Ride, and Review services
- MongoDB: Used by Payment, Reward, and Notification services
- Apache Kafka: Handles event-driven communication between services
- Nginx: API Gateway for request routing and CORS handling
- Port Conflicts: Ensure port 8080 is available for the API Gateway
- Database Connection Issues: Wait for database initialization to complete
- Kafka Connection: Verify Kafka is running and accessible to dependent services
- Environment Variables: Ensure all required configuration files are properly set
Monitor service health through Docker logs:
docker compose logs -f [service_name]The system uses Docker volumes for data persistence. To reset the system:
docker compose down -v
docker compose up -d- JWT tokens are used for service-to-service authentication
- All services validate JWT tokens using shared public/private key pairs
- Database credentials are environment-specific and should be secured in production
- API Gateway implements CORS policies for frontend access
- Missing Service Dependencies: Some services may start before their dependencies are ready
- Configuration Management: Environment-specific configurations need proper templating
- Health Check Implementation: Services lack proper health check endpoints for orchestration
- Secret Management: Sensitive credentials are stored in plain text configuration files
- Network Security: Default passwords and open database ports in development configuration
- Implement Kubernetes for better orchestration and scaling
- Use secret management solutions (e.g., HashiCorp Vault, Kubernetes Secrets)
- Add health check endpoints to all services
- Implement service mesh for better traffic management
- Use environment-specific configuration management tools
- Set up monitoring and logging aggregation
- Implement backup and disaster recovery procedures