# fahim07ms/devquest_frontend architecture

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

- Interactive diagram: https://gitdiagram.com/fahim07ms/devquest_frontend
- Repository: https://github.com/fahim07ms/devquest_frontend

## Overview

1. This is a Next.js App Router application organized as a Q&A/community platform. The feature set visible in the routes includes questions, answers, comments, tags, bookmarks, user profiles, a dashboard, and a moderation/flags area.

2. The top-level routing is split into two main route groups: `app/(auth)` for login/register flows and `app/(root)` for the authenticated/main experience. This separation is the primary boundary for public vs. app-shell pages.

3. `app/layout.tsx`, `app/globals.css`, and `components/theme-provider.tsx` define the shared shell and global styling/theme behavior. `app/(root)/layout.tsx` likely provides the main in-app layout, while `components/layout/Navbar.tsx` and `components/layout/AppSidebar.tsx` form the persistent navigation chrome.

4. The main feature pages live under `app/(root)`: dashboard, questions list/detail, ask question, tags, bookmarks, users, and flags. The route structure suggests the application is centered on browsing and managing discussion content rather than a generic CRUD app.

5. Question handling is a core subsystem. `components/questions/*` provides reusable UI for question cards, pagination, voting, inline edit actions, and question detail skeletons. `app/(root)/questions/[questionId]` is the detail view, while `app/(root)/questions/ask` is the creation flow.

6. Answer and comment presentation are separate but related subsystems. `components/answers/AnswerCard.tsx` and `components/comments/CommentThread.tsx` imply a question detail page composed from multiple content blocks, with answers and threaded comments rendered as distinct sections.

7. The editor stack is isolated under `components/editor/*` and `components/questions/ask/*`. It uses Tiptap-based rich text editing, tag input, character counting, and sectioned form UI, which indicates the ask/edit flows are more complex than simple text forms.

8. Moderation and reporting is modeled as its own area. `components/flags/*` includes a flag button, flag dialog, filters, review drawer, and row component, matching the `app/(root)/flags` route and suggesting a review queue for reported content.

9. User and community identity are represented through reusable display components and profile routes. `components/ui/UserAvatar.tsx`, `app/(root)/users/[username]`, and `app/(root)/bookmarks` point to profile-centric navigation and personal content management.

10. Data access is separated from UI via `lib/api.ts` and `lib/services/questionService.ts`. That implies a thin service layer over an API client, with question-related server communication centralized outside of the page components.

11. Client-side state is handled in `store/authStore.ts`, likely for session/auth status and user identity. This store sits alongside the auth routes, which suggests the app shell can conditionally render or protect sections based on login state.

12. Shared utility and validation code lives in `lib/utils.ts` and `lib/validation.ts`, while `lib/useImageUploader.tsx` indicates an auxiliary client-side upload flow, probably used by the editor or profile content.

13. The `types/index.ts` file acts as the central domain model boundary for questions, users, flags, and other entities. This is important for diagramming because it likely underpins both the service layer and the feature components.

14. The `components/ui/*` directory is a broad design-system layer of reusable primitives such as buttons, dialogs, forms, inputs, tables/pagination, sheets, tooltips, and avatars. Feature components build on these primitives rather than styling everything ad hoc.

15. Overall data flow is: route page -> feature component tree -> service/API layer -> backend data, with auth state and editor/upload utilities supporting the interaction. The architecture is best drawn as a layered Next.js app with route groups on top, shared UI and domain services in the middle, and a small client-state/auth layer supporting protected functionality.

