Phoenix Suite

Phoenix Suite — Technical Specification

Architecture, API reference, and deployment documentation

Version 1.0 · April 2026 · Phoenix Suite

Phoenix Suite — Technical Specification

Version: 1.0.0

Last Updated: 11 April 2026

Document Type: Comprehensive Technical Specification


1. Executive Summary

Phoenix Suite is a multi-tenant Software-as-a-Service (SaaS) platform for managing gyms, dojos, martial arts schools, and fitness studios. It provides a complete business management solution including student/member management, class scheduling, attendance tracking, point of sale, subscription billing, marketing, public websites, grading/belt progression, exercise program design, accounting integration, and reporting.

The platform is built with a modular licensing architecture where organisations selectively purchase modules based on their needs, managed through a centralised license portal.


2. Architecture Overview

2.1 System Components

ComponentTechnologyPortPurpose
DatabasePostgreSQL 165432Primary data store
API ServerNode.js + Express4000REST API backend
Admin PortalReact 183002Staff/admin web application
License PortalReact 183001Super-admin license management
Public SiteReact 183003Per-org public websites

2.2 Technology Stack

Backend:

Frontend:

2.3 Multi-Tenancy Model

Every data table includes an org_id column referencing the organizations table. The scopeToOrg middleware extracts the org ID from the JWT token and attaches it to req.orgId. All queries filter by org_id to ensure complete data isolation between organisations.

2.4 Authentication & Authorisation

Token Strategy:

User Roles:

Permission Tags (staff_permissions table):

Additional Auth:


3. Module System

3.1 Licensable Modules

ModuleEnum ValueDescription
BasebaseAlways included. Students, classes, payments, messaging, contracts, forms, inventory, equipment
Martial Artsmartial_artsMulti-discipline rank progression, gradings, syllabus, belt/sash/patch systems
FitnessfitnessExercise library, plan builder, programs, body metrics, training goals
MarketingmarketingEmail/SMS campaigns, events, templates, notification log
WebsitewebsitePublic-facing website CMS, blog, trial signup, contact forms

Modules are gated by the requireModule(moduleType) middleware. The License Portal (super_admin) issues module licenses per organisation with configurable student/staff caps, pricing, and expiry dates.


4. Database Schema

4.1 Migration History

The database evolves through numbered migration files (001-025) applied in order:

MigrationTables/Changes
001Core: organizations, users, student_profiles, subscriptions, payments, account_ledger, classes, class_enrollments, class_attendance, belt_records, gradings, body_measurements, training_programs, access_tokens, equipment, inventory, conversations, messages, contracts, forms, licenses
002Exercise library: exercises, exercise_plans, exercise_plan_sections, exercise_plan_items, student_exercise_plans, student_exercise_log
003Class sessions: class_sessions, class_session_attendance, waitlist support on enrollments
004Belt progression: belt_requirements, syllabus_items, student_syllabus_progress
005Class plan history
006Multi-discipline: martial_art_disciplines, discipline_ranks, student_disciplines. Renamed belt_records→rank_records, belt_requirements→rank_requirements. Dropped belt_rank enum.
007Programs: programs, program_plans, program_assignments, practitioner_access
008Exercise groups: exercise_item_groups (supersets, circuits)
009Rank dan/bar field
010Rank stripe field
011Subscription plans: subscription_plans, plan_discount_rules
012Plan-class linking: plan_classes, class enrollment source tracking
013Staff permissions: staff_permissions with permission tags
014Inventory variants: inventory_variants (size/stock breakdown)
015Shop/POS: org_order_sequences, orders, order_items, refunds, refund_items. GST/account settings on org.
016Grading invitations: testing_fee, invitation_status, payment linking
017Tenancy hardening: added org_id to all join tables missing it
018Per-org rate limiting settings
019Attendance & metrics: student_preferences, kiosk_sessions, measurement_goals, enhanced body measurements
020Stripe integration: Stripe config on org, payment references across tables
021Public site: site_settings, blog_posts, trial_signups, contact_submissions, instructor_profiles
022Marketing: notification_log, notification_templates, marketing_campaigns, special_events, event_bookings
023Enhanced contracts: merge fields, witness/guardian, form field types
024Contract/form assignments
025Accounting: accounting_config, account_mappings, journal_entries, depreciation_schedules

4.2 Key Relationships

``

organizations

├── users (role: super_admin, admin, staff, student)

│ └── staff_permissions

├── student_profiles

│ ├── student_subscriptions → subscription_plans

│ ├── student_disciplines → martial_art_disciplines → discipline_ranks

│ ├── rank_records (progression history)

│ ├── class_enrollments → classes → class_sessions → class_session_attendance

│ ├── program_assignments → programs → program_plans → exercise_plans

│ ├── body_measurements, measurement_goals

│ ├── grading_candidates → gradings

