Decentralized Ride-Booking leveraging Kaspa
Official Demo • Features • Getting Started • Contribute • License • Donate
Welcome to KaspaTaxi!
KaspaTaxi is an open-source project demonstrating a decentralized, transparent, and community-driven approach to ride-booking. Our vision is to empower independent taxi drivers and provide riders with a secure and direct way to connect and transact using the speed and efficiency of the Kaspa blockchain, ultimately aiming to reduce costs by eliminating intermediaries.
KaspaTaxi offers two deployment approaches to suit different needs:
- Branch:
main - Description: Simpler setup with all functionality in the client
- Best for: Quick demos, learning, and development
- Security note: API keys are stored in client-side code (not recommended for production)
- Branch:
server - Description: Secure architecture with server-side API handling
- Best for: Production deployments and public-facing applications
- Security benefits: API keys are protected on the server side
- For learning and development: The client-only approach (main branch) is simpler to set up and understand
- For production use: The secure server approach (server branch) follows best practices for security
- For contributing: Please follow the secure approach for any production-ready contributions
Experience the current KaspaTaxi MVP in action: kaspataxi.KASperience.xyz
Note: The MVP focuses on demonstrating the core user interface, ride flow, and direct Kaspa payment initiation. Deeper blockchain integration and backend automation are planned for future phases.
- Decentralization & Transparency: We aim to build a system where control rests more with drivers and riders, not a central platform. Kaspa's blockDAG structure offers transparency, and our open-source code allows community auditing.
- Direct & Efficient Payments: By facilitating direct Kaspa payments between rider and driver, we aim to eliminate platform commissions. Kaspa's potential for fast transaction confirmations and low fees makes it ideal for near real-time settlement.
- Community-Driven Development: We believe the platform should be built by and for its users. Open-source development encourages contribution and customization.
- Driver Empowerment: Provide drivers with tools to manage their service independently, connect directly with riders, and potentially build their reputation on-chain in the future.
- User Authentication: Secure login using Google Authentication (centralized for ease of onboarding in the MVP). In the future, we plan to investigate decentralized identity solutions for user authentication.
- Map Integration: Uses OpenStreetMap for visualizing locations and potential routes.
- Ride Request: Riders can specify pickup and drop-off points to simulate a ride request.
- Driver View: Drivers can see simulated nearby ride requests and accept/reject them.
- Basic Real-Time Updates: Riders and drivers see basic status changes for the simulated ride flow (using Firebase Realtime Database or Firestore).
- Direct Kaspa Payment Initiation: Upon ride completion (simulated), the app generates a QR code with the driver's Kaspa address and the fare, enabling direct peer-to-peer payment outside the app. (Note: Transaction confirmation is not yet integrated within the app).
- Mobile-First Design: Responsive layout for use on various devices.
- Customizable Brand: Easily modify the logo and theme for individual driver branding.
- Firebase Backend (MVP): Utilizes Firebase for authentication, real-time data synchronization (ride status), and hosting.
- Automated Ride Matching: Implement backend logic (likely via Firebase Cloud Functions) for efficient driver assignment.
- On-Chain Transaction Verification: Integrate Kaspa node interaction (via backend) to confirm payments directly within the app.
- Driver Registration & Verification: Develop a secure process for driver onboarding, potentially involving smart contracts in later phases.
- Reputation System: Explore building an on-chain or decentralized reputation system for drivers and riders.
- In-App Communication: Add chat functionality between rider and driver.
- Fare Calculation: Implement more dynamic fare calculation based on distance, time, etc.
- Frontend: React (with TypeScript), Tailwind CSS, Vite
- Mapping: OpenStreetMap (likely via libraries like Leaflet or MapLibre GL JS)
- Backend (MVP): Firebase (Authentication, Firestore/Realtime Database)
- Blockchain (Payment): Kaspa (Direct peer-to-peer via QR code)
- Future Backend: Firebase Cloud Functions, Kaspa Node Interaction
- MVP: Kaspa is used for the payment settlement layer. The app facilitates the initiation of a direct peer-to-peer Kaspa payment by generating a QR code containing the driver's address and agreed fare. The actual transaction occurs outside the app using the users' wallets.
- Future: We plan to integrate Kaspa more deeply for:
- Payment Verification: Confirming transaction success on the blockchain via backend services.
- Data Integrity: Potentially storing ride hashes or reputation data on-chain.
- Smart Contracts: Exploring contracts for driver registration or dispute resolution.
- Node.js (v18 or higher)
- NPM or Yarn
- Firebase Account (for development/deployment)
- Kaspa Wallet (for testing payments)
- Firebase Studio or IDE
-
Clone the Repository:
git clone https://github.com/YOUR-USERNAME/KaspaTaxi.git cd KaspaTaxi # Clone from main branch (default)
-
Install Dependencies:
npm install
-
Firebase Setup:
- Create a Firebase project
- Enable Firestore and Authentication (Google provider)
- Set up Firestore security rules (see Security Considerations section)
-
Environment Configuration:
- Create a
.envfile in the project root with the following variables:
VITE_FIREBASE_API_KEY=your_firebase_api_key VITE_FIREBASE_AUTH_DOMAIN=your_firebase_auth_domain VITE_FIREBASE_PROJECT_ID=your_firebase_project_id VITE_FIREBASE_STORAGE_BUCKET=your_firebase_storage_bucket VITE_FIREBASE_MESSAGING_SENDER_ID=your_firebase_messaging_sender_id VITE_FIREBASE_APP_ID=your_firebase_app_id VITE_MAPTILER_API_KEY=your_maptiler_api_key - Create a
-
Start the Development Server:
npm run dev
-
Clone the Repository:
git clone https://github.com/YOUR-USERNAME/KaspaTaxi.git cd KaspaTaxi # Switch to the server branch git checkout server
-
Install Client Dependencies:
npm install
-
Set up Client Environment Variables:
- Create a
.envfile in the project root with the following variables:
VITE_FIREBASE_API_KEY=api_key_for_firebase_auth VITE_FIREBASE_AUTH_DOMAIN=auth_domain_for_firebase VITE_FIREBASE_PROJECT_ID=project_id_for_firebase VITE_FIREBASE_DATABASE_URL=database_url_for_firebase # Most Firebase configuration has been moved to the server # See server/.env for API keys and configuration # The MapTiler API key has been moved to the server - Create a
-
Set up Server:
## Navigate to the server directory cd server # Install server dependencies npm install # Create .env file with API keys # Example content: PORT=3001 MAPTILER_API_KEY=maptiler_key_for_mapping FIREBASE_API_KEY=api_key_for_firebase_server FIREBASE_AUTH_DOMAIN=auth_domain_for_firebase_server FIREBASE_DATABASE_URL=database_url_for_firebase_server FIREBASE_PROJECT_ID=project_id_for_firebase_server FIREBASE_STORAGE_BUCKET=storage_bucket_for_firebase FIREBASE_MESSAGING_SENDER_ID=messaging_sender_id_for_firebase FIREBASE_APP_ID=app_id_for_firebase FIREBASE_MEASUREMENT_ID=measurement_id_for_firebase # Return to the main directory cd ..
-
Start Both Client and Server:
# Run both client and server npm run dev:all # Or run just the client (if you don't need the server features) npm run dev
After configuring your rules in the firestore.rules file:
# Install Firebase CLI if you haven't already
npm install -g firebase-tools
# Login to Firebase
firebase login
# Initialize Firestore for your project (if needed)
firebase init firestore
# Deploy the rules
firebase deploy --only firestore:rules- Ensure necessary environment variables are configured in
.idx/dev.nix - Rebuild the environment if needed within IDX
- Branding: Replace the logo in
src/assets/taxi-icon.png, modify colors intailwind.config.js. - Features: Add/modify components in
src/components. Adjust Firestore data structures as needed.
- Contributions welcome! Please read CONTRIBUTING.md.
- Open issues for bugs or feature requests.
- Driver feedback is highly valuable!
- Phase 1 (Current MVP): Core UI/UX, Firebase auth/data sync, manual Kaspa QR payment generation.
- Phase 2 (Near-term): Backend logic via Cloud Functions (ride matching, basic state management), integrate on-chain Kaspa payment verification.
- Phase 3 (Long-term): Explore on-chain driver registration, reputation systems, further decentralization.
- API Key Security: We use a secure server-side approach to handle API keys. See API_KEY_SECURITY.md for details.
- Secure API Architecture: Our architecture follows security best practices for protecting sensitive operations. See SECURE_API_APPROACH.md for details.
- Map Access: The map is only accessible to authenticated users. Both WebApp and DriverApp components require user login to display the map and related functionality.
- Environment Variables: Use
.envfor local development. For production, move sensitive keys (like Firebase Admin SDK keys) to secure server-side environments (e.g., Cloud Functions environment variables), not client-side code. API keys like MapTiler are now handled by the Express server in theserverdirectory, which provides a secure proxy for these services. - Firebase Security Rules: Implement robust Firestore rules to control data access based on authentication and user roles. (Remember to deploy your rules using the Firebase CLI as described in the 'Getting Started' section). See details below.
- Authentication: We use Firebase Authentication with secure token verification on the server side.
- Kaspa Transaction Verification (Future): Implement server-side verification to prevent spoofed payment confirmations.
The kaspaTaxi/firestore.rules file provides a baseline set of security rules critical for protecting your Firestore data. It starts by denying all access and then explicitly allows operations based on user authentication and roles.
Key Assumptions Made in the Provided Rules:
usersCollection: Stores user profiles keyed by Firebase Auth UID. Contains fields likeisDriver(boolean) and potentiallykaspaAddress.ridesCollection: Stores ride details, includingriderId(UID of the requesting user) anddriverId(UID of the accepting driver, initially null).- Authentication: Rules heavily rely on
request.authto check if a user is logged in (request.auth != null) and who they are (request.auth.uid).
Summary of Provided Rules (users collection):
- Read: Users can read their own profile. Authenticated users can read profiles marked as
isDriver = true(consider restricting which fields are publicly readable). - Create: Users can create their own profile document.
- Update: Users can update their own profile. (Validation to prevent unauthorized changes like self-assigning
isDriverstatus is recommended). - Delete: Disallowed from the client.
Summary of Provided Rules (rides collection):
- Read: The rider or assigned driver can read a ride document. Any authenticated user can read rides with
status = 'pending'(allowing drivers to see requests). - Create: Authenticated users can create rides for themselves (
riderIdmust match their UID), setting initial status topendingand ensuring basic fields exist. - Update: Allows specific state transitions based on user roles (driver accepting, rider/driver cancelling, driver updating status). Further validation (e.g., checking
isDriverstatus viaget()) might be necessary. - Delete: Disallowed from the client.
IMPORTANT:
- Review & Customize: These rules are a starting point. You MUST review and adapt them to match your exact Firestore data structure, field names (
riderId,driverId, etc.), and application logic (status values, allowed transitions). - Test Thoroughly: Use the Firebase Emulator Suite or a test project to verify these rules prevent unauthorized access and allow legitimate operations.
- Other Collections: Add rules for any other collections you use (e.g.,
driverLocations). - Deployment: Deploy the final rules using
firebase deploy --only firestore:rulesas described in the Getting Started section.
KaspaTaxi is an experimental, open-source project. Use at your own risk. The authors are not liable for any issues or financial losses. Always verify Kaspa transactions independently.
KaspaTaxi is available under a dual licensing model:
- MIT License - For use with the Kaspa blockchain and KAS native coin only
- Commercial License - Required for use with other blockchains or KRC-20 tokens
Please refer to the LICENSE.md file for complete details.
KASperience - dev@KASperience.xyz
Support KaspaTaxi's development!
Scan the QR Code or Copy the Address:
kaspa:qr02ac46a6zwqzxgp97lcjw3th4f70x9mq24jsk6vgfmvvhy39lpyksqj24y5
Thank you for your support!

