# yashwanthreddyc8/playo architecture

> Architecture diagram of the GitHub repository yashwanthreddyc8/playo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yashwanthreddyc8/playo
- Repository: https://github.com/yashwanthreddyc8/playo

## Overview

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: [`services/auth-server`](https://github.com/yashwanthreddyc8/playo/tree/main/services/auth-server) (Auth Server), [`services/api-gateway`](https://github.com/yashwanthreddyc8/playo/tree/main/services/api-gateway) (API Gateway), [`services/owner-service`](https://github.com/yashwanthreddyc8/playo/tree/main/services/owner-service) (Owner Service), [`services/admin-service`](https://github.com/yashwanthreddyc8/playo/tree/main/services/admin-service) (Admin Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React client"]
  node_frontend["Frontend<br/>React SPA"]
  node_frontend_pages["Pages<br/>route views"]
  node_frontend_stores["Stores<br/>client state"]
  node_frontend_api["API client<br/>axios layer<br/>[axios.js]"]
end

subgraph group_edge["Edge and discovery"]
  node_gateway["API Gateway<br/>Spring gateway"]
  node_eureka(("Eureka<br/>service registry"))
end

subgraph group_services["Domain services"]
  node_auth["Auth Server<br/>identity service"]
  node_auth_api["Auth API<br/>auth controllers"]
  node_auth_sec["Security"]
  node_owner["Owner Service<br/>booking service"]
  node_owner_api["Owner API<br/>booking controllers"]
  node_owner_payment["Payments<br/>razorpay integration"]
  node_admin["Admin Service<br/>moderation service"]
  node_admin_api["Admin API<br/>admin controllers"]
  node_admin_sec["Admin Security<br/>jwt security"]
  node_common_models["Common Models<br/>shared library"]
end

subgraph group_infra["Shared infra"]
  node_postgres[("PostgreSQL<br/>primary database<br/>[docker-compose.yml]")]
  node_redis[("Redis<br/>cache/workflow store<br/>[docker-compose.yml]")]
  node_email["Email<br/>notification provider<br/>[EmailService.java]"]
  node_cloudinary["Cloudinary<br/>media upload"]
end

node_frontend -->|"API calls"| node_gateway
node_frontend_pages -.->|"uses"| node_frontend_stores
node_frontend_stores -.->|"requests"| node_frontend_api
node_gateway -->|"discovers"| node_eureka
node_gateway -->|"routes to"| node_auth
node_gateway -->|"routes to"| node_owner
node_gateway -->|"routes to"| node_admin
node_auth -.->|"shares models"| node_common_models
node_owner -.->|"shares models"| node_common_models
node_admin -.->|"shares models"| node_common_models
node_auth -->|"persists"| node_postgres
node_owner -->|"persists"| node_postgres
node_admin -->|"persists"| node_postgres
node_auth -.->|"uses"| node_redis
node_auth -->|"sends"| node_email
node_auth -->|"uploads"| node_cloudinary
node_owner -->|"uses"| node_owner_payment
node_owner -.->|"registers"| node_eureka
node_auth -.->|"registers"| node_eureka
node_admin -.->|"registers"| node_eureka

click node_frontend "https://github.com/yashwanthreddyc8/playo/tree/main/frontend"
click node_frontend_pages "https://github.com/yashwanthreddyc8/playo/tree/main/frontend/src/Pages"
click node_frontend_stores "https://github.com/yashwanthreddyc8/playo/tree/main/frontend/src/stores"
click node_frontend_api "https://github.com/yashwanthreddyc8/playo/blob/main/frontend/src/api/axios.js"
click node_gateway "https://github.com/yashwanthreddyc8/playo/tree/main/services/api-gateway"
click node_eureka "https://github.com/yashwanthreddyc8/playo/tree/main/services/eureka-server"
click node_auth "https://github.com/yashwanthreddyc8/playo/tree/main/services/auth-server"
click node_auth_api "https://github.com/yashwanthreddyc8/playo/tree/main/services/auth-server/src/main/java/com/sportify/sports"
click node_auth_sec "https://github.com/yashwanthreddyc8/playo/tree/main/services/auth-server/src/main/java/com/sportify/sports/security"
click node_owner "https://github.com/yashwanthreddyc8/playo/tree/main/services/owner-service"
click node_owner_api "https://github.com/yashwanthreddyc8/playo/tree/main/services/owner-service/src/main/java/com/pm/ownerservice/controller"
click node_owner_payment "https://github.com/yashwanthreddyc8/playo/blob/main/services/owner-service/src/main/java/com/pm/ownerservice/config/RazorpayConfig.java"
click node_admin "https://github.com/yashwanthreddyc8/playo/tree/main/services/admin-service"
click node_admin_api "https://github.com/yashwanthreddyc8/playo/tree/main/services/admin-service/src/main/java/com/pm/adminservice/controller"
click node_admin_sec "https://github.com/yashwanthreddyc8/playo/tree/main/services/admin-service/src/main/java/com/pm/adminservice/security"
click node_common_models "https://github.com/yashwanthreddyc8/playo/tree/main/services/common-models"
click node_postgres "https://github.com/yashwanthreddyc8/playo/blob/main/services/docker-compose.yml"
click node_redis "https://github.com/yashwanthreddyc8/playo/blob/main/services/docker-compose.yml"
click node_email "https://github.com/yashwanthreddyc8/playo/blob/main/services/auth-server/src/main/java/com/sportify/sports/service/EmailService.java"
click node_cloudinary "https://github.com/yashwanthreddyc8/playo/blob/main/services/auth-server/src/main/java/com/sportify/sports/config/CloudinaryConfig.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_frontend,node_frontend_pages,node_frontend_stores,node_frontend_api toneBlue
class node_gateway,node_eureka toneAmber
class node_auth,node_auth_api,node_auth_sec,node_owner,node_owner_api,node_owner_payment,node_admin,node_admin_api,node_admin_sec,node_common_models toneMint
class node_postgres,node_redis,node_email,node_cloudinary toneRose
```

## Components

### React client

Vite + React SPA for public browsing, authentication, and role dashboards.

- [Frontend](https://github.com/yashwanthreddyc8/playo/tree/main/frontend): React SPA · Browser client with page-driven flows, role dashboards, and API-backed state stores. · `frontend`
- [Pages](https://github.com/yashwanthreddyc8/playo/tree/main/frontend/src/Pages): route views · Public, auth, player, trainer, owner, and admin screens. · `frontend/src/Pages`
- [Stores](https://github.com/yashwanthreddyc8/playo/tree/main/frontend/src/stores): client state · Domain stores for auth, owner, trainer, admin, and center applications. · `frontend/src/stores`
- [API client](https://github.com/yashwanthreddyc8/playo/blob/main/frontend/src/api/axios.js): axios layer · 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](https://github.com/yashwanthreddyc8/playo/tree/main/services/api-gateway): Spring gateway · External HTTP entry point with CORS and route configuration. · `services/api-gateway`
- [Eureka](https://github.com/yashwanthreddyc8/playo/tree/main/services/eureka-server): service registry · Registry for discovery-aware routing and service lookup. · `services/eureka-server`

### Domain services

Spring Boot microservices for identity, bookings, and admin workflows.

- [Auth Server](https://github.com/yashwanthreddyc8/playo/tree/main/services/auth-server): identity service · Central login, registration, reset, profile, OTP, JWT, and user admin service. · `services/auth-server`
- [Auth API](https://github.com/yashwanthreddyc8/playo/tree/main/services/auth-server/src/main/java/com/sportify/sports): auth controllers · Auth, password reset, profile update, and user administration endpoints. · `services/auth-server/src/main/java/com/sportify/sports`
- [Security](https://github.com/yashwanthreddyc8/playo/tree/main/services/auth-server/src/main/java/com/sportify/sports/security): jwt security · JWT filter, token service, and Spring security configuration. · `services/auth-server/src/main/java/com/sportify/sports/security`
- [Owner Service](https://github.com/yashwanthreddyc8/playo/tree/main/services/owner-service): booking service · Sports center management, booking flow, and payment verification. · `services/owner-service`
- [Owner API](https://github.com/yashwanthreddyc8/playo/tree/main/services/owner-service/src/main/java/com/pm/ownerservice/controller): booking controllers · Sport center and booking controllers for owner-facing operations. · `services/owner-service/src/main/java/com/pm/ownerservice/controller`
- [Payments](https://github.com/yashwanthreddyc8/playo/blob/main/services/owner-service/src/main/java/com/pm/ownerservice/config/RazorpayConfig.java): razorpay integration · Razorpay order creation and payment verification support. · `services/owner-service/src/main/java/com/pm/ownerservice/config/RazorpayConfig.java`
- [Admin Service](https://github.com/yashwanthreddyc8/playo/tree/main/services/admin-service): moderation service · Center application review and user role administration workflows. · `services/admin-service`
- [Admin API](https://github.com/yashwanthreddyc8/playo/tree/main/services/admin-service/src/main/java/com/pm/adminservice/controller): admin controllers · Center application and user administration controllers. · `services/admin-service/src/main/java/com/pm/adminservice/controller`
- [Admin Security](https://github.com/yashwanthreddyc8/playo/tree/main/services/admin-service/src/main/java/com/pm/adminservice/security): jwt security · JWT security filter and configuration for admin endpoints. · `services/admin-service/src/main/java/com/pm/adminservice/security`
- [Common Models](https://github.com/yashwanthreddyc8/playo/tree/main/services/common-models): shared library · Shared user and role model boundary used across services. · `services/common-models`

### Shared infra

Datastores and third-party integrations used by the services.

- [PostgreSQL](https://github.com/yashwanthreddyc8/playo/blob/main/services/docker-compose.yml): primary database · Persistent datastore for service-owned records. · `services/docker-compose.yml`
- [Redis](https://github.com/yashwanthreddyc8/playo/blob/main/services/docker-compose.yml): cache/workflow store · Auxiliary infrastructure dependency defined for runtime support. · `services/docker-compose.yml`
- [Email](https://github.com/yashwanthreddyc8/playo/blob/main/services/auth-server/src/main/java/com/sportify/sports/service/EmailService.java): notification provider · Used for OTP and password reset delivery. · `services/auth-server/src/main/java/com/sportify/sports/service/EmailService.java`
- [Cloudinary](https://github.com/yashwanthreddyc8/playo/blob/main/services/auth-server/src/main/java/com/sportify/sports/config/CloudinaryConfig.java): media upload · Image upload integration used by the auth/account workflow. · `services/auth-server/src/main/java/com/sportify/sports/config/CloudinaryConfig.java`

## Connections

- 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.
