How kbdevs12/go_backend works
This is a Go/Gin backend for futsal-field booking, customer payments, and admin operations. Customers authenticate through Firebase, check field availability, create and manage bookings, then obtain a QR code and upload payment proof for admin verification. Admins manage bookings, payments, fields and date-specific schedules, users, notifications, reports, and admin accounts. The graph follows documented routes and sampled calls; several admin capabilities are documented but their implementation details were not sampled.
Main entry points: router.go API router · db.go PostgreSQL · payment/handler.go Payment workflow · auth/handler.go Login and sessions
Components 23
HTTP and identity
- Server entry
cmd/server/main.go - API router
cmd/server/router.go - Auth middleware
internal/middleware/middleware.go - Login and sessions
internal/auth/handler.go - JWT handling
internal/auth/jwt.go - Customer profile
internal/user/handler.go
Booking and payment
- Booking and availability
internal/booking/handler.go - Schedule availability
internal/booking/availability.go - Payment workflow
internal/payment/handler.go - QRIS generation
pkg/qris/qris.go
Admin operations
- Admin booking and reports
internal/admin/handler.go - Admin users and payments
internal/admin/extra_handler.go - Fields and schedules
internal/admin/field_handler.go - Admin dashboard
internal/admin/dashboard_handler.go - Admin accounts
internal/admin/admin_handler.go
Storage and messaging
- Firebase Auth
pkg/firebase/firebase.go - Notification service
internal/notification/service.go - Proof storage
internal/storage/supabase_s3.go - Firebase messaging
pkg/firebase/firebase.go - PostgreSQL
internal/database/db.go - Runtime config
internal/config/config.go
Other components
- Customers
- Admins
Connections 38
- Customers → API router: send requests
- Admins → API router: send requests
- Server entry → Runtime config: loads config
- Server entry → PostgreSQL: connects
- Server entry → API router: starts
- API router → Login and sessions: dispatches login
- API router → Booking and availability: dispatches bookings
- API router → Schedule availability: dispatches availability
- API router → Payment workflow: dispatches payments
- API router → Customer profile: dispatches profile
- API router → Auth middleware: protects routes
- API router → Admin booking and reports: dispatches admin routes
- API router → Admin users and payments: dispatches admin routes
- API router → Fields and schedules: dispatches field routes
- API router → Admin dashboard: dispatches dashboard
- API router → Admin accounts: dispatches superadmin routes
- Login and sessions → Firebase Auth: verifies identity
- Login and sessions → PostgreSQL: reads and writes users
- Login and sessions → JWT handling: creates sessions
- Auth middleware → JWT handling: validates tokens
- Customer profile → PostgreSQL: reads and writes profile
- Booking and availability → PostgreSQL: reads and writes bookings
- Booking and availability → Notification service: notifies admins
- Schedule availability → PostgreSQL: reads fields and schedules
- Payment workflow → PostgreSQL: reads and writes payments
- Payment workflow → QRIS generation: generates QR
- Payment workflow → Proof storage: uploads proof
- Payment workflow → Notification service: notifies customer
- Admin booking and reports → PostgreSQL: reads booking reports
- Admin users and payments → PostgreSQL: reads and writes records
- Admin users and payments → Firebase Auth: creates Firebase user
- Fields and schedules → PostgreSQL: reads and writes fields
- Admin dashboard → PostgreSQL: reads dashboard data
- Admin accounts → PostgreSQL: reads and writes admins
- Notification service → PostgreSQL: stores and reads notifications
- Notification service → Firebase messaging: sends push
- Proof storage → PostgreSQL
- Firebase messaging → Firebase Auth