**GYM MANAGEMENT SYSTEM**

**SOFTWARE REQUIREMENTS SPECIFICATION**

Consolidated scope, workflows, permissions, data rules,  
security, deployment and acceptance criteria

**VERSION 2.0 \| 14 NOVEMBER 2026  
STATUS: APPROVED BY THE USER AS THE DEVELOPMENT BASELINE**

> **Status note (17 Nov 2026):** The user has explicitly approved SRS v2.0 for development. Only status wording in this copy was updated (header, Document Control, Revision Summary, §20.2). No requirement was added, removed or changed. Original file: `Gym_Management_System_SRS_v2_Draft_1.docx`.
>
> **Amendment (17 Nov 2026, user-confirmed decision C-38 / X-16):** the Appendix A **Member** row was corrected to match §3.1 and §5.2. It now reads "Admin/Trainer archive and restore" instead of "Admin restore". No other text changed.

React + Vite • Tailwind CSS • Node.js • Express.js • MongoDB Atlas  
PKR • Asia/Karachi • English and Urdu UI

# Document Control

| **Field**           | **Value**                                                        |
|---------------------|------------------------------------------------------------------|
| Document            | Gym Management System — Software Requirements Specification      |
| Version             | 2.0 — consolidated, approved baseline                            |
| Project type        | Single-gym public website and internal management application    |
| Primary roles       | Admin and Trainer; members do not log in                         |
| Currency / timezone | PKR, whole rupees only; Asia/Karachi                             |
| UI languages        | English and Urdu                                                 |
| PDF language        | English only in first release                                    |
| Approval status     | Approved for development by the user (confirmed 17 Nov 2026)     |

## Revision Summary

- Consolidates planning decisions from Batches 1–24 and the subsequent
  clarification rounds.

- Resolves earlier draft conflicts concerning payment event history,
  receipts, role permissions, deletion, security, hosting, backups and
  WhatsApp templates.

- Records selected implementation defaults where the user delegated
  remaining decisions.

- Approved by the user as the development baseline (approval confirmed
  17 Nov 2026).

# 1. Executive Summary

The Gym Management System is a production-oriented web application for
one gym. It combines a public-facing website and inquiry form with a
secure internal dashboard for Admin and Trainers. The system replaces
fragmented manual records with a central source of truth for members,
memberships, payments, receipts, workout notes, inquiries, WhatsApp
notifications, expenses, reports, settings and audit history.

The product is mobile-first. Phones are the primary design target;
tablet and desktop experiences must also be complete. Members have no
application login or self-service portal.

## 1.1 Product Principles

- Mobile-first, responsive and touch-friendly workflows.

- Clear Admin/Trainer permission boundaries enforced on the server.

- Traceable membership and financial history; no silent overwrites.

- Explicit WhatsApp consent and opt-out enforcement.

- Sensitive and irreversible actions protected by confirmation and audit
  controls.

- No automatic cascading deletion of related business records.

- Do not begin implementation until the user explicitly approves the
  final SRS.

# 2. Goals, Scope and Boundaries

## 2.1 Goals

- Maintain member profiles and unique Member IDs.

- Manage membership plans, activation, expiry, renewal and history.

- Track Cash and externally verified Online payments, partial payments
  and balances.

- Convert public inquiries into member records without retyping details.

- Give Trainers operational tools while reserving administrative
  controls for Admin.

- Send approved WhatsApp Business Platform messages and retain message
  status history.

- Provide useful dashboards, PDF reports and basic expense recording.

- Protect personal and financial information with authentication,
  authorization, audit logs and backups.

## 2.2 In Scope

- Public landing page: Home, Plans and Prices, Trainers, About,
  Facilities/Gallery, Contact/Location, Inquiry/Join Now.

- Admin and Trainer authentication and role-specific dashboards.

- Member creation, editing, search, archive/restore, photos and profile
  history.

- Membership plans, custom member pricing, renewals, activation, expiry
  and reactivation.

- Payment summary, payment-event ledger, corrections, balances and PDF
  receipts.

- Exercise library and member-specific workout notes.

- WhatsApp Cloud API integration, editable templates, consent, opt-out,
  retries and notification history.

- Dashboard statistics, PDF reports, expense entry, settings, content
  management and audit logs.

- Scheduled backups, staging/production environments and deployment
  handover.

## 2.3 Out of Scope

- Member login, member portal or customer self-service account.

- Attendance or biometric attendance.

- Integrated payment gateway; Online payments are verified outside the
  application and recorded by staff.

- Advanced workout programming, progress analytics or performance
  tracking.

- Membership pause, early cancellation, automatic renewal, refunds or
  payment gateway processing.

- Payroll, inventory, full accounting or multi-gym/multi-tenant SaaS.

# 3. Users and Roles

| **Role**           | **Description**                                                                                                  |
|--------------------|------------------------------------------------------------------------------------------------------------------|
| Public visitor     | Views public pages and submits an inquiry; no login.                                                             |
| Admin              | Highest-privilege gym operator; manages inquiries, plans, accounts, settings, reports and authorized deletion.   |
| Trainer            | Operational staff account; manages permitted member, membership, payment, exercise, note and WhatsApp workflows. |
| Member             | Gym customer whose information is maintained by staff; no login.                                                 |
| Technical operator | Performs deployment and technical recovery tasks; not a normal gym application role.                             |

