Section CRUD API: Create, Reorder & Delete Course Sections
Section CRUD API: Create, Reorder & Delete Course Sections
Released in v1.0.12
Overview
v1.0.12 ships a complete set of tRPC procedures for managing course sections. Sections are the mid-level grouping unit in the curriculum hierarchy — sitting above individual lessons and below the top-level course.
Course
└── Section
└── Lesson
With this release, you can programmatically create, rename, reorder, and delete sections through the tRPC API, providing the full lifecycle management needed to build and maintain structured course curricula.
Procedures
section.create
Creates a new section inside a given course.
Input
{
courseId: string; // ID of the parent course
title: string; // Display title for the section
}
Behaviour
- The new section is appended to the end of the course's section list.
- A position index is automatically assigned.
section.updateTitle
Updates the display title of an existing section.
Input
{
sectionId: string; // ID of the section to update
title: string; // New title
}
Behaviour
- Only the title is affected; lesson content and ordering remain unchanged.
section.reorder
Changes the positional order of sections within a course.
Input
{
courseId: string; // ID of the parent course
orderedIds: string[]; // Section IDs in the desired order
}
Behaviour
- Accepts an ordered array of section IDs representing the new sequence.
- All sections in the course must be included in
orderedIds. - Position indices are updated atomically.
section.delete
Deletes a section and all lessons nested within it.
Input
{
sectionId: string; // ID of the section to delete
}
Behaviour
- Cascading deletion: all lessons that belong to the section are permanently removed alongside the section itself.
- Remaining sections in the course retain their relative ordering; position indices are not recalculated automatically — use
section.reorderafterward if a compact index sequence is required.
⚠️ This action is irreversible. Deleting a section permanently removes all child lessons. Ensure the client presents an appropriate confirmation step before calling this procedure.
Curriculum Hierarchy Context
Sections exist as the structural mid-point in the three-tier curriculum model:
| Level | Unit | Managed Since |
|---|---|---|
| 1 | Course | Prior release |
| 2 | Section | v1.0.12 |
| 3 | Lesson | Prior release |
With this release, all three tiers now have CRUD coverage via the tRPC API.
Usage Notes
- All procedures are tRPC mutations and should be called from a tRPC-enabled client.
- Authorization is enforced at the course level — callers must have editor or admin access to the parent course to create, modify, or delete its sections.
- When building a drag-and-drop curriculum editor, wire the drop event to
section.reorderwith the updatedorderedIdsarray.