How sammmuley-oss/swiftplay_turf works
Swiftplay Turf appears to be a sports-equipment rental kiosk: customers browse equipment, book a timed session, pay, and return gear; administrators have inventory and session views. The sampled code confirms catalog loading, OTP authentication, and the catalog’s payment calls. Rentals, returns, admin operations, and live updates are documented by the route/page structure and server setup, but their internal wiring is not shown in the excerpts, so those links are kept conservative.
Main entry points: server.js API server · admin.js Admin routes · App.tsx Kiosk app · RentalSession.js Rental data models
Components 27
Customer kiosk
- Kiosk app
frontend/src/App.tsx - Catalog and booking
frontend/src/pages/CatalogScreen.tsx - Active rental
frontend/src/pages/ActiveRentalScreen.tsx - Equipment return
frontend/src/pages/ReturnScreen.tsx - Login
frontend/src/pages/LoginScreen.tsx - Equipment service
frontend/src/lib/equipmentService.ts - Catalog cache
frontend/src/lib/equipmentCache.ts - Auth API proxy
frontend/api/auth/initiate-2fa.js - OTP verify proxy
frontend/api/auth/verify-2fa.js
Rental backend
- API server
backend/src/server.js - Authentication routes
backend/src/routes/auth.js - Equipment routes
backend/src/routes/equipment.js - Rental routes
backend/src/routes/rentals.js - Payment routes
backend/src/routes/payments.js - Admin routes
backend/src/routes/admin.js - Rental data models
backend/src/models/RentalSession.js - Auth middleware
backend/src/middleware/authMiddleware.js - Realtime service
backend/src/services/realtime.js - IoT simulation
backend/src/services/iotSimulation.js
Admin operations
- Admin dashboard
frontend/src/pages/admin/AdminDashboardScreen.tsx - Inventory management
frontend/src/pages/admin/AdminInventoryScreen.tsx - Session history
frontend/src/pages/admin/AdminSessionsScreen.tsx
External services
- MongoDB
- Email service
backend/src/services/mailer.js - Razorpay
- Realtime clients
Other components
- Customer
Connections 32
- Customer → Kiosk app: uses
- Kiosk app → Catalog and booking: routes to
- Kiosk app → Active rental: routes to
- Kiosk app → Equipment return: routes to
- Kiosk app → Login: routes to
- Catalog and booking → Equipment service: loads catalog
- Equipment service → Catalog cache: reads and writes
- Equipment service → Equipment routes: requests equipment
- Catalog and booking → Payment routes: creates and verifies orders
- Login → Auth API proxy: initiates OTP
- Login → OTP verify proxy: verifies OTP
- API server → Authentication routes: mounts auth
- API server → Equipment routes: mounts equipment
- API server → Rental routes: mounts rentals
- API server → Payment routes: mounts payments
- API server → Admin routes: mounts admin
- API server → Realtime service: registers handlers
- API server → MongoDB: connects
- Authentication routes → Rental data models: uses OTP and user models
- Authentication routes → Email service: sends OTP
- Authentication routes → Auth middleware: protected routes use
- Rental routes → Rental data models: rental data
- Equipment routes → Rental data models: equipment data
- Admin routes → Auth middleware: protects admin access
- Admin routes → Rental data models: admin data
- Payment routes → Razorpay: processes payments
- Payment routes → Rental data models: records rental payment
- Realtime service → Realtime clients: dispatches updates
- IoT simulation → Realtime service: simulates events
- Admin dashboard → Admin routes: admin requests
- Inventory management → Admin routes: manages inventory
- Session history → Admin routes: views sessions