## 3.1 Permission Matrix

| **Capability**                            | **Admin**                                             | **Trainer**                                                   |
|-------------------------------------------|-------------------------------------------------------|---------------------------------------------------------------|
| View dashboard                            | Full Admin dashboard                                  | Role-limited dashboard; no upcoming-expiry widget             |
| Create/edit member                        | Yes                                                   | Yes                                                           |
| Archive/restore member                    | Yes                                                   | Yes; cannot archive a member with an active membership        |
| Permanently delete member/records         | Yes, with safeguards and dependency checks            | No                                                            |
| Upload/replace member photo               | Yes                                                   | Yes                                                           |
| Permanently remove member photo           | Yes                                                   | No                                                            |
| Manage inquiries and convert to member    | Yes                                                   | No                                                            |
| Create/manage Trainer accounts            | Yes                                                   | No                                                            |
| Deactivate Trainer account / force logout | Yes                                                   | No                                                            |
| Manage membership plans and plan prices   | Yes                                                   | No                                                            |
| Apply member-specific custom price        | Yes, reason required and logged                       | No                                                            |
| Renew/activate memberships                | Yes                                                   | Yes                                                           |
| Record/correct payments                   | Yes                                                   | Yes; corrections require reason and are logged                |
| View member payment history/balance       | Yes                                                   | Yes, operational member-level access                          |
| Financial reports and expenses            | Full access; manage expenses                          | No full financial reports; limited payment-status information |
| Add/edit exercises                        | Yes                                                   | Yes                                                           |
| Workout notes                             | View/edit/delete all; deletion is soft-delete         | Can add notes; edit/soft-delete own notes only                |
| Public website content                    | Yes                                                   | No                                                            |
| WhatsApp templates                        | Create, edit, delete                                  | View and send existing templates only                         |
| Send predefined WhatsApp messages         | Yes                                                   | Yes, subject to consent/opt-out and platform rules            |
| Notification history                      | All relevant history                                  | Only notifications they sent                                  |
| View all login history                    | Yes                                                   | No                                                            |
| Restore database backup                   | Technical operator only; Admin can view backup status | No                                                            |

# 4. Public Website and Inquiry Management

## 4.1 Public Website Sections

- Home / Welcome

- Membership Plans and Prices

- Trainers

- About the Gym

- Facilities / Gallery

- Contact and Location

- Inquiry / Join Now form

Admin manages gym identity, logo, address, contact details, opening
hours, plans/prices, public Trainer cards and gallery content.

## 4.2 Inquiry Form

| **Field**                 | **Rule**                                                          |
|---------------------------|-------------------------------------------------------------------|
| Full name                 | Required                                                          |
| Phone number              | Required                                                          |
| Age                       | Required                                                          |
| Gender                    | Required; allowed UI values must be defined consistently          |
| Address                   | Required                                                          |
| Preferred membership plan | Visitor selects a displayed plan                                  |
| WhatsApp consent          | Explicit checkbox, unchecked by default; consent history retained |

## 4.3 Inquiry Workflow

1.  Visitor submits the inquiry form.

2.  Server validates the data and checks for a matching phone number.

3.  If a similar inquiry exists, show a duplicate warning but allow
    submission; do not reveal private member information.

4.  New inquiry appears in the Admin Dashboard. Trainers cannot manage
    inquiries.

5.  Admin reviews and updates status: New, Pending, Approved or
    Rejected.

6.  Customer physically visits the gym; Admin verifies details and
    payment.

7.  Admin selects Add Member; the member form is prefilled from the
    inquiry.

8.  Admin completes registration; the system creates a separate member
    record and unique Member ID.

9.  Admin may later permanently delete the original inquiry. This must
    never delete or alter the converted member, membership or payment
    history.

- Public inquiry submission does not create an active member or confirm
  payment.

- WhatsApp consent is carried forward into the member record with its
  source/history.

- Public inquiry endpoint has IP-based rate limiting.

# 5. Member Management

## 5.1 Member Data

- Unique system-generated Member ID (example format GYM-001).

- Full name, phone number, age, gender and address.

- Optional profile photo.

- WhatsApp consent state plus consent/opt-out history.

- Member status: Active, Inactive or Archived.

- Internal Admin notes and linked current/historical memberships,
  payment summaries and workout notes.

## 5.2 Member Operations

- Admin and Trainers can add and edit member personal details.

- Duplicate member registration by phone number is prevented.

- Search by name, phone number or Member ID; filter by membership status
  and registration date.

- Admin can archive and restore members. Trainers can archive/restore
  subject to the same active-membership block.

- Archiving is blocked while the member has an active membership.

- Archived members are excluded from normal dashboard totals and appear
  in reports only when the Admin selects the archived filter.

## 5.3 Member Lifecycle

- When the current membership expires, the member automatically becomes
  Inactive.

- When a new membership is successfully activated, an Inactive member
  automatically returns to Active.

- Archived is a separate administrative record state and must not be
  confused with membership expiry.

