# raniel-roque/doctask architecture

> Architecture diagram of the GitHub repository raniel-roque/doctask, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/raniel-roque/doctask
- Repository: https://github.com/raniel-roque/doctask

## Overview

DocTask is a role-based academic project and document workflow application: instructors manage users and groups, students work in teams and submit task documents, and advisers review and approve those documents. Convex provides application data and image storage; Clerk handles identity, while Liveblocks enables authorized real-time document collaboration. The tree also shows backup/restore, account administration, logs, profiles, and email-related routes. The README is only the default Next.js template, and sampled source is partial, so uncertain page-to-backend wiring is omitted.

Main entry points: [`src/app/api/liveblocks-auth/route.ts`](https://github.com/raniel-roque/doctask/blob/main/src/app/api/liveblocks-auth/route.ts) (Collaboration authorization), [`src/lib/convex-client.ts`](https://github.com/raniel-roque/doctask/blob/main/src/lib/convex-client.ts) (Convex client), [`src/app/api/upload-image/route.ts`](https://github.com/raniel-roque/doctask/blob/main/src/app/api/upload-image/route.ts) (Profile and images), [`src/app/api/convex`](https://github.com/raniel-roque/doctask/tree/main/src/app/api/convex) (Backup and restore APIs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and access"]
  node_auth_ui["Sign-in UI<br/>[page.tsx]"]
  node_account_api["Account APIs"]
  node_profile_api["Profile and images<br/>[route.ts]"]
end

subgraph group_roles["Role workspaces"]
  node_instructor_ui["Instructor workspace"]
  node_student_ui["Student workspace"]
  node_adviser_ui["Adviser workspace"]
end

subgraph group_documents["Documents and collaboration"]
  node_editor["Document editor"]
  node_live_auth["Collaboration authorization<br/>[route.ts]"]
end

subgraph group_backend["Application backend"]
  node_convex_client["Convex client<br/>[convex-client.ts]"]
  node_convex_fetch["Queries<br/>[fetch.ts]"]
  node_convex_mutations["Mutations<br/>[mutations.ts]"]
  node_convex_images["Image storage<br/>[images.ts]"]
  node_convex_restore["Restore operations<br/>[restore.ts]"]
  node_convex_schema[("Data schema<br/>[schema.ts]")]
  node_backup_api["Backup and restore APIs"]
end

subgraph group_integrations["External services"]
  node_auth_provider["Clerk identity"]
  node_live_service["Liveblocks rooms"]
  node_resend_api["Email routes"]
  node_mail_service["Resend email"]
end

node_person(("User"))

node_person -->|"signs in"| node_auth_ui
node_auth_ui -->|"authenticates"| node_auth_provider
node_person -->|"manages users"| node_instructor_ui
node_person -->|"works on tasks"| node_student_ui
node_person -->|"reviews work"| node_adviser_ui
node_account_api -->|"manages accounts"| node_auth_provider
node_account_api -->|"updates records"| node_convex_client
node_profile_api -->|"checks identity"| node_auth_provider
node_profile_api -->|"checks membership"| node_convex_client
node_profile_api -->|"uploads image"| node_convex_images
node_convex_images -->|"stores metadata"| node_convex_schema
node_editor -->|"requests access"| node_live_auth
node_live_auth -->|"checks session"| node_auth_provider
node_live_auth -->|"checks document access"| node_convex_client
node_live_auth -->|"authorizes room"| node_live_service
node_backup_api -->|"reads backup data"| node_convex_client
node_backup_api -->|"restores records"| node_convex_restore
node_backup_api -->|"manages accounts"| node_auth_provider
node_convex_fetch -->|"reads data"| node_convex_schema
node_convex_mutations -->|"writes data"| node_convex_schema
node_resend_api -->|"sends email"| node_mail_service

click node_auth_ui "https://github.com/raniel-roque/doctask/blob/main/src/app/(auth)/login/page.tsx"
click node_instructor_ui "https://github.com/raniel-roque/doctask/tree/main/src/app/(pages)/instructor/%5BinstructorId%5D"
click node_student_ui "https://github.com/raniel-roque/doctask/tree/main/src/app/(pages)/student/%5BstudentId%5D"
click node_adviser_ui "https://github.com/raniel-roque/doctask/tree/main/src/app/(pages)/adviser/%5BadviserId%5D"
click node_account_api "https://github.com/raniel-roque/doctask/tree/main/src/app/api/clerk"
click node_profile_api "https://github.com/raniel-roque/doctask/blob/main/src/app/api/upload-image/route.ts"
click node_editor "https://github.com/raniel-roque/doctask/tree/main/src/app/editor"
click node_live_auth "https://github.com/raniel-roque/doctask/blob/main/src/app/api/liveblocks-auth/route.ts"
click node_convex_client "https://github.com/raniel-roque/doctask/blob/main/src/lib/convex-client.ts"
click node_convex_fetch "https://github.com/raniel-roque/doctask/blob/main/convex/fetch.ts"
click node_convex_mutations "https://github.com/raniel-roque/doctask/blob/main/convex/mutations.ts"
click node_convex_images "https://github.com/raniel-roque/doctask/blob/main/convex/images.ts"
click node_convex_restore "https://github.com/raniel-roque/doctask/blob/main/convex/restore.ts"
click node_convex_schema "https://github.com/raniel-roque/doctask/blob/main/convex/schema.ts"
click node_backup_api "https://github.com/raniel-roque/doctask/tree/main/src/app/api/convex"
click node_resend_api "https://github.com/raniel-roque/doctask/tree/main/src/app/api/resend"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_auth_ui,node_account_api,node_profile_api,node_person toneBlue
class node_instructor_ui,node_student_ui,node_adviser_ui toneAmber
class node_editor,node_live_auth toneMint
class node_convex_client,node_convex_fetch,node_convex_mutations,node_convex_images,node_convex_restore,node_convex_schema,node_backup_api toneRose
class node_auth_provider,node_live_service,node_resend_api,node_mail_service toneIndigo
```

## Components

### Identity and access

- [Sign-in UI](https://github.com/raniel-roque/doctask/blob/main/src/app/(auth)/login/page.tsx): `src/app/(auth)/login/page.tsx`
- [Account APIs](https://github.com/raniel-roque/doctask/tree/main/src/app/api/clerk): `src/app/api/clerk`
- [Profile and images](https://github.com/raniel-roque/doctask/blob/main/src/app/api/upload-image/route.ts): `src/app/api/upload-image/route.ts`

### Role workspaces

- [Instructor workspace](https://github.com/raniel-roque/doctask/tree/main/src/app/(pages)/instructor/%5BinstructorId%5D): `src/app/(pages)/instructor/[instructorId]`
- [Student workspace](https://github.com/raniel-roque/doctask/tree/main/src/app/(pages)/student/%5BstudentId%5D): `src/app/(pages)/student/[studentId]`
- [Adviser workspace](https://github.com/raniel-roque/doctask/tree/main/src/app/(pages)/adviser/%5BadviserId%5D): `src/app/(pages)/adviser/[adviserId]`

### Documents and collaboration

- [Document editor](https://github.com/raniel-roque/doctask/tree/main/src/app/editor): `src/app/editor`
- [Collaboration authorization](https://github.com/raniel-roque/doctask/blob/main/src/app/api/liveblocks-auth/route.ts): `src/app/api/liveblocks-auth/route.ts`

### Application backend

- [Convex client](https://github.com/raniel-roque/doctask/blob/main/src/lib/convex-client.ts): `src/lib/convex-client.ts`
- [Queries](https://github.com/raniel-roque/doctask/blob/main/convex/fetch.ts): `convex/fetch.ts`
- [Mutations](https://github.com/raniel-roque/doctask/blob/main/convex/mutations.ts): `convex/mutations.ts`
- [Image storage](https://github.com/raniel-roque/doctask/blob/main/convex/images.ts): `convex/images.ts`
- [Restore operations](https://github.com/raniel-roque/doctask/blob/main/convex/restore.ts): `convex/restore.ts`
- [Data schema](https://github.com/raniel-roque/doctask/blob/main/convex/schema.ts): `convex/schema.ts`
- [Backup and restore APIs](https://github.com/raniel-roque/doctask/tree/main/src/app/api/convex): `src/app/api/convex`

### External services

- **Clerk identity**
- **Liveblocks rooms**
- [Email routes](https://github.com/raniel-roque/doctask/tree/main/src/app/api/resend): `src/app/api/resend`
- **Resend email**

### Other components

- **User**

## Connections

- User → Sign-in UI: signs in
- Sign-in UI → Clerk identity: authenticates
- User → Instructor workspace: manages users
- User → Student workspace: works on tasks
- User → Adviser workspace: reviews work
- Account APIs → Clerk identity: manages accounts
- Account APIs → Convex client: updates records
- Profile and images → Clerk identity: checks identity
- Profile and images → Convex client: checks membership
- Profile and images → Image storage: uploads image
- Image storage → Data schema: stores metadata
- Document editor → Collaboration authorization: requests access
- Collaboration authorization → Clerk identity: checks session
- Collaboration authorization → Convex client: checks document access
- Collaboration authorization → Liveblocks rooms: authorizes room
- Backup and restore APIs → Convex client: reads backup data
- Backup and restore APIs → Restore operations: restores records
- Backup and restore APIs → Clerk identity: manages accounts
- Queries → Data schema: reads data
- Mutations → Data schema: writes data
- Email routes → Resend email: sends email
