How rifqi-dermawan/rute-ku works
RuteKu is an intercity bus-ticket booking platform. A traveler searches routes and schedules, selects and atomically holds seats, enters passenger details, reviews the booking, pays by QRIS or Midtrans, then accesses an e-ticket and protected invoice. Booking history supports cancellation and policy-based refunds. The graph includes the documented route map and GTFS export. Several payment and UI modules were not sampled; those branches reflect README capabilities, not inspected implementation details.
Main entry points: prisma.ts Application database · bookings/route.ts Booking API · qris/route.ts QRIS payment API · [id]/route.ts Cancellation API
Components 31
Search and routes
- Route search
app/page.tsx - Schedule results
app/schedules/page.tsx - Schedule search API
app/api/schedules/route.ts - Schedule details
app/schedules/[id]/page.tsx - Route map
components/RouteMap.tsx
Booking journey
- Seat selection
app/booking/[scheduleId]/seat/page.tsx - Seat hold actions
app/actions/seat-actions.ts - Seat management
lib/seat-management.ts - Passenger details
app/booking/[scheduleId]/passenger/page.tsx - Booking review
app/booking/[scheduleId]/review/page.tsx - Booking API
app/api/bookings/route.ts - Booking store
lib/booking-store.ts - E-ticket
app/booking/[scheduleId]/eticket/page.tsx - Booking history
app/history/page.tsx - Public invoice
app/api/invoice/[publicToken]/route.ts
Payments and refunds
- Payment screen
app/booking/[scheduleId]/payment/page.tsx - QRIS payment API
app/api/payment/qris/route.ts - Midtrans QRIS
- Payment status hooks
app/api/payment/midtrans/webhook/route.ts - Cancellation API
app/api/bookings/[id]/route.ts - Refund policy
lib/refund-policy.ts
Identity and delivery
- Booking authentication
app/booking/[scheduleId]/auth/page.tsx - Auth context
lib/auth-context.tsx - Auth endpoints
app/api/auth/google/url/route.ts - OTP endpoints
app/api/auth/send-otp/route.ts - OTP store
lib/otp-store.ts - Email delivery
lib/email.ts
Data and integrations
- Application database
lib/prisma.ts - GTFS export
scripts/export-gtfs.mjs - OSRM routing
Other components
- Traveler
Connections 38
- Traveler → Route search: searches
app/page.tsx - Route search → Schedule results: opens results
app/page.tsx - Schedule results → Schedule search API: loads schedules
app/schedules/page.tsx - Schedule search API → Application database: queries and creates
app/api/schedules/route.ts - Traveler → Schedule details: views details
- Schedule details → Route map: renders
- Route map → OSRM routing: shows route
- Traveler → Seat selection: selects seats
- Seat selection → Seat hold actions: requests hold
app/booking/[scheduleId]/seat/page.tsx - Seat hold actions → Seat management: delegates hold
app/actions/seat-actions.ts - Seat management → Application database: updates seats
lib/seat-management.ts - Traveler → Passenger details: enters details
- Passenger details → Booking review: continues booking
- Booking review → Booking API: creates booking
- Booking API → Seat management: holds seats
app/api/bookings/route.ts - Booking API → Application database: writes booking
app/api/bookings/route.ts - Booking store → Application database: reads bookings
lib/booking-store.ts - Traveler → Payment screen: pays
- Payment screen → QRIS payment API: requests QRIS
- QRIS payment API → Application database: reads and records
app/api/payment/qris/route.ts - QRIS payment API → Midtrans QRIS: charges
- Midtrans QRIS → Payment status hooks: sends status
- Payment status hooks → Application database: updates payment
- Traveler → Booking history: manages bookings
- Booking history → Cancellation API: requests cancellation
- Cancellation API → Refund policy: calculates refund
app/api/bookings/[id]/route.ts - Cancellation API → Application database: updates booking
app/api/bookings/[id]/route.ts - Traveler → Booking authentication: authenticates
- Booking authentication → Auth context: uses session
app/booking/[scheduleId]/auth/page.tsx - Auth context → Auth endpoints: registers or signs in
lib/auth-context.tsx - Auth context → OTP endpoints: requests verification
lib/auth-context.tsx - OTP endpoints → OTP store: stores codes
app/api/auth/send-otp/route.ts - OTP endpoints → Email delivery: sends code
app/api/auth/send-otp/route.ts - Traveler → E-ticket: views ticket
- Traveler → Public invoice: opens invoice
- Public invoice → Application database: reads booking
- Email delivery → Traveler: delivers e-ticket
- GTFS export → Application database: exports feed