- Archiving preserves the member record and Member ID. Restore reuses
  the same record and ID.

## 5.4 Member Photos

- Admin and Trainers may upload and replace member photos.

- Only Admin may permanently remove a member photo.

- Removing a photo does not delete the member record.

- When a photo is replaced or removed, the old Cloudinary asset is
  deleted only after the database change/new asset is safely committed;
  failed cleanup is logged for retry/manual resolution.

# 6. Membership Management

## 6.1 Plans and Pricing

- Admin can create unlimited membership plans and change advertised plan
  prices.

- Membership duration types: Monthly and Custom duration.

- Each plan has an advertised fixed price. Admin may set a
  member-specific custom price; a mandatory reason and activity log are
  required.

- Trainer cannot create plans or change prices. Discounts are not a
  separate feature.

## 6.2 Membership Lifecycle

- Only one current active membership per member is allowed.

- Admin and Trainer may activate memberships.

- At least a partial verified payment is required before activation;
  zero paid amount blocks activation.

- Membership statuses: Pending Activation, Upcoming, Active and Expired.

- Membership expiry is calculated automatically using Asia/Karachi
  calendar dates.

- Calendar-month rule: a one-month membership starting 1 November
  expires 30 November (inclusive).

- Early renewal begins the day after the previous membership expiry;
  late renewal begins on activation date.

- Every renewal creates a new membership record; previous memberships
  remain in history.

- Members cannot change plans before expiry; early cancellation and
  membership pause are not supported.

- Expiry dates are not manually edited; changes are handled through
  renewal/correction workflows.

## 6.3 Expiry and Reactivation

- Member becomes Inactive when membership expires.

- Upcoming expiry widget is shown only on Admin Dashboard.

- Admin configures the number of days before expiry for WhatsApp
  reminders.

- Successful activation of a new membership automatically reactivates an
  Inactive member.

# 7. Payments, Payment Events and Receipts

## 7.1 Methods and Verification

- Supported methods: Cash and Online.

- Online payments are made externally. Staff manually verify evidence
  before recording the amount as paid.

- Pending/unverified amounts do not count toward paid total and do not
  reduce outstanding balance.

- No payment gateway is included.

## 7.2 Main Payment Record and PaymentEntry Ledger

There is one main Payment summary record per membership. Each actual
payment received is represented by a separate internal PaymentEntry
event. This preserves the user's one-payment-summary-per-membership rule
while retaining transaction-level details.

- Main Payment stores total amount due, cumulative verified amount paid,
  remaining balance and current status.

- Each PaymentEntry stores event amount, payment date, method
  (Cash/Online), recording actor and relevant verification details.

- New partial/balance payments append a PaymentEntry and update the same
  main Payment summary.

- Payment statuses: Paid, Unpaid, Partially Paid and Pending. Pending
  remains unverified and is excluded from paid totals.

- Overpayment is blocked. Future-dated payments are blocked; backdated
  payments are allowed.

- Payment correction requires a mandatory reason. Original values and
  correction history are preserved; no silent overwrite.

- Admin and Trainer can record and correct payments within these rules.

- Old and new membership balances remain separate if a member renews
  while an earlier balance remains outstanding.

## 7.3 Activation Rule

A membership cannot be activated until at least some payment is verified
and recorded. A partially paid membership may be activated; the
remaining amount stays outstanding.

## 7.4 Receipts

- Generate a unique receipt for every verified payment event, not merely
  one receipt per membership.

- Each receipt includes unique receipt number, member, membership, event
  amount, cumulative paid amount, remaining balance, method and payment
  date.

- Receipts are downloadable PDFs. First release PDFs are English only.

- Admin and Trainer may share verified payment receipts through
  WhatsApp, subject to consent/opt-out and platform/API capability.

- Receipt sharing is logged. Do not report successful delivery unless
  the API confirms the relevant status.

- WhatsApp media/PDF delivery method must be verified during
  integration; unsupported delivery must fall back to a clearly
  communicated manual process.

## 7.5 Financial Record Deletion

- Admin may separately permanently delete payment records, receipts and
  expenses using approved safeguards.

- No automatic cascading deletion is allowed.

- Deleting a member or membership does not automatically delete payment
  records or receipts.

- Payment history is retained permanently by default unless Admin
  explicitly authorizes a separate deletion.

# 8. Exercise Library and Workout Notes

- Provide a simple list/library of exercises; no advanced workout plans,
  progress tracking or analytics.

- Admin and Trainers may add and edit exercises.

- Any Trainer may add a member-specific workout note.

- A Trainer may edit or delete only notes they authored.

- Admin may view, edit and delete all Trainers' notes.

- Workout-note deletion is soft-delete to preserve history; it is not a
  physical deletion.

- Trainers can view member-specific workout notes within their
  operational permissions.

# 9. Dashboard and Reports

## 9.1 Admin Dashboard

- Total Members, Active Members, Inactive Members and Expired
  memberships.

- Today's collections, monthly income and outstanding payments.

- Trainer summary, active Trainer count and each Trainer's last login.

- Today's new member registrations and new inquiries.

- Upcoming membership expiries and recent payment corrections.

