How piyapong9/sportborrowsys works
SportBorrow is a sports-equipment borrowing system with member and administrator experiences backed by an Express/Prisma API. The main user journey spans account registration or login, equipment discovery and borrowing, staff-managed returns and fines, and member history; administration also includes reporting, notifications, users, and system settings. The graph highlights the sampled authentication and equipment boundaries and the documented frontend routes. Several domain services are represented by their existing directories because their implementations were not sampled; links to them are omitted where callers are unverified.
Main entry points: AppRoutes.jsx Role-based routes · prisma.js Prisma database · app.js HTTP application · auth.controller.js Authentication controller
Components 32
Web application
- Application entry
src/main.jsx - Role-based routes
src/routes/AppRoutes.jsx - Session state
src/contexts/AuthContext.jsx - Authentication client
src/services/authService.js - API client
src/services/api.js - Member experience
src/pages/member - Admin workspace
src/pages/admin - Admin API services
src/services
API and access
- HTTP application
server/src/app.js - Authentication routes
server/src/routes/auth.routes.js - Authentication controller
server/src/controllers/auth.controller.js - Account and session logic
server/src/services/auth.service.js - Two-factor service
server/src/services/two-factor.service.js - Equipment routes
server/src/routes/equipment.routes.js - Equipment controller
server/src/controllers/equipment.controller.js
Borrowing operations
- Equipment service
server/src/services/equipment.service.js - Borrow and return
server/src/services - Fines and payments
server/src/services - Reports and dashboard
server/src/services - Notifications
server/src/services
Shared platform
- Prisma database
server/src/config/prisma.js - Email delivery
server/src/services/email.service.js - Runtime configuration
server/src/config/env.js - Shared UI components
src/components/common - Form components
src/components/forms - Async handler
server/src/utils/asyncHandler.js - Confirmation dialogs
src/utils/dialog.js - Asset URL helper
src/utils/assetUrl.js - Document title hook
src/hooks/useDocumentTitle.js - App constants
src/constants/app.js
Other components
- Member
- Administrator
Connections 36
- Member → Application entry: uses
- Administrator → Application entry: uses
- Application entry → Role-based routes: renders
src/main.jsx - Role-based routes → Session state: checks session
src/routes/AppRoutes.jsx - Role-based routes → Member experience: routes to
src/routes/AppRoutes.jsx - Role-based routes → Admin workspace: routes to
src/routes/AppRoutes.jsx - Session state → Authentication client: calls
src/contexts/AuthContext.jsx - Session state → App constants: reads keys
src/contexts/AuthContext.jsx - Authentication client → API client: sends requests
src/services/authService.js - Authentication client → Asset URL helper: normalizes images
src/services/authService.js - API client → App constants: reads keys
src/services/api.js - Authentication client → Authentication routes: calls endpoints
src/services/authService.js - HTTP application → Authentication routes: mounts routes
server/src/app.js - Authentication routes → Authentication controller: dispatches
server/src/routes/auth.routes.js - Authentication routes → Async handler: wraps handlers
server/src/routes/auth.routes.js - Authentication controller → Account and session logic: calls
server/src/controllers/auth.controller.js - Authentication controller → Two-factor service: calls
server/src/controllers/auth.controller.js - Authentication controller → Email delivery: sends reset email
server/src/controllers/auth.controller.js - Account and session logic → Prisma database: reads and writes
server/src/services/auth.service.js - Account and session logic → Email delivery: sends registration OTP
server/src/services/auth.service.js - Authentication controller → Runtime configuration: reads settings
server/src/controllers/auth.controller.js - HTTP application → Runtime configuration: loads configuration
server/src/app.js - HTTP application → Notifications: starts scheduler
server/src/server.js - HTTP application → Prisma database: connects
server/src/server.js - HTTP application → Email delivery: starts outbox
- Equipment routes → Equipment controller: dispatches
server/src/routes/equipment.routes.js - Equipment controller → Equipment service: calls
server/src/controllers/equipment.controller.js - Role-based routes → Shared UI components: uses loading
src/routes/AppRoutes.jsx - Role-based routes → App constants: checks roles
src/routes/AppRoutes.jsx - Member experience → Admin API services
src/pages/member/ProfilePage.jsx - Admin workspace → Admin API services
src/pages/admin/ReturnManagementPage.jsx - Equipment service → Prisma database
- Borrow and return → Prisma database
server/src/services/auth.service.js - Fines and payments → Prisma database
server/src/services/auth.service.js - Reports and dashboard → Prisma database
server/src/services/auth.service.js - Notifications → Prisma database
server/src/services/auth.service.js