How diego-mostro-dev/gim-saas works
1. Overall shape
- This is a two-tier gym management SaaS: a Django REST backend and a React/Vite frontend.
- The backend owns business data and CRUD operations; the frontend is a separate SPA that consumes the API.
2. Backend entry point and platform layer
- backend/manage.py, config/asgi.py, config/wsgi.py, config/settings.py, and config/urls.py form the Django application shell.
- config is the composition root: it wires Django apps, URL routing, environment-based settings, and deployment interfaces.
3. Domain modules in the backend
- The backend is split into three core business apps:
- members for gym member records
- plans for membership plan definitions
- subscriptions for the relationship between a member and a plan
- Each app has its own models.py, serializers.py, views.py, urls.py, admin.py, and migrations, which makes the domain boundaries explicit.
4. Data model boundaries
- members represents people/customers.
- plans represents pricing/duration offerings such as weekly, monthly, or premium plans.
- subscriptions links a member to a plan and adds operational fields like payment status and expiration dates.
- The architecture suggests the subscription layer is the main transactional entity, while members and plans are supporting reference entities.
5. API composition
- Backend endpoints are likely exposed through Django REST Framework view/serializer pairs under each app’s urls.py.
- There are also dedicated API modules in config/api/ for health.py and dashboard.py, implying cross-domain endpoints that aggregate data rather than serving a single model.
6. Operational and cross-cutting backend concerns
- The README mentions PostgreSQL on Neon as the database target.
- django-filter is part of the stack and the README explicitly calls out filtering support, so list endpoints likely support query-based filtering.
- Django Admin is enabled for direct operational management of the same domain models.
7. Backend data flow
- Client requests hit Django URLs, are handled by DRF views, serialized/deserialized by app serializers, and persisted via Django models to PostgreSQL.
- Dashboard-style endpoints likely read across multiple models to compute aggregates such as active members, expiring subscriptions, and revenue.
8. Frontend application shell
- The frontend is a React SPA built with Vite (frontend/src/main.jsx, App.jsx, vite.config.js).
- index.html is the browser entry, and the app is organized around pages plus reusable components.
9. Frontend feature boundaries
- src/pages/ contains the main route-level screens: Dashboard, Members, and Subscriptions.
- src/components/dashboard/ and src/components/subscriptions/ contain UI building blocks for those screens.
- This separation suggests pages compose domain-specific widgets rather than embedding all logic in route components.
10. Frontend data access layer
- src/services/ contains API client modules for members, plans, subscriptions, and dashboard.
- These service modules are the boundary between UI and backend, so the frontend does not appear to talk to the database directly or share backend models.
11. Frontend state and behavior
- Custom hooks in src/hooks/ encapsulate subscription-related logic such as fetching data, filtering, form state, and stats calculation.
- This indicates a thin component layer with logic extracted into reusable hooks, likely improving separation between presentation and data orchestration.
12. User-facing flow
- The primary UI flow appears to be:
- manage members
- define plans
- create and monitor subscriptions
- view dashboard analytics
- That maps directly to the backend’s domain apps and the planned dashboard summaries.
13. Important architectural boundary
- The repo is currently organized as a monorepo with a clear client/server split.
- The backend owns persistence, validation, and business rules; the frontend owns presentation, client-side interaction, and API orchestration.
14. MVP emphasis
- The README indicates the backend MVP is in progress, while the frontend is just starting.
- So the architecture should be drawn with a stronger emphasis on backend domain services and API endpoints, with the frontend shown as an API consumer that is still being fleshed out.
Main entry points: urls.py URL routing · pages Pages · members Members · plans Plans
Components 17
Backend
Django REST API, domain apps, and deployment shell
- manage.py · Django command entry point for local management tasks
backend/manage.py - config · Composition root for settings, routing, and deployment interfaces
backend/config - API endpoints · Health and dashboard endpoints that aggregate data across models
backend/config/api - Members · Member records and CRUD API boundary
backend/members - Plans · Membership plan definitions and CRUD API boundary
backend/plans - Subscriptions · Member-to-plan subscriptions with operational state
backend/subscriptions - Data models · Persistent business entities across the domain apps
- Serializers · Request and response shape for API resources
- Views · HTTP handlers for CRUD and aggregated endpoints
- URL routing · Dispatches requests into app and API view handlers
backend/config/urls.py - PostgreSQL · Neon-hosted persistence for the gym domain
Frontend
React SPA and client-side feature modules
- React app · Vite-powered browser application entry and root component
frontend/src - Pages · Dashboard, members, and subscriptions screens
frontend/src/pages - Dashboard UI · Widgets for charts, stats, activity, and actions
frontend/src/components/dashboard - Subscription UI · Forms, filters, cards, and stats for subscription workflows
frontend/src/components/subscriptions - API services · Frontend service modules that call backend endpoints
frontend/src/services - Hooks · Reusable subscription fetching, filtering, form, and stats logic
frontend/src/hooks
Connections 25
- manage.py → config: boots · Management commands load the Django project configuration
- config → URL routing: wires · Settings and app composition feed URL routing
- config → API endpoints: exposes · Config includes cross-domain API modules
- URL routing → Members: routes · Member endpoints are mounted through Django URLs
- URL routing → Plans: routes · Plan endpoints are mounted through Django URLs
- URL routing → Subscriptions: routes · Subscription endpoints are mounted through Django URLs
- URL routing → API endpoints: routes · Health and dashboard endpoints are exposed at the API layer
- Members → Data models: uses · Member app persists through Django models
- Plans → Data models: uses · Plan app persists through Django models
- Subscriptions → Data models: uses · Subscription app persists through Django models
- Members → Serializers: serializes · Member resources are shaped for DRF responses
- Plans → Serializers: serializes · Plan resources are shaped for DRF responses
- Subscriptions → Serializers: serializes · Subscription resources are shaped for DRF responses
- Members → Views: handles · CRUD views serve the member domain
- Plans → Views: handles · CRUD views serve the plan domain
- Subscriptions → Views: handles · CRUD views serve the subscription domain
- Views → PostgreSQL: persists · Views read and write the PostgreSQL data store
- API endpoints → PostgreSQL: aggregates · Dashboard and health endpoints can read across persisted domain data
- React app → Pages: renders · The app shell composes route-level screens
- Pages → Dashboard UI: composes · Dashboard page assembles dashboard widgets
- Pages → Subscription UI: composes · Subscriptions page assembles subscription widgets
- Pages → API services: fetches · Pages load data through API service modules
- Pages → Hooks: orchestrates · Pages use hooks for subscription state and derived data
- API services → URL routing: calls · Frontend services consume the Django API surface
- Hooks → API services: uses · Hooks build on API service calls