## 9.2 Trainer Dashboard

- Same general visual system, with information restricted to Trainer
  permissions.

- Limited member-level payment status information only; no full
  financial reports.

- No upcoming-expiry widget.

- Trainers cannot access Admin-only inquiry, account, settings or
  financial-report screens.

## 9.3 Dashboard Definitions

| **Metric**       | **Definition**                                       |
|------------------|------------------------------------------------------|
| Total Members    | All non-archived member records, Active and Inactive |
| Active Members   | Members with a currently active membership           |
| Inactive Members | Expired or otherwise inactive members                |
| Expired          | Members inactive due to membership expiry            |
| Archived         | Excluded from normal dashboard totals                |

## 9.4 Reports

- Custom date ranges.

- PDF downloads only.

- Payment reports filter by Cash and Online.

- Income and expenses are shown separately; do not calculate net profit.

- Complete member list export is PDF only.

- Archived members appear only when Admin explicitly selects the
  archived-members filter.

- Full member personal-data export requires password confirmation and is
  logged in Activity Log.

## 9.5 Expense Entry

This is a minimal expense-entry feature, not a full accounting system.

| **Field**           | **Rule**                                                 |
|---------------------|----------------------------------------------------------|
| Title / description | Required                                                 |
| Category            | Rent, Utilities, Salaries, Equipment, Maintenance, Other |
| Amount              | Required; PKR whole rupees only                          |
| Date                | Required; Asia/Karachi date                              |
| Payment method      | Cash or Online                                           |
| Created by          | System-recorded authenticated user                       |

- Admin may create, edit and permanently delete expense records.

- Trainer cannot permanently delete expenses and has no full
  expense-report access.

- Expense deletion requires password re-entry, second confirmation,
  mandatory reason and a minimal deletion audit record.

- Deleted expenses are excluded from future reports; historical report
  snapshots, if any, must be clearly identified as generated at their
  original time.

# 10. WhatsApp Business Integration

## 10.1 Integration and Templates

- Use Meta WhatsApp Cloud API directly; do not use Twilio.

- Sending number will be selected during Meta Business onboarding after
  development.

- Admin can create, edit and delete templates inside the Gym System
  without an internal approval workflow.

- Trainers can view and send existing templates only; they cannot
  create, edit or delete templates.

- Only predefined/template-based messages are allowed; unrestricted
  custom messages are not included.

- Meta platform approval and policy restrictions still apply. In-app
  editability does not guarantee that an edited template can be sent
  through the official API until any required Meta approval is obtained.

- System must not show false success for rejected, unapproved or unsent
  templates.

## 10.2 Automatic Events

- New membership confirmation

- Payment received confirmation

- Membership expiry reminder

- Membership expired notification

Partial-payment and payment-due reminders are not automatic triggers in
the first release.

## 10.3 Consent and Opt-Out

- WhatsApp consent checkbox is unchecked by default on the public
  inquiry form.

- Consent state and changes are retained with timestamps/history.

- Admin can mark a member as opted out.

- Opt-out blocks both automatic and manual sends, including receipt
  sharing.

- Respect applicable WhatsApp messaging windows, approved template
  requirements and platform policies.

## 10.4 Retries and Status

- Retry temporary/transient failures every 15 minutes, up to 3 retries.

- Do not retry invalid phone numbers, rejected templates, opt-out cases
  or other permanent failures.

- After retries are exhausted, mark the notification Failed and log the
  final status.

- Store provider message identifiers and webhook statuses where
  available.

- Do not promise delivered/read status unless the API actually provides
  it.

- Trainer sees only notifications they sent; Admin can view all relevant
  history.

# 11. Authentication, Security and Audit

## 11.1 Accounts and Login

- Only Admin and Trainer accounts can authenticate; members have no
  accounts.

- Multiple Admin accounts are allowed.

- Login supports email/password or username/password according to the
  configured account identity.

- Secure persistent sessions expire after 90 days of inactivity; manual
  logout is supported.

- Multiple-device login is allowed. Admin can force-log out a Trainer
  across all devices.

- Use secure httpOnly cookies and secure session/refresh-token rotation
  and revocation.

- Deactivated Trainer accounts immediately lose access and all active
  sessions are terminated.

- Trainer cannot change their own password; Admin manages Trainer
  password resets.

## 11.2 Password Policy and Recovery

- Minimum password length: 12 characters.

- Reject common and easily guessable passwords.

- Require current password when changing one's own password where that
  feature is available.

- Provide secure email-based password reset.

- Passwords must be stored using a modern password-hashing algorithm;
  never store plaintext passwords.

## 11.3 Login and Public Endpoint Protection

- Progressive delays for repeated failed login attempts; do not
  permanently lock out legitimate users.

- Apply IP-based rate limiting to the public inquiry endpoint.

- Validate and authorize all operations on the server, not only in the
  frontend.

- Use HTTPS, secure headers, safe CORS/CSRF configuration, input
  validation and output handling.

- Keep secrets in environment/secret management, never in source
  control.

## 11.4 Two-Factor Authentication

Two-factor authentication is not included in the first release. Normal
secure login and the approved security controls remain mandatory.

