# gjtjdwl/insideout-front architecture

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

- Interactive diagram: https://gitdiagram.com/gjtjdwl/insideout-front
- Repository: https://github.com/gjtjdwl/insideout-front

## Overview

1. **Repository role**
   - This repo is the **Next.js + TypeScript frontend** for “InsideOut,” an AI counseling platform for workplace mental health.
   - The application is organized around **App Router pages**, reusable UI components, and a thin **API-client layer** that talks to backend services.

2. **Top-level navigation structure**
   - The `app/` tree is split into two main shells:
     - `app/(header)` for authenticated/internal pages with the common site header.
     - `app/(noheader)` for public or focused flows like **login, register, and chat**.
   - This boundary is important for the diagram because it separates the global authenticated experience from the minimal-entry flows.

3. **Routing and page domains**
   - The page structure maps cleanly to product domains:
     - **Chat counseling**: `app/(noheader)/chat`
     - **Authentication**: `login`, `register`
     - **My page / user profile**: `mypage`, `edit`, `verify`, `counsellog`
     - **Boards**: `notice`, `inquiry`, `create`, `modify`
     - **Management**: `manage/accepted`, `manage/feedback`, `manage/department`
     - **Admin web**: `admin/web/department`
   - Dynamic routes like `[sessionId]`, `[inquiryId]`, and `[departmentName]` indicate detail views driven by server-fetched IDs.

4. **Primary user flow: counseling**
   - The central product flow is the **chat interface** in `app/(noheader)/chat`.
   - The chat experience is built from reusable components such as `Chat`, `ChatSideBar`, and `EmptyChat`.
   - Based on the README, this flow is where users interact with the AI counselor and where counseling data is later analyzed for ORS/SRS and environment improvement insights.

5. **User/account boundary**
   - Authentication and identity-related behavior is separated into:
     - `app/components/LoginForm.tsx`
     - `app/hooks/useUser.ts`
     - `app/api/auth.ts`
     - `app/api/userinfo.ts`
     - `app/(header)/mypage/*`
   - This suggests the app keeps **user session state** centralized in a hook and uses API modules to read/update profile and verification state.

6. **Content and communication subsystems**
   - The board area is split into:
     - **Notices**: read/modify flows under `boards/notice`
     - **Inquiries**: user support or questions under `boards/inquiry`
     - **Board creation**: `boards/create/[boardName]`
   - `ClientNoticeWrapper.tsx` implies some notice pages need client-side interactivity even though the rest of the app likely uses server-rendered pages where possible.

7. **Operational / analytics subsystem**
   - `manage/*` and `admin/web/*` are the internal operational views.
   - These pages likely consume aggregated counseling and department data to show:
     - accepted sessions
     - feedback/quality signals
     - department-level insights
     - admin-side dashboards
   - `ReCharts.tsx` confirms there is a visualization layer for metrics and summaries.

8. **Shared UI component layer**
   - `app/components/` contains the reusable design system for the app:
     - layout/header/footer pieces
     - forms (`LoginForm`, `WritingForm`, `ScaleForm`)
     - dialogs/modals (`AgreementModal`, `ConsentModal`, `SuccessModal`, `CounselListModal`)
     - board and navigation utilities (`BoardList`, `SearchInput`, `DropDown`, `PagenationComponent`)
     - chat-specific widgets (`Chat`, `ChatSideBar`, `EmptyChat`)
   - This shared layer keeps the route pages thin and domain-focused.

9. **API abstraction**
   - `app/api/` is a clear boundary between UI and backend communication:
     - `auth.ts`
     - `board.ts`
     - `chat.ts`
     - `manage.ts`
     - `userinfo.ts`
     - `webManage.ts`
   - These modules likely encapsulate request logic and types for the backend, rather than calling services directly from page components.

10. **State, context, and domain modeling**
   - `DepartmentContext.tsx` suggests department selection or department-scoped filtering is a cross-cutting state concern.
   - `app/types/` is organized by domain (`auth`, `board`, `chat`, `manage`, `mypage`, `webManage`), which makes the architecture strongly **contract-driven**.
   - `scaleFormConfig.ts` and `dataFormatter.ts` indicate some UI and analytics normalization lives in constants/utils rather than in pages.

11. **Middleware and layout control**
   - `middleware.ts` is an important architectural boundary because it likely enforces access control or route gating before page rendering.
   - Combined with the nested layouts in `app/(header)` and `app/(noheader)`, the app has a **routing-level separation of public vs protected experiences**.

12. **Runtime / delivery stack**
   - The repo is built with **Next.js, React, TypeScript, Tailwind CSS**, and includes a `Dockerfile`, so it is designed for containerized deployment.
   - The README mentions **RAG, Vector DB, LangChain, and Spring Boot**; those appear to be backend capabilities or future extensions, while this repository is the frontend presentation layer that consumes them.