Main entry points: [`app/(root)`](https://github.com/fahim07ms/devquest_frontend/tree/main/app/(root)) (Main app), [`components/ui`](https://github.com/fahim07ms/devquest_frontend/tree/main/components/ui) (UI primitives), [`app/(root)/questions/[questionId]/page.tsx`](https://github.com/fahim07ms/devquest_frontend/blob/main/app/(root)/questions/[questionId]/page.tsx) (Question detail), [`components/questions`](https://github.com/fahim07ms/devquest_frontend/tree/main/components/questions) (Questions UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routing["Routing"]
  node_app_layout["App layout<br/>next root shell<br/>[layout.tsx]"]
  node_auth_group["Auth routes<br/>route group"]
  node_login_page["Login<br/>auth page<br/>[page.tsx]"]
  node_register_page["Register<br/>auth page<br/>[page.tsx]"]
  node_root_group["Main app<br/>route group"]
  node_root_layout["Root layout<br/>app shell<br/>[layout.tsx]"]
  node_dashboard_page["Dashboard<br/>[page.tsx]"]
  node_questions_page["Questions<br/>listing page<br/>[page.tsx]"]
  node_question_detail_page["Question detail<br/>detail page<br/>[page.tsx]"]
  node_ask_page["Ask question<br/>create page<br/>[page.tsx]"]
  node_tags_page["Tags<br/>taxonomy page<br/>[page.tsx]"]
  node_bookmarks_page["Bookmarks<br/>saved-items page<br/>[page.tsx]"]
  node_users_page["User profile<br/>profile page<br/>[page.tsx]"]
  node_flags_page["Flags<br/>moderation page<br/>[page.tsx]"]
end

subgraph group_feature["Features"]
  node_question_ui["Questions UI<br/>feature set"]
  node_answer_card["Answer card<br/>answer component<br/>[AnswerCard.tsx]"]
  node_comment_thread["Comment thread<br/>discussion component<br/>[CommentThread.tsx]"]
  node_editor_stack["Editor stack<br/>rich-text feature"]
  node_ask_form_ui["Ask form<br/>form feature"]
  node_flags_ui["Moderation UI<br/>review feature"]
end

subgraph group_shared["Shared"]
  node_nav_shell["Navigation shell<br/>layout chrome"]
  node_theme_provider["Theme provider<br/>ui provider<br/>[theme-provider.tsx]"]
  node_ui_primitives["UI primitives<br/>design system"]
  node_skeletons["Skeletons<br/>loading ui"]
end

subgraph group_state["State & Data"]
  node_api_layer["API client<br/>data access<br/>[api.ts]"]
  node_question_service["Question service<br/>service layer<br/>[questionService.ts]"]
  node_auth_store["Auth store<br/>client state<br/>[authStore.ts]"]
  node_domain_types["Domain types<br/>type boundary<br/>[index.ts]"]
  node_utils_validation["Utils & validation<br/>shared logic<br/>[utils.ts]"]
  node_image_uploader["Image uploader<br/>client utility"]
end

node_app_layout -->|"wraps"| node_theme_provider
node_app_layout -->|"hosts"| node_auth_group
node_app_layout -->|"hosts"| node_root_group
node_auth_group -->|"contains"| node_login_page
node_auth_group -->|"contains"| node_register_page
node_root_group -->|"uses"| node_root_layout
node_root_group -->|"contains"| node_dashboard_page
node_root_group -->|"contains"| node_questions_page
node_root_group -->|"contains"| node_question_detail_page
node_root_group -->|"contains"| node_ask_page
node_root_group -->|"contains"| node_tags_page
node_root_group -->|"contains"| node_bookmarks_page
node_root_group -->|"contains"| node_users_page
node_root_group -->|"contains"| node_flags_page
node_root_layout -->|"composes"| node_nav_shell
node_questions_page -->|"renders"| node_question_ui
node_question_detail_page -->|"renders"| node_answer_card
node_question_detail_page -->|"renders"| node_comment_thread
node_question_detail_page -->|"uses"| node_question_ui
node_ask_page -->|"uses"| node_editor_stack
node_ask_page -->|"uses"| node_ask_form_ui
node_flags_page -->|"renders"| node_flags_ui
node_question_ui -->|"built on"| node_ui_primitives
node_answer_card -->|"built on"| node_ui_primitives
node_comment_thread -->|"built on"| node_ui_primitives
node_editor_stack -->|"built on"| node_ui_primitives
node_ask_form_ui -->|"built on"| node_ui_primitives
node_flags_ui -->|"built on"| node_ui_primitives
node_question_ui -.->|"loads with"| node_skeletons
node_question_service -->|"calls"| node_api_layer
node_question_service -->|"returns"| node_domain_types
node_auth_store -.->|"supports"| node_root_layout
node_utils_validation -.->|"supports"| node_editor_stack
node_image_uploader -.->|"supports"| node_editor_stack
node_nav_shell -->|"composed from"| node_ui_primitives

click node_app_layout "https://github.com/fahim07ms/devquest_frontend/blob/main/app/layout.tsx"
click node_auth_group "https://github.com/fahim07ms/devquest_frontend/tree/main/app/(auth)"
click node_login_page "https://github.com/fahim07ms/devquest_frontend/blob/main/app/(auth)/login/page.tsx"
click node_register_page "https://github.com/fahim07ms/devquest_frontend/blob/main/app/(auth)/register/page.tsx"
click node_root_group "https://github.com/fahim07ms/devquest_frontend/tree/main/app/(root)"
click node_root_layout "https://github.com/fahim07ms/devquest_frontend/blob/main/app/(root)/layout.tsx"
click node_dashboard_page "https://github.com/fahim07ms/devquest_frontend/blob/main/app/(root)/dashboard/page.tsx"
click node_questions_page "https://github.com/fahim07ms/devquest_frontend/blob/main/app/(root)/questions/page.tsx"
click node_question_detail_page "https://github.com/fahim07ms/devquest_frontend/blob/main/app/(root)/questions/[questionId]/page.tsx"
click node_ask_page "https://github.com/fahim07ms/devquest_frontend/blob/main/app/(root)/questions/ask/page.tsx"
click node_tags_page "https://github.com/fahim07ms/devquest_frontend/blob/main/app/(root)/tags/page.tsx"
click node_bookmarks_page "https://github.com/fahim07ms/devquest_frontend/blob/main/app/(root)/bookmarks/page.tsx"
click node_users_page "https://github.com/fahim07ms/devquest_frontend/blob/main/app/(root)/users/[username]/page.tsx"
click node_flags_page "https://github.com/fahim07ms/devquest_frontend/blob/main/app/(root)/flags/page.tsx"
click node_question_ui "https://github.com/fahim07ms/devquest_frontend/tree/main/components/questions"
click node_answer_card "https://github.com/fahim07ms/devquest_frontend/blob/main/components/answers/AnswerCard.tsx"
click node_comment_thread "https://github.com/fahim07ms/devquest_frontend/blob/main/components/comments/CommentThread.tsx"
click node_editor_stack "https://github.com/fahim07ms/devquest_frontend/tree/main/components/editor"
click node_ask_form_ui "https://github.com/fahim07ms/devquest_frontend/tree/main/components/questions/ask"
click node_flags_ui "https://github.com/fahim07ms/devquest_frontend/tree/main/components/flags"
click node_nav_shell "https://github.com/fahim07ms/devquest_frontend/tree/main/components/layout"
click node_theme_provider "https://github.com/fahim07ms/devquest_frontend/blob/main/components/theme-provider.tsx"
click node_ui_primitives "https://github.com/fahim07ms/devquest_frontend/tree/main/components/ui"
click node_skeletons "https://github.com/fahim07ms/devquest_frontend/blob/main/components/skeleton/QuestionDetailSkeleton.tsx"
click node_api_layer "https://github.com/fahim07ms/devquest_frontend/blob/main/lib/api.ts"
click node_question_service "https://github.com/fahim07ms/devquest_frontend/blob/main/lib/services/questionService.ts"
click node_auth_store "https://github.com/fahim07ms/devquest_frontend/blob/main/store/authStore.ts"
click node_domain_types "https://github.com/fahim07ms/devquest_frontend/blob/main/types/index.ts"
click node_utils_validation "https://github.com/fahim07ms/devquest_frontend/blob/main/lib/utils.ts"
click node_image_uploader "https://github.com/fahim07ms/devquest_frontend/blob/main/lib/useImageUploader.tsx"

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_app_layout,node_auth_group,node_login_page,node_register_page,node_root_group,node_root_layout,node_dashboard_page,node_questions_page,node_question_detail_page,node_ask_page,node_tags_page,node_bookmarks_page,node_users_page,node_flags_page toneBlue
class node_question_ui,node_answer_card,node_comment_thread,node_editor_stack,node_ask_form_ui,node_flags_ui toneAmber
class node_nav_shell,node_theme_provider,node_ui_primitives,node_skeletons toneMint
class node_api_layer,node_question_service,node_auth_store,node_domain_types,node_utils_validation,node_image_uploader toneRose
```

## Components

### Routing

Next.js route groups and page entrypoints

- [App layout](https://github.com/fahim07ms/devquest_frontend/blob/main/app/layout.tsx): next root shell · Global app shell, metadata, and provider composition · `app/layout.tsx`
- [Auth routes](https://github.com/fahim07ms/devquest_frontend/tree/main/app/(auth)): route group · Login and registration flow boundary · `app/(auth)`
- [Login](https://github.com/fahim07ms/devquest_frontend/blob/main/app/(auth)/login/page.tsx): auth page · Sign-in entrypoint · `app/(auth)/login/page.tsx`
- [Register](https://github.com/fahim07ms/devquest_frontend/blob/main/app/(auth)/register/page.tsx): auth page · Account creation entrypoint · `app/(auth)/register/page.tsx`
- [Main app](https://github.com/fahim07ms/devquest_frontend/tree/main/app/(root)): route group · Authenticated community experience boundary · `app/(root)`
- [Root layout](https://github.com/fahim07ms/devquest_frontend/blob/main/app/(root)/layout.tsx): app shell · In-app layout for authenticated pages · `app/(root)/layout.tsx`
- [Dashboard](https://github.com/fahim07ms/devquest_frontend/blob/main/app/(root)/dashboard/page.tsx): dashboard page · Main landing dashboard inside the app · `app/(root)/dashboard/page.tsx`
- [Questions](https://github.com/fahim07ms/devquest_frontend/blob/main/app/(root)/questions/page.tsx): listing page · Questions index and browsing entrypoint · `app/(root)/questions/page.tsx`
- [Question detail](https://github.com/fahim07ms/devquest_frontend/blob/main/app/(root)/questions/[questionId]/page.tsx): detail page · Single question view with answers and comments · `app/(root)/questions/[questionId]/page.tsx`
- [Ask question](https://github.com/fahim07ms/devquest_frontend/blob/main/app/(root)/questions/ask/page.tsx): create page · Question creation flow · `app/(root)/questions/ask/page.tsx`
- [Tags](https://github.com/fahim07ms/devquest_frontend/blob/main/app/(root)/tags/page.tsx): taxonomy page · Tag browsing and discovery · `app/(root)/tags/page.tsx`
- [Bookmarks](https://github.com/fahim07ms/devquest_frontend/blob/main/app/(root)/bookmarks/page.tsx): saved-items page · User saved questions view · `app/(root)/bookmarks/page.tsx`
- [User profile](https://github.com/fahim07ms/devquest_frontend/blob/main/app/(root)/users/[username]/page.tsx): profile page · Public user profile view · `app/(root)/users/[username]/page.tsx`
- [Flags](https://github.com/fahim07ms/devquest_frontend/blob/main/app/(root)/flags/page.tsx): moderation page · Reported content review queue · `app/(root)/flags/page.tsx`

### Features

Domain feature components and composed page sections

- [Questions UI](https://github.com/fahim07ms/devquest_frontend/tree/main/components/questions): feature set · Reusable question cards, voting, pagination, and inline actions · `components/questions`
- [Answer card](https://github.com/fahim07ms/devquest_frontend/blob/main/components/answers/AnswerCard.tsx): answer component · Answer presentation block · `components/answers/AnswerCard.tsx`
- [Comment thread](https://github.com/fahim07ms/devquest_frontend/blob/main/components/comments/CommentThread.tsx): discussion component · Threaded comments for a question or answer · `components/comments/CommentThread.tsx`
- [Editor stack](https://github.com/fahim07ms/devquest_frontend/tree/main/components/editor): rich-text feature · Ask/edit form building blocks and Tiptap editor composition · `components/editor`
- [Ask form](https://github.com/fahim07ms/devquest_frontend/tree/main/components/questions/ask): form feature · Sectioned question creation UI, counters, and tag input · `components/questions/ask`
- [Moderation UI](https://github.com/fahim07ms/devquest_frontend/tree/main/components/flags): review feature · Flagging, filters, rows, and review drawer components · `components/flags`

### Shared

Reusable shell, UI, and utility layers

- [Navigation shell](https://github.com/fahim07ms/devquest_frontend/tree/main/components/layout): layout chrome · Persistent navbar and sidebar navigation · `components/layout`
- [Theme provider](https://github.com/fahim07ms/devquest_frontend/blob/main/components/theme-provider.tsx): ui provider · Shared theme/runtime provider · `components/theme-provider.tsx`
- [UI primitives](https://github.com/fahim07ms/devquest_frontend/tree/main/components/ui): design system · Reusable buttons, dialogs, forms, inputs, tables, sheets, tooltips, and avatars · `components/ui`
- [Skeletons](https://github.com/fahim07ms/devquest_frontend/blob/main/components/skeleton/QuestionDetailSkeleton.tsx): loading ui · Loading placeholders for content-heavy views · `components/skeleton/QuestionDetailSkeleton.tsx`

### State & Data

Client state, API access, and domain types

- [API client](https://github.com/fahim07ms/devquest_frontend/blob/main/lib/api.ts): data access · HTTP/API boundary for backend communication · `lib/api.ts`
- [Question service](https://github.com/fahim07ms/devquest_frontend/blob/main/lib/services/questionService.ts): service layer · Question-centric server communication and orchestration · `lib/services/questionService.ts`
- [Auth store](https://github.com/fahim07ms/devquest_frontend/blob/main/store/authStore.ts): client state · Session and identity state for protected app areas · `store/authStore.ts`
- [Domain types](https://github.com/fahim07ms/devquest_frontend/blob/main/types/index.ts): type boundary · Shared entities for questions, users, flags, and related models · `types/index.ts`
- [Utils & validation](https://github.com/fahim07ms/devquest_frontend/blob/main/lib/utils.ts): shared logic · General helpers and schema/validation logic · `lib/utils.ts`
- [Image uploader](https://github.com/fahim07ms/devquest_frontend/blob/main/lib/useImageUploader.tsx): client utility · Auxiliary upload flow used by editor/profile interactions · `lib/useImageUploader.tsx`

## Connections

- App layout → Theme provider: wraps
- App layout → Auth routes: hosts
- App layout → Main app: hosts
- Auth routes → Login: contains
- Auth routes → Register: contains
- Main app → Root layout: uses
- Main app → Dashboard: contains
- Main app → Questions: contains
- Main app → Question detail: contains
- Main app → Ask question: contains
- Main app → Tags: contains
- Main app → Bookmarks: contains
- Main app → User profile: contains
- Main app → Flags: contains
- Root layout → Navigation shell: composes
- Questions → Questions UI: renders
- Question detail → Answer card: renders
- Question detail → Comment thread: renders
- Question detail → Questions UI: uses
- Ask question → Editor stack: uses
- Ask question → Ask form: uses
- Flags → Moderation UI: renders
- Questions UI → UI primitives: built on
- Answer card → UI primitives: built on
- Comment thread → UI primitives: built on
- Editor stack → UI primitives: built on
- Ask form → UI primitives: built on
- Moderation UI → UI primitives: built on
- Questions UI → Skeletons: loads with
- Question service → API client: calls
- Question service → Domain types: returns
- Auth store → Root layout: supports
- Utils & validation → Editor stack: supports
- Image uploader → Editor stack: supports
- Navigation shell → UI primitives: composed from