## 11.5 Initial Admin Provisioning

- Use a secure one-time Admin setup token.

- The first Admin sets their own email/identity and password.

- After the first Admin is created, the setup token is permanently
  disabled.

- No hardcoded default Admin credentials.

## 11.6 Trainer Account Lifecycle

- Admin creates and manages Trainer accounts.

- Admin may deactivate a Trainer; deactivation revokes active sessions
  immediately and preserves historical records.

- Admin may permanently delete Trainer account access/profile, but
  historical records, payments, notes and activity history must remain
  preserved and independently attributable (using a retained historical
  actor reference or anonymized identity as appropriate).

- Deleting a Trainer account must not cascade-delete historical business
  records.

## 11.7 Audit and Retention

- Log important Admin and Trainer actions, payment corrections,
  sensitive exports, template changes, account deactivation, force
  logout and permanent deletion.

- Activity Logs: 2-year default retention.

- Login History: 2-year default retention.

- Payment History: permanent default retention.

- Admin may separately authorize permanent deletion of records under the
  deletion safeguards; retention defaults do not prohibit an authorized
  deletion.

- Minimal deletion audit record is preserved permanently and contains
  only actor, timestamp, record type and reason; it must not retain the
  deleted record's personal data.

# 12. Permanent Deletion and Data Integrity

## 12.1 Safeguards for Every Permanent Deletion

10. Require Admin password re-entry.

11. Show a clear second confirmation identifying the record type and
    consequences.

12. Require a mandatory deletion reason.

13. Write a minimal permanent deletion audit record containing actor,
    date/time, record type and reason, without copying deleted personal
    data.

14. Check dependencies and show linked records before deletion.

## 12.2 Deletion Rules by Record Type

| **Record**             | **Policy**                                                                                                                                |
|------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|
| Inquiry                | Admin may permanently delete, including after conversion; converted member and all its history remain independent.                        |
| Member                 | Admin may permanently delete only after linked records are separately handled; block deletion while dependent records remain. No cascade. |
| Membership             | Admin may separately delete under safeguards after dependencies are handled; no automatic deletion of payment/receipt records.            |
| Payment / PaymentEntry | Admin may separately permanently delete under safeguards; no automatic cascade.                                                           |
| Receipt                | Admin may separately permanently delete under safeguards; no automatic cascade.                                                           |
| Expense                | Admin may permanently delete under safeguards; excluded from future reports.                                                              |
| Workout note           | Soft-delete only in normal application workflow; retain history.                                                                          |
| Trainer account        | Admin may delete account access/profile while preserving historical business records.                                                     |
| Member photo           | Only Admin may permanently remove; member record remains intact; remove corresponding Cloudinary asset after safe state change.           |

Member deletion dependency rule: the system must display linked
memberships, payments, receipts, notes and other dependent records.
Admin must separately handle records that are independently deletable.
If any protected dependency remains, block member deletion and explain
why. Never silently detach or cascade-delete records.

## 12.3 Inquiry Conversion Independence

Inquiry and converted Member are separate records. Deleting the inquiry
must not delete, modify or invalidate the member, memberships, payments,
receipts or history.

## 12.4 No Automatic Cascading

Deleting a parent record never automatically deletes linked financial or
historical records. The application must use explicit dependency checks
and separately authorized operations.

# 13. UI/UX and Accessibility

- Modern SaaS dashboard design; clean, professional visual language.

- Light and dark modes.

- Desktop uses a collapsible left sidebar; mobile uses compact
  navigation rather than a forced desktop sidebar.

- Mobile-first design target; ensure excellent forms, cards and touch
  interactions on phones.

- Touch targets should be comfortably usable (target approximately 44px
  where practical).

- Tables may scroll horizontally without breaking the page layout.

- Use charts only where they improve understanding; avoid overcrowded
  mobile screens.

- Provide loading, empty, success and error states; clear validation and
  confirmation flows.

- Maintain readable contrast and consistent spacing/typography in both
  themes.

| **Device**   | **Expected behavior**                                                                    |
|--------------|------------------------------------------------------------------------------------------|
| Mobile phone | Primary design target; compact navigation, stacked cards, easy forms and touch controls. |
| Tablet       | Adapted layouts with efficient use of available width.                                   |
| Desktop      | Full dashboard with collapsible sidebar, richer tables and charts.                       |

# 14. Technical Architecture

| **Layer**           | **Selected technology / service**     |
|---------------------|---------------------------------------|
| Frontend            | React + Vite                          |
| Language            | JavaScript                            |
| Styling             | Tailwind CSS                          |
| Backend             | Node.js + Express.js                  |
| API                 | REST                                  |
| Database            | MongoDB Atlas                         |
| State management    | React Context API                     |
| Forms               | React Hook Form                       |
| Validation          | Zod; server-side validation mandatory |
| Frontend hosting    | Vercel                                |
| Backend hosting     | Render                                |
| Image storage       | Cloudinary                            |
| WhatsApp            | Meta WhatsApp Cloud API               |
| Currency / timezone | PKR / Asia-Karachi                    |

## 14.1 Application Structure

- Public React website for landing pages and inquiry submission.

- Authenticated React dashboard with role-specific Admin and Trainer
  views.

