Module Creation
This page documents how modules are created in ILS, using the live ILS-dev implementation as the source of truth.
Entry points
- Frontend route:
/admin/modules - Creation route:
/admin/modules/new - Module editor file:
ILS-dev/frontend/src/pages/ModuleForm.jsx - Route registration:
ILS-dev/frontend/src/App.jsx
User flow
- The user opens the module administration page at
/admin/modules. - The module bank page lists existing modules and provides management actions.
-
A
New Moduleentry point is available from the admin modules UI. -
The user navigates to
/admin/modules/new. App.jsxmaps this route toModuleForm.jsx.-
The page title becomes
Create Module. -
The module editor loads supporting data.
ModuleForm.jsxfetches reference data from these endpoints:GET /api/coursesfor the course selectorGET /api/modules/bank/outcomesfor the outcomes bankGET /api/modules/bank/ref_teaching_methodsfor teaching method optionsGET /api/modules/bank/assignmentsfor assessment type fallback valuesGET /api/themesfor module theme selectionGET /api/assessment-typesfor assessment type options
-
These calls populate the editor UI, but module creation itself is triggered by the module save action.
-
The user enters module identity and curriculum details.
- Required fields for creation:
Course(selected fromcoursesBank)Module Name(title)
-
Optional fields include:
Module Code(code)Level(level)Duration(duration)Description(description)- Themes (
theme_ids) - Objectives (
objectives) - Structured weekly content (
structures) - Module assessments (
assessments) - Teaching methods (
teaching_method_ids)
-
The user submits the form.
ModuleForm.jsxcallshandleSave().- It builds a payload and sends it to the backend via
fetchApi(). - For a new module, the request is:
POST /api/modules
Backend API and persistence
- Backend route file:
ILS-dev/backend/routes/module.js - Route mount:
ILS-dev/backend/index.jsmounts/api/modulesto this router.
POST /api/modules
- The backend requires:
payload.title- It also expects
payload.course_idfor a valid module. - If
course_idis not provided, the backend currently defaults it to1000. - The backend persists a minimal module row with:
course_idtitlecodedurationlevel-
weight -
On success, it returns HTTP
201with the created module object.
Exact frontend-to-backend payload
ModuleForm.jsx sends these fields for module creation:
titlecodedescriptiondurationlevelcourse_idopleidingId(legacy course id alias)structureandstructures(array of week/topic/activity/output/order objects)outcome_ids(array of selected outcome IDs)assessmentandassessments(array of module assessment objects)teaching_methodsandteaching_method_idstheme_ids
The backend creation route only persists the core module row and does not yet process child arrays on POST /api/modules.
Trigger chain
- UI:
New Modulebutton or direct route/admin/modules/new - UI:
ModuleForm.jsxloads supporting banks and renders the editor - UI:
handleSave()builds the module payload - API:
POST /api/modules - Backend:
backend/routes/module.jscreates aModulerow through Sequelize - DB: new
modulestable row is inserted - UI: on success, the editor navigates back to
/admin/modules
Important implementation notes
ModuleForm.jsxis the authoritative module editor.- It uses
fetchApi()fromILS-dev/frontend/src/lib/api.js, which prefixes requests with/api. ModuleForm.jsxalso synchronizes module objectives after the module row is created, using:POST /api/modules/:id/objectivesPUT /api/module-objectives/:idDELETE /api/module-objectives/:id- The module creation backend route is minimal and only creates the core row. Additional module child data is handled later on edit through route
PUT /api/modules/:id.
Missing information in code
- The POST
/api/modulesbackend handler does not persisttheme_ids,assessment,structures, orteaching_method_idsat creation time. - That means the current implementation creates the module row first, and richer module content is managed in subsequent edit/save flows.
Last updated: 2026-07-08