sequenceDiagram
Client->>API: POST /auth/register
API->>Database: Create user
API-->>Client: 201 Created (user data)
Client->>API: POST /auth/login
API-->>Client: 200 OK (accessToken, refreshToken)
Client->>API: GET /users/me (Authorization: Bearer token)
API-->>Client: 200 OK (profile data)
Client->>API: PATCH /users/me/preferences
API-->>Client: 200 OK (preferences updated)
- Register —
POST /auth/registerwith email, password, and name - Login —
POST /auth/loginto receive JWT tokens - Get Profile —
GET /users/mewith the access token - Set Preferences —
PATCH /users/me/preferencesfor locale, timezone, notifications
sequenceDiagram
Instructor->>API: POST /courses (Create course)
API-->>Instructor: 201 Created
Instructor->>API: POST /courses/:id/modules (Add modules)
API-->>Instructor: 201 Created
Instructor->>API: POST /courses/:id/modules/:modId/lessons (Add lessons)
API-->>Instructor: 201 Created
Instructor->>API: POST /courses/:id/submit-for-review
API-->>Instructor: 200 OK
Reviewer->>API: POST /courses/:id/review
API-->>Reviewer: 200 OK
Instructor->>API: PATCH /courses/:id (Set status to published)
API-->>Instructor: 200 OK
- Create Course —
POST /courseswith title, description, price - Add Modules —
POST /courses/:id/modulesfor each module - Add Lessons —
POST /courses/:id/modules/:modId/lessonsfor each lesson - Submit for Review —
POST /courses/:id/submit-for-review - Review — Reviewer calls
POST /courses/:id/review - Publish —
PATCH /courses/:idwithstatus: published
sequenceDiagram
Student->>API: POST /payments/intent
API-->>Student: 200 OK (clientSecret)
Student->>Stripe: Confirm payment
Stripe-->>Student: Success
Student->>API: POST /payments/confirm (paymentIntentId)
API-->>Student: 200 OK (receipt)
Student->>API: GET /enrollments (verify enrollment)
API-->>Student: 200 OK
- Create Payment Intent —
POST /payments/intentwith courseId, amount, currency - Confirm on Client — Use Stripe.js to confirm the payment
- Confirm on Server —
POST /payments/confirmwith the payment intent ID - Verify Enrollment —
GET /enrollmentsto confirm access
sequenceDiagram
User->>API: GET /search?q=javascript&page=1&limit=20
API->>Elasticsearch: Forward search query
Elasticsearch-->>API: Results
API-->>User: 200 OK (results + pagination)
User->>API: GET /courses/:id
API-->>User: 200 OK (course details)
User->>API: POST /courses/:id/enroll
API-->>User: 201 Created
- Search —
GET /search?q=<term>for full-text search - Filter — Add
?category=,?price[gte]=,?sort=for refinement - View Course —
GET /courses/:idfor details - Enroll —
POST /courses/:id/enroll
sequenceDiagram
User->>WebSocket: Connect with JWT
WebSocket-->>User: Connected
User->>WebSocket: Join session { sessionId, userId, resourceType }
WebSocket-->>User: Join acknowledged
User->>WebSocket: Operation { type: 'edit', data: ... }
WebSocket-->>OtherUsers: Broadcast operation
User->>API: POST /collaboration/sessions (save snapshot)
API-->>User: 201 Created
- Connect — Open WebSocket connection with JWT in query params
- Join — Send
JoinSessionmessage to start collaborating - Operate — Send
CollaborativeOperationmessages in real-time - Save — Periodically save to REST API via
POST /collaboration/sessions
sequenceDiagram
User->>API: POST /moderation/reports (Report content)
API-->>User: 201 Created
Moderator->>API: GET /moderation/queue (View reports)
API-->>Moderator: 200 OK (pending reports)
Moderator->>API: PATCH /moderation/reports/:id/action
API-->>Moderator: 200 OK
API->>User: (Optional) Notification of resolution
- Report Content —
POST /moderation/reportswith resource type, ID, and reason - Review Queue —
GET /moderation/queuefor pending reports (moderator role) - Take Action —
PATCH /moderation/reports/:id/actionto resolve