- Express REST API for authentication, authorization, validation and
  business rules.

- MongoDB Atlas for application records and indexes.

- Background worker/scheduler for expiry processing, notification
  triggers/retries and backup orchestration.

- Separate development, staging and production environments.

## 14.2 Operational Notes

- Confirm current pricing, free-tier limits, background worker support,
  storage limits and service terms before production deployment.

- Use a staging environment before production releases.

- Use HTTPS everywhere in production.

- Store all credentials and tokens in environment/secret management.

- Custom domain will be decided after development; use the temporary
  Vercel URL during development/testing.

- Backups: automatic scheduled weekly backups, 8-week retention. Admin
  can view backup status. Restore is performed by the technical
  operator, not through a normal Admin dashboard control.

- Test restoration periodically in a safe environment and document
  rollback/recovery steps.

# 15. Conceptual Data Model

| **Entity**           | **Purpose / key data**                                                                                         |
|----------------------|----------------------------------------------------------------------------------------------------------------|
| User                 | Admin/Trainer identity, username/email, password hash, role, active state, session/version metadata.           |
| Member               | Member ID, personal details, phone, address, age, gender, photo asset, status, consent state.                  |
| Inquiry              | Submitted details, preferred plan, status, consent snapshot, duplicate-warning metadata, conversion reference. |
| MembershipPlan       | Name, duration type/value, advertised price, active state.                                                     |
| Membership           | Member, plan snapshot, dates, agreed/custom price, status, activation metadata and history.                    |
| Payment              | One summary per membership: total due, cumulative paid, balance and status.                                    |
| PaymentEntry         | Each verified payment event: amount, date, method, actor and verification details.                             |
| PaymentCorrectionLog | Original/new values, reason, actor, timestamp and affected event/summary.                                      |
| Receipt              | Unique receipt number, payment event, member/membership, event amount, cumulative paid and balance.            |
| Exercise             | Name, description/instructions, created/updated by.                                                            |
| WorkoutNote          | Member, note text, author, timestamps and soft-delete metadata.                                                |
| Expense              | Title, category, amount, date, method and created-by user.                                                     |
| NotificationTemplate | Name, event type, content/variables, enabled state and updated-by user.                                        |
| Notification         | Recipient, template, source, status, retry count, sender, provider IDs and timestamps.                         |
| ConsentHistory       | Member/inquiry, consent or opt-out change, source, actor and timestamp.                                        |
| ActivityLog          | Actor, action, target type, timestamp, reason and safe before/after summary.                                   |
| LoginHistory         | User, login result, timestamp and appropriate device/session metadata.                                         |
| GymSettings          | Gym identity, contact, hours, logo, language and expiry reminder settings.                                     |
| GalleryAsset         | Image storage key/URL, caption/order and created-by user.                                                      |

## 15.1 Data Integrity Rules

- Member IDs and receipt numbers are unique.

- Membership references a valid member.

- Only one current active membership per member.

- One Payment summary per membership; multiple PaymentEntry events may
  belong to that summary.

- Payment corrections and deletions are auditable.

- Historical membership and financial records remain traceable.

- Deleting an inquiry never deletes a converted member.

- Opted-out members are excluded from all manual and automatic WhatsApp
  sends.

- Deactivated users cannot retain usable sessions.

- All dates and scheduled jobs use Asia/Karachi business-date rules.

# 16. API and Workflow Requirements

The API must be RESTful, versionable and protected by server-side role
authorization. The following are functional areas, not a final endpoint
contract.

| **Area**         | **Expected operations**                                                                                                     |
|------------------|-----------------------------------------------------------------------------------------------------------------------------|
| Authentication   | Login, logout, current user, password reset, first Admin setup, force logout.                                               |
| Users/Trainers   | Create, edit, deactivate, delete access/profile while preserving history.                                                   |
| Members          | List/search, create, view, update, archive, restore, photo upload/replace/remove, dependency check and authorized deletion. |
| Inquiries        | Public submission, Admin list/status updates, conversion, duplicate warning, authorized deletion.                           |
| Memberships      | Plans, renewals, activation, expiry processing, membership history.                                                         |
| Payments         | Payment summary, add PaymentEntry, correct, balance calculation, event receipt generation and separate deletion.            |
| Exercises/Notes  | Exercise CRUD; notes add/edit/soft-delete according to author/Admin permissions.                                            |
| WhatsApp         | Template management, send existing template, webhook status, retries, consent/opt-out enforcement.                          |
| Reports/Expenses | PDF reports, date filters, payment method filters, expense create/edit/delete.                                              |
| Settings/Audit   | Gym settings, activity logs, login history, backup status.                                                                  |

All endpoint names, request/response schemas, pagination, filters,
validation errors and authorization rules must be finalized in the
implementation API specification.

# 17. Non-Functional Requirements

