Skip to main content

Club Creation Reference

Frontend flows

  • frontend/src/pages/ClubCreate/index.js:27 switches between the quick and advanced wizards while preserving them inside a tabbed layout.
  • Quick creation (frontend/src/pages/ClubNewQuick/index.js:135) posts { cbid } to POST /c/createcb.
  • The advanced wizard (frontend/src/pages/ClubNewStep/index.js:385) submits the full payload�name, description, announcement, category order and uploaded media�to the same endpoint after running additional client-side checks.
  • Both wizards throttle Club ID lookups through GET /s/cuid/{id} (frontend/src/pages/ClubNewStep/index.js:254), mirroring backend validation to provide immediate feedback.

Backend contract

  • backend/r/cbs.js:14 defines POST /c/createcb, guarded by login middleware and extensive express-validator rules to enforce ID length, allowed characters and category constraints before cbController.createCbStep runs.
  • Newly created clubs automatically assign the creator as president; follow-up tasks (initial topic seed, redis sync) are handled inside the controller and helper schedulers.

Assets and uploads

  • The advanced flow defers image uploads to pages/ClubNewStep/uploadCB.js, which pipes files to the static upload service before saving references in PostgreSQL.
  • Category drag-and-drop uses react-beautiful-dnd; the resulting order is sent as part of the creation payload and validated again server-side.

Error handling

  • API errors bubble back to the UI via snackbar with the first validation message returned in err.response.data.errors.
  • A debounce guard in backend/r/cbs.js:14 prevents rapid duplicate submissions, and the client disables the submit button while a request is active.