13. **How data likely flows through the system**
   - User authenticates through the no-header flow.
   - Chat interactions are captured in the chat subsystem and sent through the API layer.
   - Results and summaries surface in mypage, notice/inquiry boards, and management dashboards.
   - Admin and department views consume aggregated outcomes to support workplace improvement and service monitoring.

14. **Key architectural takeaway**
   - This is a **domain-organized frontend** with three major concerns: **counseling interaction**, **content/account management**, and **administrative analytics**.
   - The strongest diagram boundaries are: **route shells**, **shared UI components**, **typed API modules**, and **protected vs public access enforced by middleware**.

Main entry points: [`app/(header)`](https://github.com/gjtjdwl/insideout-front/tree/main/app/(header)) (Header shell), [`app/(noheader)`](https://github.com/gjtjdwl/insideout-front/tree/main/app/(noheader)) (No-header shell), [`app/(header)/manage`](https://github.com/gjtjdwl/insideout-front/tree/main/app/(header)/manage) (Management), [`app/api/index.ts`](https://github.com/gjtjdwl/insideout-front/blob/main/app/api/index.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g1["Route shells"]
  node_n3["Header shell<br/>Route shell"]
  node_n4["No-header shell<br/>Route shell"]
end

subgraph group_g2["Product flows"]
  node_n2["Home<br/>Route page<br/>[page.tsx]"]
  node_n5["Chat counseling<br/>Counseling flow"]
  node_n6["Auth flows<br/>Identity flow"]
  node_n7["My page<br/>User account"]
  node_n8["Boards<br/>Content area"]
  node_n9["Management<br/>Ops area"]
  node_n10["Admin web<br/>Admin area"]
end

subgraph group_g3["Shared platform"]
  node_n11["Header UI<br/>Shared UI<br/>[header.tsx]"]
  node_n12["Chat widgets<br/>Shared UI<br/>[Chat.tsx]"]
  node_n13["Forms & modals<br/>Shared UI<br/>[LoginForm.tsx]"]
  node_n14["Board UI<br/>Shared UI<br/>[BoardList.tsx]"]
  node_n15["Metrics UI<br/>Shared UI<br/>[ReCharts.tsx]"]
  node_n16["Session state<br/>Client state<br/>[useUser.ts]"]
  node_n17["Department context"]
  node_n19["Types<br/>Contracts<br/>[auth.ts]"]
  node_n20["Formatters<br/>Utils<br/>[dataFormatter.ts]"]
end

subgraph group_g4["Infra"]
  node_n1["Root layout<br/>Next layout<br/>[layout.tsx]"]
  node_n18["API client<br/>HTTP layer<br/>[index.ts]"]
  node_n21["Middleware<br/>Route guard<br/>[middleware.ts]"]
  node_n22["Styles<br/>Global CSS<br/>[globals.css]"]
end

node_n1 -->|"wraps"| node_n3
node_n1 -->|"wraps"| node_n4
node_n1 -->|"renders"| node_n2
node_n3 -->|"hosts"| node_n7
node_n3 -->|"hosts"| node_n8
node_n3 -->|"hosts"| node_n9
node_n3 -->|"hosts"| node_n10
node_n4 -->|"hosts"| node_n5
node_n4 -->|"hosts"| node_n6
node_n5 -->|"uses"| node_n12
node_n6 -->|"uses"| node_n13
node_n7 -->|"uses"| node_n16
node_n8 -->|"uses"| node_n14
node_n9 -->|"uses"| node_n15
node_n10 -->|"uses"| node_n15
node_n16 -->|"calls"| node_n18
node_n5 -->|"calls"| node_n18
node_n8 -->|"calls"| node_n18
node_n9 -->|"calls"| node_n18
node_n10 -->|"calls"| node_n18
node_n3 -->|"protected by"| node_n21
node_n4 -->|"protected by"| node_n21
node_n3 -->|"shares"| node_n11
node_n4 -->|"shares"| node_n11
node_n5 -->|"filters"| node_n17
node_n9 -->|"filters"| node_n17
node_n10 -->|"filters"| node_n17
node_n8 -->|"normalizes"| node_n20
node_n9 -->|"normalizes"| node_n20
node_n3 -->|"typed by"| node_n19
node_n4 -->|"typed by"| node_n19
node_n1 -->|"styles"| node_n22

click node_n1 "https://github.com/gjtjdwl/insideout-front/blob/main/app/layout.tsx"
click node_n2 "https://github.com/gjtjdwl/insideout-front/blob/main/app/page.tsx"
click node_n3 "https://github.com/gjtjdwl/insideout-front/tree/main/app/(header)"
click node_n4 "https://github.com/gjtjdwl/insideout-front/tree/main/app/(noheader)"
click node_n5 "https://github.com/gjtjdwl/insideout-front/tree/main/app/(noheader)/chat"
click node_n6 "https://github.com/gjtjdwl/insideout-front/tree/main/app/(noheader)/login"
click node_n7 "https://github.com/gjtjdwl/insideout-front/tree/main/app/(header)/mypage"
click node_n8 "https://github.com/gjtjdwl/insideout-front/tree/main/app/(header)/boards"
click node_n9 "https://github.com/gjtjdwl/insideout-front/tree/main/app/(header)/manage"
click node_n10 "https://github.com/gjtjdwl/insideout-front/tree/main/app/(header)/admin/web"
click node_n11 "https://github.com/gjtjdwl/insideout-front/blob/main/app/components/header.tsx"
click node_n12 "https://github.com/gjtjdwl/insideout-front/blob/main/app/components/Chat.tsx"
click node_n13 "https://github.com/gjtjdwl/insideout-front/blob/main/app/components/LoginForm.tsx"
click node_n14 "https://github.com/gjtjdwl/insideout-front/blob/main/app/components/BoardList.tsx"
click node_n15 "https://github.com/gjtjdwl/insideout-front/blob/main/app/components/ReCharts.tsx"
click node_n16 "https://github.com/gjtjdwl/insideout-front/blob/main/app/hooks/useUser.ts"
click node_n17 "https://github.com/gjtjdwl/insideout-front/blob/main/app/context/DepartmentContext.tsx"
click node_n18 "https://github.com/gjtjdwl/insideout-front/blob/main/app/api/index.ts"
click node_n19 "https://github.com/gjtjdwl/insideout-front/blob/main/app/types/auth.ts"
click node_n20 "https://github.com/gjtjdwl/insideout-front/blob/main/app/utils/dataFormatter.ts"
click node_n21 "https://github.com/gjtjdwl/insideout-front/blob/main/middleware.ts"
click node_n22 "https://github.com/gjtjdwl/insideout-front/blob/main/app/globals.css"

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_n3,node_n4 toneBlue
class node_n2,node_n5,node_n6,node_n7,node_n8,node_n9,node_n10 toneAmber
class node_n11,node_n12,node_n13,node_n14,node_n15,node_n16,node_n17,node_n19,node_n20 toneMint
class node_n1,node_n18,node_n21,node_n22 toneRose
```

## Components

### Route shells

Top-level routing boundaries that separate public and authenticated experiences.

- [Header shell](https://github.com/gjtjdwl/insideout-front/tree/main/app/(header)): Route shell · Authenticated/internal experience with the common header. · `app/(header)`
- [No-header shell](https://github.com/gjtjdwl/insideout-front/tree/main/app/(noheader)): Route shell · Minimal-entry flows for chat and authentication. · `app/(noheader)`

### Product flows

User-facing domains for counseling, account, boards, and operations.

- [Home](https://github.com/gjtjdwl/insideout-front/blob/main/app/page.tsx): Route page · Top-level entry page for the app. · `app/page.tsx`
- [Chat counseling](https://github.com/gjtjdwl/insideout-front/tree/main/app/(noheader)/chat): Counseling flow · Primary AI counseling experience and chat entry points. · `app/(noheader)/chat`
- [Auth flows](https://github.com/gjtjdwl/insideout-front/tree/main/app/(noheader)/login): Identity flow · Login and registration routes. · `app/(noheader)/login`
- [My page](https://github.com/gjtjdwl/insideout-front/tree/main/app/(header)/mypage): User account · Profile, edit, verification, and counseling log views. · `app/(header)/mypage`
- [Boards](https://github.com/gjtjdwl/insideout-front/tree/main/app/(header)/boards): Content area · Notice and inquiry boards with create and modify flows. · `app/(header)/boards`
- [Management](https://github.com/gjtjdwl/insideout-front/tree/main/app/(header)/manage): Ops area · Accepted sessions, feedback, and department management views. · `app/(header)/manage`
- [Admin web](https://github.com/gjtjdwl/insideout-front/tree/main/app/(header)/admin/web): Admin area · Department-level admin dashboard and detail views. · `app/(header)/admin/web`

### Shared platform

Reusable UI, hooks, context, constants, and types used across routes.

- [Header UI](https://github.com/gjtjdwl/insideout-front/blob/main/app/components/header.tsx): Shared UI · Common header/footer and navigation primitives. · `app/components/header.tsx`
- [Chat widgets](https://github.com/gjtjdwl/insideout-front/blob/main/app/components/Chat.tsx): Shared UI · Reusable chat components including sidebar and empty state. · `app/components/Chat.tsx`
- [Forms & modals](https://github.com/gjtjdwl/insideout-front/blob/main/app/components/LoginForm.tsx): Shared UI · Login, consent, agreement, scale, and writing components. · `app/components/LoginForm.tsx`
- [Board UI](https://github.com/gjtjdwl/insideout-front/blob/main/app/components/BoardList.tsx): Shared UI · Board list, search, pagination, and notice wrappers. · `app/components/BoardList.tsx`
- [Metrics UI](https://github.com/gjtjdwl/insideout-front/blob/main/app/components/ReCharts.tsx): Shared UI · Charts and department cards for operational summaries. · `app/components/ReCharts.tsx`
- [Session state](https://github.com/gjtjdwl/insideout-front/blob/main/app/hooks/useUser.ts): Client state · User session and account state hook/context boundary. · `app/hooks/useUser.ts`
- [Department context](https://github.com/gjtjdwl/insideout-front/blob/main/app/context/DepartmentContext.tsx): Context · Cross-cutting department selection and filtering state. · `app/context/DepartmentContext.tsx`
- [Types](https://github.com/gjtjdwl/insideout-front/blob/main/app/types/auth.ts): Contracts · Domain type definitions shared across the frontend. · `app/types/auth.ts`
- [Formatters](https://github.com/gjtjdwl/insideout-front/blob/main/app/utils/dataFormatter.ts): Utils · Data normalization and form configuration helpers. · `app/utils/dataFormatter.ts`

### Infra

Cross-cutting delivery and request boundaries.

- [Root layout](https://github.com/gjtjdwl/insideout-front/blob/main/app/layout.tsx): Next layout · Global app wrapper and shared document structure. · `app/layout.tsx`
- [API client](https://github.com/gjtjdwl/insideout-front/blob/main/app/api/index.ts): HTTP layer · Typed backend request modules for auth, chat, boards, manage, user, and admin. · `app/api/index.ts`
- [Middleware](https://github.com/gjtjdwl/insideout-front/blob/main/middleware.ts): Route guard · Pre-render access control and routing gatekeeping. · `middleware.ts`
- [Styles](https://github.com/gjtjdwl/insideout-front/blob/main/app/globals.css): Global CSS · Global styles and Tailwind-driven presentation layer. · `app/globals.css`

## Connections

- Root layout → Header shell: wraps · Root layout composes the authenticated shell.
- Root layout → No-header shell: wraps · Root layout composes the public shell.
- Root layout → Home: renders · Global routing includes the home page.
- Header shell → My page: hosts · Authenticated shell hosts account pages.
- Header shell → Boards: hosts · Authenticated shell hosts board pages.
- Header shell → Management: hosts · Authenticated shell hosts management pages.
- Header shell → Admin web: hosts · Authenticated shell hosts admin pages.
- No-header shell → Chat counseling: hosts · No-header shell hosts chat counseling.
- No-header shell → Auth flows: hosts · No-header shell hosts auth flows.
- Chat counseling → Chat widgets: uses · Chat route is assembled from reusable chat widgets.
- Auth flows → Forms & modals: uses · Authentication routes rely on shared form components.
- My page → Session state: uses · My page flows read and update session/account state.
- Boards → Board UI: uses · Board pages use list, search, and pagination UI.
- Management → Metrics UI: uses · Operational pages surface metrics and summaries.
- Admin web → Metrics UI: uses · Admin views visualize departmental insights.
- Session state → API client: calls · Session state depends on backend identity APIs.
- Chat counseling → API client: calls · Chat interactions are sent through the API client.
- Boards → API client: calls · Board content and actions flow through typed endpoints.
- Management → API client: calls · Management views consume aggregated backend data.
- Admin web → API client: calls · Admin views fetch department and web-management data.
- Header shell → Middleware: protected by · Authenticated routes are gated before rendering.
- No-header shell → Middleware: protected by · Public and focused flows are also mediated by routing rules.
- Header shell → Header UI: shares · Authenticated pages use common chrome components.
- No-header shell → Header UI: shares · Public flows still reuse shared chrome where needed.
- Chat counseling → Department context: filters · Department state can influence counseling and analytics views.
- Management → Department context: filters · Management pages use department-scoped context.
- Admin web → Department context: filters · Admin web views use department-scoped context.
- Boards → Formatters: normalizes · Board and form workflows use shared formatting helpers.
- Management → Formatters: normalizes · Operational views use shared data formatting.
- Header shell → Types: typed by · Route modules are backed by domain contracts.
- No-header shell → Types: typed by · Public flows also use shared types.
- Root layout → Styles: styles · Global styles shape the entire application.