│ ├── contract_signatures, form_submissions

│ ├── event_bookings → special_events

│ └── orders → order_items → inventory → inventory_variants

├── martial_art_disciplines → discipline_ranks

├── classes → class_sessions → class_session_attendance

├── subscription_plans → plan_discount_rules, plan_classes

├── programs → program_plans → exercise_plans → sections → groups → items → exercises

├── inventory → inventory_variants, inventory_transactions

├── marketing_campaigns → notification_log

├── site_settings, blog_posts, trial_signups, contact_submissions

├── accounting_config, account_mappings, journal_entries, depreciation_schedules

└── licenses (per-module with caps, pricing, expiry)

`


5. API Architecture

5.1 Route Files

FileMount PointAuthPurpose
auth.js/api/authPublic/AuthLogin, register, refresh, logout, me
students.js/api/studentsAuth+StaffStudent CRUD with subscription management
resources.js/api/*AuthEquipment, inventory, classes, contracts, forms, messages, payments, martial arts, fitness, org settings, staff management
exercises.js/api/exercises, /api/exercise-plansAuthExercise library, plan builder with sections/groups/items
disciplines.js/api/disciplinesAuth+MADiscipline and rank CRUD, student enrollment
belt-progression.js/api/belt-progressionAuth+MARequirements, syllabus, eligibility, readiness, gradings with invitations
programs.js/api/programsAuthProgram CRUD, plan linking, student assignment
subscription-plans.js/api/subscription-plansAuthPlan templates, discount rules, class linking, price calculation
shop.js/api/shopAuthPOS orders, products, refunds, receipts, account balance
stripe.js/api/stripeAuth/WebhookCheckout sessions, subscription billing, customer portal, webhooks
checkin.js/api/checkinAuth/KioskKiosk management, photo-tap check-in, token scan, self check-in, attendance dashboard, access tokens, body metrics, measurement goals, student preferences
marketing.js/api/marketingAuth+MktCampaigns, events, bookings, templates, notification log, quick send
public.js/api/publicPublicSite data, blog, trial signup, contact forms
site-admin.js/api/site-adminAuth+WebCMS content, blog CRUD, trial leads, contacts, instructors
contracts-forms.js/api/cfAuthContract signing with merge fields, form submission with field validation, assignments, outstanding tracking, template seeding
reports.js/api/reportsAuth+Admin7 report types, CSV export, PDF export
accounting.js/api/accountingAuth+AdminConfig, mappings, journal generation, sync, depreciation
practitioner-auth.js/api/practitionerPublic/AuthCode generation, practitioner login, therapeutic program access
licenses.js/api/licensesSuperAdminLicense management across all organisations

5.2 Middleware Stack

  1. helmet() — Security headers
  2. cors() — Configurable CORS origins
  3. Stripe webhook raw body parser (before JSON)
  4. express.json() — JSON body parsing (10MB limit)
  5. morgan('combined') — Request logging
  6. orgRateLimit('api') — Per-org rate limiting
  7. Route-level: authenticate, scopeToOrg, requireRole(), requireModule()

6. Frontend Architecture

6.1 Admin Portal Pages

PageRouteDescription
DashboardPage/dashboardOverview stats and quick actions
StudentsPage/studentsStudent list with plan-based subscription picker
StudentDetailPage/students/:idProfile, rank history, syllabus checklist, body metrics, subscriptions
PaymentsPage/paymentsOverview, subscription plans manager, subscriptions, transaction history
MessagesPage/messages2-way messaging with auto-refresh
ContractsPage/contractsContract templates with merge fields, signing, assignments
FormsPage/formsForm builder with 11 field types, submissions, review
ClassesPage/classesClass CRUD, weekly schedule, sessions, enrollment, attendance, workout assignment
ExerciseLibraryPage/exercisesSearchable exercise catalog
MartialArtsPage/martial-arts/*Multi-discipline: ranks, readiness, gradings, syllabus, requirements, plans
FitnessPage/fitness/*Programs, exercise plans, body metrics
EquipmentPage/equipmentEquipment lifecycle management
InventoryPage/inventoryStock with colour/brand/size variants
ShopPage/shopPOS with cart, checkout, orders, refunds
ReportsPage/reports7 report types with CSV/PDF export
AccountingPage/accountingXero/MYOB/QBO/CSV, account mapping, journals, depreciation
MarketingPage/marketing/*Campaigns, events, templates, send log
WebsitePage/websiteCMS: branding, content, SEO, blog, instructors, leads
SettingsPage/settingsOrg details, GST, Stripe, email, SMS, attendance, rate limits, kiosk devices, staff management with permissions

6.2 Student Portal Pages

PageRouteDescription
StudentDashboard/studentOverview
StudentClasses/student/classesSchedule, enrolled classes with self check-in, attendance history
StudentGradings/student/gradingsGrading invitations, fee payment, results
StudentPrograms/student/programsAssigned exercise programs, practitioner access codes
StudentStore/student/storeBrowse/purchase inventory with cart
StudentDocuments/student/documentsPending contracts (sign with canvas), forms (fill with field types), submission history
StudentProfile/student/profilePersonal details
StudentMessages/student/messages2-way messaging with staff
StudentBilling/student/billingPayment history

6.3 Public/Kiosk Pages (no auth guard)

PageRouteDescription
LoginPage/loginEmail/password login
KioskPage/kioskPhoto-tap/RFID check-in screen
WorkoutDisplayPage/workout-displayGroup workout display + Tabata/AMRAP/EMOM/countdown timers

6.4 Shared Components


7. Key Features Detail

7.1 Multi-Discipline Martial Arts

7.2 Exercise Plan System

`

