How gjtjdwl/insideout-front works
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: (header) Header shell · (noheader) No-header shell · manage Management · index.ts API client
Components 22
Route shells
Top-level routing boundaries that separate public and authenticated experiences.
- Header shell · Authenticated/internal experience with the common header.
app/(header) - No-header shell · Minimal-entry flows for chat and authentication.
app/(noheader)
Product flows
User-facing domains for counseling, account, boards, and operations.
- Home · Top-level entry page for the app.
app/page.tsx - Chat counseling · Primary AI counseling experience and chat entry points.
app/(noheader)/chat - Auth flows · Login and registration routes.
app/(noheader)/login - My page · Profile, edit, verification, and counseling log views.
app/(header)/mypage - Boards · Notice and inquiry boards with create and modify flows.
app/(header)/boards - Management · Accepted sessions, feedback, and department management views.
app/(header)/manage - Admin web · 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 · Common header/footer and navigation primitives.
app/components/header.tsx - Chat widgets · Reusable chat components including sidebar and empty state.
app/components/Chat.tsx - Forms & modals · Login, consent, agreement, scale, and writing components.
app/components/LoginForm.tsx - Board UI · Board list, search, pagination, and notice wrappers.
app/components/BoardList.tsx - Metrics UI · Charts and department cards for operational summaries.
app/components/ReCharts.tsx - Session state · User session and account state hook/context boundary.
app/hooks/useUser.ts - Department context · Cross-cutting department selection and filtering state.
app/context/DepartmentContext.tsx - Types · Domain type definitions shared across the frontend.
app/types/auth.ts - Formatters · Data normalization and form configuration helpers.
app/utils/dataFormatter.ts
Infra
Cross-cutting delivery and request boundaries.
- Root layout · Global app wrapper and shared document structure.
app/layout.tsx - API client · Typed backend request modules for auth, chat, boards, manage, user, and admin.
app/api/index.ts - Middleware · Pre-render access control and routing gatekeeping.
middleware.ts - Styles · Global styles and Tailwind-driven presentation layer.
app/globals.css
Connections 32
- 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.