How alexrguez9/deportesurjc works
Purpose and Deployable Units
DeportesURJC is a MERN university sports-management system: users authenticate, manage profiles/wallet subscriptions, reserve facilities, and participate in internal leagues; administrators manage users, facilities, reservations, teams, and results. It runs as separate React/Vite and Node/Express services, with MongoDB Atlas persistence. Main service entry points are frontend/src/main.jsx, frontend/src/App.jsx, and backend/server.js.
Frontend Application Shell and Navigation
The React client bootstraps the application and route tree, then provides a shared layout around public, authenticated, and administrative views. Routing is centralized in frontend/src/router/index.jsx; common page framing is frontend/src/views/layout/Layout.jsx. The client targets a configurable API base URL via frontend/src/config/env.js, enabling local, containerized, and production backend endpoints.
Client State and Access Boundary
Cross-page state is partitioned into authentication, facility/reservation, and team/result contexts. frontend/src/context/AuthContext.jsx owns session-aware user state and access decisions; frontend/src/context/FacilitiesAndReservationsContext.jsx and frontend/src/context/TeamsAndResultsContext.jsx coordinate domain data consumed by views. This is the primary frontend-to-backend boundary: browser requests must preserve Express session cookies rather than use JWTs.
User, Wallet, and Fitness Workflows
Profile flows include login, account information, reservations, and subscriptions under frontend/src/views/profile/Profile.jsx. Fitness-room registration and subscription/payment experiences are implemented in frontend/src/views/fitnessRooms/registration/Registration.jsx and frontend/src/views/fitnessRooms/paymentSubscription/PaymentSubscription.jsx. Backend user actions and persisted user identity/wallet-related data are handled through backend/app/routes/user.js, backend/app/controllers/user.js, and backend/app/models/User.js.
Facility Reservation Domain
Facility discovery and booking are first-class workflows: users browse facilities, choose time slots, and inspect their reservations. Key UI surfaces are frontend/src/views/facilities/Facilities.jsx and frontend/src/views/fitnessRooms/fitnessRoomsReservations/FitnessRoomsReservations.jsx. The Express MVC pipeline maps route requests through backend/app/routes/facility.js and backend/app/routes/reservation.js, applies domain operations in their controllers, and persists records through backend/app/models/facility.js and backend/app/models/reservation.js.
Internal Leagues and Administration
Internal leagues expose teams, results, and rankings through frontend/src/views/ligas_internas/LigasInternas.jsx, frontend/src/views/ligas_internas/results/Results.jsx, and frontend/src/views/ligas_internas/rankings/Rankings.jsx. Their backend resource boundaries are backend/app/routes/team.js, backend/app/routes/result.js, backend/app/models/team.js, and backend/app/models/result.js. Admin-only management views begin at frontend/src/views/admin/cover/AdminPanel.jsx and delegate entity management to specialized facility, reservation, team, and user screens.
Backend Infrastructure and External Services
backend/server.js composes Express, database connectivity, session behavior, and route mounting. MongoDB Atlas connection setup resides in backend/config/db.js; MongoDB also persists sessions via Connect-Mongo. Email notification routing/configuration is represented by backend/app/routes/mail.js and backend/config/mails.js, using SendGrid credentials. Subscription-specific backend logic is isolated in backend/app/utils/subscription.js.
Delivery Topology
Dockerized local execution is defined by docker-compose.yml, frontend/Dockerfile, and backend/Dockerfile. Production places the static/frontend deployment on Vercel and the Node API on Render, both connecting to MongoDB Atlas; cross-origin secure cookies are required in production. GitHub Actions separates frontend and backend validation and includes Docker publishing through .github/workflows.
Main entry points: server.js Express server · index.jsx Route tree · User.js Domain models · AuthContext.jsx Session and domain state
Components 22
React client
- Client bootstrap
frontend/src/main.jsx - App shell
frontend/src/App.jsx - Route tree
frontend/src/router/index.jsx - Shared layout
frontend/src/views/layout/Layout.jsx - Session and domain state · Auth, reservation/facility, and team/result state.
frontend/src/context/AuthContext.jsx - Profile and subscriptions
frontend/src/views/profile/Profile.jsx - Facility booking
frontend/src/views/facilities/Facilities.jsx - Leagues and rankings
frontend/src/views/ligas_internas/LigasInternas.jsx - Admin management
frontend/src/views/admin/cover/AdminPanel.jsx - API endpoint config · Selects local, container, or production API base URL.
frontend/src/config/env.js
Node API
- Express server · Mounts routes, sessions, and database connectivity.
backend/server.js - User and wallet API
backend/app/routes/user.js - Facility and reservation API
backend/app/routes/reservation.js - Team and result API
backend/app/routes/team.js - Email notifications
backend/app/routes/mail.js - Subscription logic
backend/app/utils/subscription.js
Data and services
- MongoDB Atlas · Persists application records and Connect-Mongo sessions.
backend/config/db.js - Domain models · Users, facilities, reservations, teams, and results.
backend/app/models/User.js - SendGrid
backend/config/mails.js
Delivery
- Docker local stack
docker-compose.yml - Vercel and Render · Static client on Vercel and Node API on Render.
- GitHub Actions · Validates both services and publishes Docker images.
.github/workflows
Connections 31
- Client bootstrap → App shell: renders
- App shell → Route tree: loads
- Route tree → Shared layout: wraps views
- Route tree → Profile and subscriptions: routes to
- Route tree → Facility booking: routes to
- Route tree → Leagues and rankings: routes to
- Route tree → Admin management: guards and routes
- Session and domain state → Profile and subscriptions: supplies session
- Session and domain state → Facility booking: supplies booking state
- Session and domain state → Leagues and rankings: supplies league state
- API endpoint config → Express server: configures browser requests · Requests retain Express session cookies.
- Profile and subscriptions → Express server: user requests
- Facility booking → Express server: booking requests
- Leagues and rankings → Express server: league requests
- Admin management → Express server: management requests
- Express server → User and wallet API: mounts
- Express server → Facility and reservation API: mounts
- Express server → Team and result API: mounts
- Express server → Email notifications: mounts
- User and wallet API → Subscription logic: uses
- User and wallet API → Domain models: reads and writes
- Facility and reservation API → Domain models: reads and writes
- Team and result API → Domain models: reads and writes
- Domain models → MongoDB Atlas: persists in
- Express server → MongoDB Atlas: stores sessions
- Email notifications → SendGrid: sends email
- Docker local stack → Client bootstrap: runs frontend
- Docker local stack → Express server: runs backend
- Vercel and Render → Client bootstrap: deploys frontend
- Vercel and Render → Express server: deploys API
- GitHub Actions → Docker local stack: publishes images