How yashwanthreddyc8/playo works
1. System shape
- This repository is a sports booking / coaching marketplace built as a React frontend plus a set of Spring Boot microservices.
- The architecture is split into clear domains: identity/auth, owner/center management and bookings, admin moderation, and service discovery / routing.
2. Client layer
- The frontend/ app is a Vite + React SPA.
- It contains route-level pages for the main user flows: home, discovery, booking, play/games, trainer profiles, login/register, password reset, and role-specific dashboards.
- State is organized with dedicated stores (authStore, ownerStore, trainerStore, adminStore, centerApplicationStore) and an Axios client in frontend/src/api/axios.js, which suggests the UI is built around API-backed domain state rather than local-only state.
3. Frontend domain segmentation
- The frontend/src/Pages/ tree shows separate UX areas for:
- public browsing: home, trainer discovery, play, book
- auth flows: login, register, forgot/reset password
- role dashboards: player, trainer, owner, admin
- Shared UI pieces live in frontend/src/components/ and frontend/src/layouts/, while reusable booking/game/trainer subviews are grouped by feature folder. This indicates a page-driven SPA with feature isolation.
4. Edge and routing layer
- services/api-gateway/ is the external entry point for backend traffic, exposed on port 8040 per the README.
- It has CORS configuration and a route config, which means the frontend talks to the gateway, and the gateway forwards requests to the appropriate service rather than the browser calling services directly.
- A small health controller suggests it also serves as an operational probe endpoint.
5. Service discovery
- services/eureka-server/ is the Spring Cloud Eureka registry on port 8761.
- The microservices register with Eureka, and the gateway likely uses discovery-aware routing rather than hard-coded service URLs.
- The README explicitly notes the Eureka dashboard, confirming this is part of the runtime topology.
6. Identity and account management
- services/auth-server/ is the central authentication and account lifecycle service.
- It handles login, registration, password reset, OTP verification, profile updates, and user-role administration.
- Supporting pieces include JWT authentication/filtering, email delivery, OTP/password-reset persistence, and a Cloudinary config for image upload, so this service is not only issuing auth tokens but also managing user account workflows.
7. Auth service data flow
- The auth service contains controllers for auth, password reset, profile update, and user admin.
- It stores OTP and password reset token entities/repositories, and uses an email template for reset flows.
- Security is JWT-based, so downstream services can authenticate requests without reimplementing login logic.
8. Owner / booking domain
- services/owner-service/ manages the sports center and booking domain.
- Its controllers and entities show two main aggregates: SportCenter and Booking.
- It also includes a Razorpay configuration and payment verification DTOs, so booking creation likely ties into payment-order and payment-confirmation flow.
9. Owner service responsibilities
- This service supports center CRUD, booking requests, slot availability checks, and payment failure handling.
- Security is again JWT-based, meaning owner actions are protected at the service boundary.
- This is the core transaction-heavy service for the marketplace.
10. Admin moderation domain
- services/admin-service/ handles center applications and user role administration.
- The presence of SportsCenterApplication, application status enums, and requests to update application status suggests an approval workflow for new sports centers/owners.
- OwnerAccountService and OwnerEmailService indicate the admin service may provision owner access and notify applicants as part of approval.
11. Shared model boundary
- services/common-models/ is a shared Java module containing the core User and Role model plus a shared UserRepository.
- This is important architecturally: multiple services share identity-related model code, which reduces duplication but also creates a shared-contract dependency across service boundaries.
12. Infrastructure and runtime dependencies
- The README shows the system is meant to run with Docker Compose, with PostgreSQL on 5432, Redis on 6379, Eureka on 8761, and the gateway on 8040.
- PostgreSQL is the primary persistent store for the backend services; Redis is present as an additional infrastructure dependency, likely for caching or ephemeral workflow support.
- Each service has its own Dockerfile and Maven build, so the deployment unit is the service container, not a shared monolith.
13. External integrations
- The codebase includes integrations for email, Cloudinary, and Razorpay.
- Email supports verification/password reset workflows.
- Cloudinary suggests user/image asset upload.
- Razorpay supports payment handling in the booking path.
14. End-to-end request flow
- Typical traffic pattern is: browser SPA → API Gateway → target microservice → database/external provider.
- Authentication is centralized in the auth service, with JWTs likely carried by the frontend to secure owner/admin/player requests.
- Role-specific UI sections in the frontend map to the backend service domains, especially for player booking, owner center management, and admin approvals.
15. How to diagram this repo
- Draw four layers: React client, gateway/discovery edge, domain microservices, and shared/external infrastructure.
- Show auth-server, owner-service, and admin-service as separate Spring Boot services registered with Eureka, fronted by the API Gateway.
- Place PostgreSQL/Redis underneath as runtime dependencies, and show email / Cloudinary / Razorpay as external services connected to the relevant backend services.
Main entry points: auth-server Auth Server · api-gateway API Gateway · owner-service Owner Service · admin-service Admin Service
Components 20
React client
Vite + React SPA for public browsing, authentication, and role dashboards.
- Frontend · Browser client with page-driven flows, role dashboards, and API-backed state stores.
frontend - Pages · Public, auth, player, trainer, owner, and admin screens.
frontend/src/Pages - Stores · Domain stores for auth, owner, trainer, admin, and center applications.
frontend/src/stores - API client · Shared Axios client used to call backend services through the gateway.
frontend/src/api/axios.js
Edge and discovery
Gateway and registry that route traffic to backend services.
- API Gateway · External HTTP entry point with CORS and route configuration.
services/api-gateway - Eureka · Registry for discovery-aware routing and service lookup.
services/eureka-server
Domain services
Spring Boot microservices for identity, bookings, and admin workflows.
- Auth Server · Central login, registration, reset, profile, OTP, JWT, and user admin service.
services/auth-server - Auth API · Auth, password reset, profile update, and user administration endpoints.
services/auth-server/src/main/java/com/sportify/sports - Security · JWT filter, token service, and Spring security configuration.
services/auth-server/src/main/java/com/sportify/sports/security - Owner Service · Sports center management, booking flow, and payment verification.
services/owner-service - Owner API · Sport center and booking controllers for owner-facing operations.
services/owner-service/src/main/java/com/pm/ownerservice/controller - Payments · Razorpay order creation and payment verification support.
services/owner-service/src/main/java/com/pm/ownerservice/config/RazorpayConfig.java - Admin Service · Center application review and user role administration workflows.
services/admin-service - Admin API · Center application and user administration controllers.
services/admin-service/src/main/java/com/pm/adminservice/controller - Admin Security · JWT security filter and configuration for admin endpoints.
services/admin-service/src/main/java/com/pm/adminservice/security - Common Models · Shared user and role model boundary used across services.
services/common-models
Shared infra
Datastores and third-party integrations used by the services.
- PostgreSQL · Persistent datastore for service-owned records.
services/docker-compose.yml - Redis · Auxiliary infrastructure dependency defined for runtime support.
services/docker-compose.yml - Email · Used for OTP and password reset delivery.
services/auth-server/src/main/java/com/sportify/sports/service/EmailService.java - Cloudinary · Image upload integration used by the auth/account workflow.
services/auth-server/src/main/java/com/sportify/sports/config/CloudinaryConfig.java
Connections 20
- Frontend → API Gateway: API calls · Frontend sends all domain requests through the gateway.
- Pages → Stores: uses · Route views consume domain state stores.
- Stores → API client: requests · Stores call the shared Axios client.
- API Gateway → Eureka: discovers · Gateway uses discovery-aware routing via the registry.
- API Gateway → Auth Server: routes to · Auth traffic is forwarded to the identity service.
- API Gateway → Owner Service: routes to · Booking and center traffic is forwarded to owner service.
- API Gateway → Admin Service: routes to · Admin traffic is forwarded to moderation service.
- Auth Server → Common Models: shares models · Auth service depends on the shared user and role boundary.
- Owner Service → Common Models: shares models · Owner service depends on shared identity types.
- Admin Service → Common Models: shares models · Admin service depends on shared identity types.
- Auth Server → PostgreSQL: persists · Auth stores accounts, OTPs, and reset tokens in the database.
- Owner Service → PostgreSQL: persists · Owner stores centers, bookings, and related records.
- Admin Service → PostgreSQL: persists · Admin stores center applications and moderation state.
- Auth Server → Redis: uses · Runtime infrastructure dependency defined for the stack.
- Auth Server → Email: sends · Password reset and verification emails are delivered externally.
- Auth Server → Cloudinary: uploads · Account images are uploaded through Cloudinary.
- Owner Service → Payments: uses · Booking flow depends on payment configuration and verification.
- Owner Service → Eureka: registers · Owner service participates in service discovery.
- Auth Server → Eureka: registers · Auth service participates in service discovery.
- Admin Service → Eureka: registers · Admin service participates in service discovery.