| **Attribute**   | **Requirement**                                                                                                |
|-----------------|----------------------------------------------------------------------------------------------------------------|
| Performance     | Responsive common operations on typical mobile networks; paginate large lists and optimize images.             |
| Availability    | Use production-appropriate hosting and document service dependencies; no numeric uptime SLA has been approved. |
| Security        | HTTPS, password hashing, secure sessions, server-side validation and authorization, protected secrets.         |
| Privacy         | Restrict personal data by role; log sensitive exports and administrative changes.                              |
| Usability       | Mobile-first, clear navigation, consistent forms and accessible light/dark themes.                             |
| Scalability     | Support expected single-gym usage and reasonable future growth.                                                |
| Maintainability | Modular code, documented API, automated tests and staging/production separation.                               |
| Localization    | English and Urdu UI; English-only PDFs in first release; PKR and Asia/Karachi.                                 |
| Reliability     | Backup/restore process, notification retries, audit history and safe deletion.                                 |

# 18. Testing and Acceptance Criteria

- Unit tests for membership dates, payment calculations, balances,
  retries, permission helpers and validation.

- API integration tests for authentication, authorization, deletion
  dependencies and data integrity.

- Frontend tests for role-based navigation, forms, responsive states and
  critical workflows.

- End-to-end tests for inquiry conversion, member registration,
  membership activation, partial payment, receipt creation, WhatsApp
  opt-out and reporting.

- Test mobile, tablet and desktop layouts in light and dark themes.

- Test session expiry, force logout, Trainer deactivation and password
  reset.

- Test backup retention and restore in a non-production environment.

- Test Cloudinary upload/replacement/removal cleanup behavior.

- Test WhatsApp template rejection, consent, permanent failures,
  transient retries and webhook status.

## 18.1 Core Acceptance Scenarios

15. Visitor submits a valid inquiry and it appears only in Admin
    workflow.

16. Duplicate inquiry phone triggers a warning but submission remains
    possible without exposing private records.

17. Admin converts an inquiry; member fields are prefilled.

18. Deleting the original inquiry does not affect converted member or
    any history.

19. Admin and Trainer can add/edit members within permissions; duplicate
    phone registration is prevented.

20. Member IDs are unique; photo upload/replace works for Admin and
    Trainer; photo removal is Admin-only.

21. Archive is blocked while an active membership exists; restore reuses
    the same member record and ID.

22. Admin can create plans and set custom member pricing with
    reason/audit.

23. Admin and Trainer can activate only after a verified partial-or-full
    payment exists.

24. Membership date calculations follow calendar-month and Asia/Karachi
    rules.

25. Expiry makes member Inactive; successful new activation reactivates
    the member.

26. Each renewal creates a new membership record and preserves earlier
    history.

27. Each membership has one Payment summary; each receipt-worthy payment
    event has its own PaymentEntry and receipt.

28. Pending/unverified payment does not reduce outstanding balance.

29. Overpayment and future-dated payment are blocked; corrections
    require reason and preserve history.

30. Workout-note author permissions and Admin override work; note
    deletion is soft-delete.

31. Admin alone can manage WhatsApp templates; Trainer can only
    view/send existing templates.

32. Opt-out blocks all automatic/manual WhatsApp sends and receipt
    sharing.

33. Temporary WhatsApp failures retry at 15-minute intervals up to three
    times; permanent failures do not retry.

34. Trainer sees only notifications they sent; Admin sees relevant full
    history.

35. Reports support custom date range, PDF output and Cash/Online
    filters; income and expenses remain separate.

36. Admin can export member data only as PDF after password
    confirmation; export is logged.

37. Permanent deletion safeguards, dependency checks and no-cascade
    rules are enforced.

38. Trainer deactivation revokes sessions; deleting Trainer account
    access preserves historical records.

39. Admin Dashboard shows upcoming expiries and Trainer summary; Trainer
    Dashboard omits upcoming-expiry widget.

40. Backups run weekly, retain eight weeks and can be restored by the
    technical operator.

# 19. Backup, Recovery and Deployment

- Automatic scheduled weekly database backups with 8-week retention.

- Admin can view backup status; technical operator performs restore.

- Restore actions are protected, confirmed and logged in the operational
  runbook.

- Restore must be tested periodically in a safe environment.

- Separate staging and production environments.

- Use Vercel for frontend, Render for backend, MongoDB Atlas for
  database and Cloudinary for image storage, subject to current plan
  limits and cost validation.

- Custom domain is deferred until after development.

- WhatsApp sender number is deferred until Meta onboarding.

- Keep deployment, environment setup, rollback, backup and recovery
  instructions documented.

# 20. Development Phases and Approval Gate

| **Phase**                             | **Scope / deliverables**                                                                                                                                                            |
|---------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 0 — Final SRS review and approval     | Resolve document conflicts, approve assumptions and explicitly approve SRS. No coding before approval.                                                                              |
| 1 — Foundation                        | Monorepo, environments, design system/themes, responsive shell, authentication, sessions, role middleware, audit/login infrastructure, settings model and secure first Admin setup. |
| 2 — Core data and public website      | Plans, public pages, content management, gallery and inquiry workflow.                                                                                                              |
| 3 — Members                           | Member registration/ID, profile, search, archive/restore, consent, inquiry conversion and photos.                                                                                   |
| 4 — Memberships                       | Plans, custom price, renewals, activation, expiry, history and reactivation.                                                                                                        |
| 5 — Payments                          | Payment summary, PaymentEntry ledger, balances, corrections, receipts and PDF output.                                                                                               |
| 6 — Trainer experience                | Trainer dashboard, exercises, workout notes and account lifecycle.                                                                                                                  |
| 7 — WhatsApp                          | Meta Cloud API, templates, triggers, consent/opt-out, retries, webhooks and receipt sharing.                                                                                        |
| 8 — Dashboard, reports and expenses   | Role dashboards, statistics, PDF reports, expense entry and deletion.                                                                                                               |
| 9 — Settings and operational security | Exports, retention, deletion safeguards, backup status, restore runbooks, force logout and hardening.                                                                               |
| 10 — QA, deployment and handover      | Security/mobile/theme testing, staging, user acceptance, production deployment and documentation.                                                                                   |

