Summary
Build study cohorts (squads) from scratch: small groups of learners enrolled in the same track who share a group progress view, a private discussion thread, and a group leaderboard. New feature — no cohort logic exists today.
Background
Learning is more sticky when social. The platform has individual enrollment and a public forum, but nothing that groups learners into accountable units working the same track together.
What to build
1. Database migration
CREATE TABLE IF NOT EXISTS cohorts (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
course_slug TEXT NOT NULL,
start_date DATE NOT NULL,
max_members INTEGER NOT NULL DEFAULT 8,
created_by TEXT NOT NULL,
created_at TIMESTAMPTZ DEFAULT NOW()
);
CREATE TABLE IF NOT EXISTS cohort_members (
cohort_id INTEGER NOT NULL REFERENCES cohorts(id) ON DELETE CASCADE,
learner_addr TEXT NOT NULL,
joined_at TIMESTAMPTZ DEFAULT NOW(),
PRIMARY KEY (cohort_id, learner_addr)
);
2. Backend
POST /api/cohorts create (name, course, start date, size).
GET /api/cohorts?course= list joinable cohorts.
POST /api/cohorts/:id/join / POST /api/cohorts/:id/leave (auth, capacity-checked).
GET /api/cohorts/:id → members with per-member milestone progress (join against existing milestone_reports) and a group completion %.
3. Frontend
- "Squads" tab on the course page: browse/join cohorts or create one.
- Cohort detail: member roster with progress bars, group completion ring, and an embedded discussion thread (reuse the existing
CommentSection).
- Group leaderboard sorted by milestones completed.
4. Tests
- Capacity enforcement, join/leave idempotency, group progress aggregation.
Acceptance criteria
Summary
Build study cohorts (squads) from scratch: small groups of learners enrolled in the same track who share a group progress view, a private discussion thread, and a group leaderboard. New feature — no cohort logic exists today.
Background
Learning is more sticky when social. The platform has individual enrollment and a public forum, but nothing that groups learners into accountable units working the same track together.
What to build
1. Database migration
2. Backend
POST /api/cohortscreate (name, course, start date, size).GET /api/cohorts?course=list joinable cohorts.POST /api/cohorts/:id/join/POST /api/cohorts/:id/leave(auth, capacity-checked).GET /api/cohorts/:id→ members with per-member milestone progress (join against existing milestone_reports) and a group completion %.3. Frontend
CommentSection).4. Tests
Acceptance criteria