Exercise Library (shared catalog)

└── Exercise Plans

└── Sections (Warmup, Main, Cooldown)

├── Exercise Groups (superset, circuit, straight)

│ ├── Group config: rounds, rest between rounds, timed/reps

│ └── Exercises: sets, reps, duration, rest, weight notes

└── Standalone Exercises

Programs (containers)

├── Type: personal, group, therapeutic

├── Linked Plans via program_plans (day labels)

└── Assigned to students via program_assignments

`

7.3 Subscription Plans & Billing

7.4 Shop / Point of Sale

7.5 Attendance System

7.6 Accounting Integration

7.7 Public Website


8. Security

8.1 Implemented

8.2 Recommended for Production


9. Deployment

9.1 Docker Compose Services

5 containers: db (PostgreSQL 16), api (Node.js), frontend (Nginx), license-portal (Nginx), public-site (Nginx)

9.2 Environment Variables

`

DATABASE_URL, JWT_SECRET, JWT_EXPIRY, CORS_ORIGIN, PORT,

LICENSE_MASTER_KEY, XERO_CLIENT_ID, XERO_CLIENT_SECRET,

MYOB_CLIENT_ID, MYOB_CLIENT_SECRET, QBO_CLIENT_ID, QBO_CLIENT_SECRET

`

9.3 Minimum Requirements

2GB RAM, 2 vCPU, 20GB SSD. Estimated cost: $12-24/month on DigitalOcean/Vultr.


10. File Structure

`

phoenix-suite/

├── docker-compose.yml

├── .env.example

├── docs/

│ ├── TECHNICAL_SPECIFICATION.md

│ └── USER_GUIDE.md

├── backend/

│ ├── Dockerfile

│ ├── package.json

│ ├── migrations/ (001-025)

│ └── src/

│ ├── index.js

│ ├── config/db.js

│ ├── middleware/

│ │ ├── auth.js

│ │ ├── errors.js

│ │ └── rateLimiter.js

│ ├── routes/

│ │ ├── auth.js, students.js, resources.js

│ │ ├── exercises.js, disciplines.js, belt-progression.js

│ │ ├── programs.js, subscription-plans.js

│ │ ├── shop.js, stripe.js

│ │ ├── checkin.js, marketing.js

│ │ ├── public.js, site-admin.js

│ │ ├── contracts-forms.js, reports.js, accounting.js

│ │ ├── practitioner-auth.js, licenses.js

│ │ └── ...

│ └── utils/

│ ├── discount-calculator.js

│ ├── plan-enrollment.js

│ ├── stripe-client.js

│ ├── email-service.js

│ ├── sms-service.js

│ ├── journal-generator.js

│ └── accounting-client.js

├── frontend/

│ ├── Dockerfile, nginx.conf, package.json

│ ├── public/ (PhoenixLogo.png, favicons, index.html)

│ └── src/

│ ├── index.js, App.js, api.js, responsive.css

│ ├── context/ (AuthContext.js, ThemeContext.js)

│ ├── components/ (UI.js, PlanBuilder.js, SubscriptionPlansManager.js, WeeklySchedule.js)

│ └── pages/

│ ├── AdminLayout.js, StudentLayout.js, LoginPage.js

│ ├── AdminPages.js (Payments, Messages, Contracts, Forms, Inventory, Equipment, Classes, MartialArts, Fitness, Settings)

│ ├── DashboardPage.js, StudentsPage.js, StudentDetailPage.js

│ ├── ExerciseLibraryPage.js, ShopPage.js, ReportsPage.js

│ ├── AccountingPage.js, MarketingPage.js, WebsitePage.js

│ ├── KioskPage.js, WorkoutDisplayPage.js

│ └── student/ (Dashboard, Classes, Gradings, Programs, Store, Documents, Profile, Messages, Billing)

├── license-portal/ (separate React app)

│ └── src/ (App.js, api.js)

└── public-site/ (separate React app)

└── src/ (App.js with template engine + SEO)

``


This document describes the complete system as built. For usage instructions, see the User Guide.