How akshit926/toastmasters works
1. System shape
- This repo is a three-part system: a static browser frontend in frontend/, an Express/Node backend in backend/, and a MySQL database managed through SQL scripts in backend/database/.
- The backend is the application boundary: it serves the UI, exposes REST endpoints, performs workflow logic, sends emails, and persists state.
2. Frontend boundary
- The frontend is plain HTML/CSS/JavaScript, not a SPA framework.
- Key entry pages suggest distinct user roles and flows: index.html, form.html, member.html, admin.html, roles.html, contacts.html-style flows via scripts, plus informational pages like what-to-expect.html and access.html.
- Frontend JS files (form.js, member.js, admin.js, roles.js, script.js) call backend APIs directly and render role-specific actions and status.
3. Backend runtime
- backend/server.js is the central Express bootstrap: it wires middleware, routes, static file serving, CORS, and startup behavior.
- The backend is organized by responsibility:
- routes/ for HTTP routing
- controllers/ for request handling and business rules
- services/ for reusable integrations like email
- config/ for database connection setup
- database/ for schema and migration logic
4. Member onboarding flow
- Member registration originates from the frontend form and hits routes/members.js → controllers/memberController.js.
- The flow persists member data in MySQL, then likely triggers a notification through services/emailService.js.
- The readme’s “Customer ID-based login” and frontend/member.js indicate members later authenticate or identify themselves using a customer/member ID to view assigned roles.
5. Role allocation workflow
- Role requests are handled through routes/roles.js → controllers/roleController.js.
- The data model includes a workflow state machine: Pending → Approved → Assigned, with branches for Rejected and Cancelled.
- This is the core approval boundary in the system: members request a role, admins decide, and the backend updates assignment status accordingly.
6. Admin control plane
- frontend/admin.html and frontend/admin.js implement the admin dashboard for reviewing and acting on role requests.
- Admin operations exposed by roles.js include approve/reject and cancellation handling; the readme also mentions delete actions and bulk management.
- This makes the admin dashboard the operational control plane for the role workflow.
7. Club member management
- routes/clubMembers.js → controllers/clubMemberController.js appears to be the separate CRUD surface for club member records.
- The readme calls out CSV upload, which suggests this subsystem handles batch onboarding and maintenance of the club roster, distinct from public member registration.
- This is likely the administrative source of truth for internal club membership data.
8. Contact / message intake
- routes/contacts.js → controllers/contactController.js handles contact submissions and retrieval.
- This is a separate inbound communication path from member registration and role requests, likely used for general inquiries or support.
9. Database layer
- The schema is relational and centered on tables named in the readme: members, roles, member_roles, contacts, and club_members.
- SQL files in backend/database/ define and manage the schema: schema.sql, members_setup.sql, clear_roles.sql, and query.sql.
- migrate.js indicates the app can initialize or update the database automatically on startup, which matters for deployment and diagramming the boot sequence.
10. Email integration
- backend/services/emailService.js is the outbound notification subsystem.
- The readme says it uses Nodemailer with Gmail and sends emails for registration, role requests, cancellations, and admin approval/rejection.
- One-click action links in email are an important architecture detail: email is not just notification, but an alternate control surface into the role workflow.
11. Configuration and deployment
- backend/config/db.js encapsulates environment-driven DB connectivity, including support for Cloud SQL via Unix sockets as well as local MySQL.
- Environment variables also drive CORS, email credentials, port binding, and public base URL, so deployment behavior is configuration-heavy.
- The Dockerfile and readme show the backend is intended for Google Cloud Run, while the frontend can be deployed statically elsewhere and pointed at the backend API.
12. Main data flows to draw
- Member registration: browser form → members API → MySQL → email notification.
- Role request/approval: member portal → roles API → pending record in MySQL → admin dashboard or email action link → approve/reject/cancel update.
- Club roster admin: admin UI → club members API → MySQL, with optional CSV bulk upload.
- Contact submissions: frontend contact form → contacts API → MySQL and/or email handling.
13. Key architectural boundary
- The most important boundary is between the static client UI and the stateful backend workflow engine.
- Everything business-critical—approval state, member records, club roster, and email-driven actions—lives behind the Express API and is persisted in MySQL.
Main entry points: roles.js Roles API · server.js Server entry · schema.sql Schema SQL · db.js DB config
Components 22
Frontend
Static browser UI and role-specific pages
- Site pages · Public informational pages and shared site shell
frontend/index.html - Registration form · Member signup and onboarding entry point
frontend/form.html - Member portal · Member login and role/status view
frontend/member.html - Admin dashboard · Operational dashboard for reviewing and acting on requests
frontend/admin.html - Role requests · Role request and status actions for members
frontend/roles.html - Client scripts · Shared JavaScript that calls backend APIs and renders flows
frontend/script.js
Backend
Express application, API handlers, and integrations
- Server entry · Wires middleware, routes, static serving, and startup
backend/server.js - Members API · HTTP surface for member registration
backend/routes/members.js - Roles API · HTTP surface for role requests and workflow actions
backend/routes/roles.js - Club members API · CRUD surface for internal club member records
backend/routes/clubMembers.js - Contacts API · Inbound contact and message handling
backend/routes/contacts.js - Member logic · Validates and processes member onboarding
backend/controllers/memberController.js - Role logic · Implements approval state transitions and assignment rules
backend/controllers/roleController.js - Club logic · Manages club roster operations and bulk maintenance
backend/controllers/clubMemberController.js - Contact logic · Handles contact submissions and retrieval
backend/controllers/contactController.js - Email service · Sends workflow and registration emails with action links
backend/services/emailService.js - DB config · Environment-driven MySQL and Cloud SQL connection setup
backend/config/db.js - Migrate · Initializes or updates schema on application startup
backend/database/migrate.js
Database
SQL schema, migrations, and query scripts
- Schema SQL · Core relational schema for members, roles, contacts, and club members
backend/database/schema.sql - Members setup · Member-related setup and initialization SQL
backend/database/members_setup.sql - Clear roles · Cleanup script for role data
backend/database/clear_roles.sql - Query SQL · Operational SQL queries for inspection or maintenance
backend/database/query.sql
Connections 30
- Registration form → Members API: submit signup · Member registration request
- Member portal → Roles API: view roles · Member portal reads role state and assignments
- Role requests → Roles API: request action · Role request and cancellation actions
- Admin dashboard → Roles API: moderate · Admin approves, rejects, assigns, or cancels requests
- Admin dashboard → Club members API: manage roster · Administrative club member CRUD and bulk handling
- Client scripts → Members API: API calls · Browser-side JavaScript invokes backend endpoints
- Client scripts → Roles API: API calls · Browser-side JavaScript invokes backend endpoints
- Client scripts → Contacts API: API calls · Browser-side JavaScript invokes backend endpoints
- Server entry → Members API: mounts · Express route registration
- Server entry → Roles API: mounts · Express route registration
- Server entry → Club members API: mounts · Express route registration
- Server entry → Contacts API: mounts · Express route registration
- Members API → Member logic: delegates · Routes forward requests to request handling logic
- Roles API → Role logic: delegates · Routes forward requests to workflow logic
- Club members API → Club logic: delegates · Routes forward requests to roster management logic
- Contacts API → Contact logic: delegates · Routes forward requests to contact handling logic
- Member logic → DB config: persists via · Uses database connection for member records
- Role logic → DB config: persists via · Uses database connection for role workflow state
- Club logic → DB config: persists via · Uses database connection for club roster records
- Contact logic → DB config: persists via · Uses database connection for contact records
- Member logic → Email service: notifies · Sends onboarding and confirmation emails
- Role logic → Email service: notifies · Sends approval, rejection, and cancellation emails
- Migrate → Schema SQL: creates · Startup migration uses schema definition
- Migrate → Members setup: initializes · Startup migration can apply member setup SQL
- Role logic → Schema SQL: reads/writes · Role workflow state is stored in relational tables
- Member logic → Schema SQL: reads/writes · Member onboarding data is stored in relational tables
- Club logic → Schema SQL: reads/writes · Club roster data is stored in relational tables
- Contact logic → Schema SQL: reads/writes · Contact submissions are stored in relational tables
- Server entry → Migrate: starts · Application startup may run migrations
- DB config → Schema SQL: connects to · Runtime DB connection targets the MySQL schema