## 20.1 Required Handover Documents

- README.md

- PROJECT_STATUS.md

- HANDOVER.md

- CHANGELOG.md

- NEXT_STEPS.md

- docs/SRS.md

- docs/API.md

- docs/DEPLOYMENT.md

- docs/BACKUP_RESTORE.md

- docs/SECURITY.md

## 20.2 Approval Gate

The user has explicitly approved this SRS as the development baseline.
Phase 1 development still starts only on the user's explicit instruction. Any requirement change after
approval must be recorded and assessed for scope, schedule,
architecture, security and testing impact.

# Appendix A — Consolidated Decision Register

| **Topic**          | **Confirmed decision**                                                                                                                                           |
|--------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Product            | Single gym; public website plus Admin/Trainer dashboard; no member login.                                                                                        |
| Design             | Mobile-first; modern SaaS; light/dark; collapsible desktop sidebar; compact mobile navigation.                                                                   |
| Languages          | English and Urdu UI; English PDFs first release.                                                                                                                 |
| Currency/timezone  | PKR whole rupees; Asia/Karachi.                                                                                                                                  |
| Inquiry            | Admin-only management/conversion; duplicate warning but allow; WhatsApp consent explicit; original inquiry can be deleted independently.                         |
| Member             | Admin/Trainer create/edit; Admin/Trainer archive and restore; archiving blocked while an active membership exists; automatic Inactive on expiry and Active after new activation. |
| Photos             | Admin/Trainer upload/replace; Admin-only permanent removal.                                                                                                      |
| Membership         | Monthly/custom; unlimited plans; Admin-only plan/pricing; Admin custom price with reason; one active; early renewal starts after expiry; new record per renewal. |
| Activation         | Admin/Trainer; at least partial verified payment required.                                                                                                       |
| Payments           | One summary per membership plus PaymentEntry ledger; partial payments; no overpayment; corrections reason/audit; backdate allowed, future date blocked.          |
| Receipts           | One unique receipt per verified payment event; PDF; Admin/Trainer can share through WhatsApp.                                                                    |
| Workout notes      | Trainer adds; author edits/deletes own; Admin manages all; soft-delete.                                                                                          |
| WhatsApp           | Meta Cloud API; editable templates without internal approval workflow; Admin CRUD; Trainer view/send; platform approval still applies.                           |
| WhatsApp retries   | Temporary errors: every 15 minutes, maximum 3 retries; permanent failures do not retry.                                                                          |
| Expenses           | Minimal fields and defined categories; Admin manage/delete; safeguards apply.                                                                                    |
| Dashboard          | Upcoming expiry only Admin; Admin sees Trainer count/last login; role-specific financial visibility.                                                             |
| Reports            | Custom dates; PDF only; Cash/Online filter; income/expenses separate; no net profit; archived only by filter.                                                    |
| Security           | 90-day inactivity expiry; httpOnly secure sessions; progressive failed-login delay; inquiry IP rate limit; 12-character minimum; no 2FA.                         |
| Admin provisioning | One-time setup token, disabled permanently after first Admin.                                                                                                    |
| Trainer accounts   | Admin deactivate; sessions terminated; account/profile deletion preserves historical records.                                                                    |
| Retention          | Activity and login history 2 years by default; payment history permanent by default; authorized Admin deletion remains possible.                                 |
| Deletion           | Admin may separately delete records with password re-entry, second confirmation, mandatory reason and minimal permanent deletion audit; no cascading deletion.   |
| Backups            | Weekly automatic; 8-week retention; Admin status view; technical operator restore.                                                                               |
| Hosting            | Vercel, Render, MongoDB Atlas, Cloudinary; validate costs/limits.                                                                                                |
| Deferred           | Custom domain after development; WhatsApp sender number during Meta onboarding.                                                                                  |

# Appendix B — Items to Verify During Technical Planning

- Exact Vercel, Render, Atlas and Cloudinary plan limits, pricing,
  regional availability and background-worker suitability at deployment
  time.

- Meta Business onboarding, sender number, template approval, messaging
  window and media/PDF delivery constraints.

- Email provider and deliverability configuration for password reset.

- Exact backup mechanism, encryption, restore point objectives and
  operator runbook.

- Final allowed gender values and exact custom-duration input units.

- Whether report snapshots are stored or generated on demand; ensure
  historical exports are clearly dated.

- Browser/version support matrix and production performance targets.
