# frieren-kr/on-site architecture

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

- Interactive diagram: https://gitdiagram.com/frieren-kr/on-site
- Repository: https://github.com/frieren-kr/on-site

## Overview

This is a collaborative project-planning app: organizers create projects, add sites and schedules, calculate routes, and invite participants; members then view project details and maps. Authentication and role-based access gate the workflow. The graph preserves the documented-by-source features and major UI branches; several components and integrations are unsampled, so their internal relationships are omitted where the excerpts do not establish them.

Main entry points: [`app/projects/[id]/actions.ts`](https://github.com/frieren-kr/on-site/blob/main/app/projects/%5Bid%5D/actions.ts) (Project planning actions), [`lib/prisma.ts`](https://github.com/frieren-kr/on-site/blob/main/lib/prisma.ts) (Database client), [`lib/session.ts`](https://github.com/frieren-kr/on-site/blob/main/lib/session.ts) (Session access), [`app/projects/[id]/page.tsx`](https://github.com/frieren-kr/on-site/blob/main/app/projects/%5Bid%5D/page.tsx) (Project overview)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and access"]
  node_auth_ui["Sign-in and sign-up<br/>[SignInForm.tsx]"]
  node_auth_client["Auth client<br/>[auth-client.ts]"]
  node_auth_api["Auth API<br/>[route.ts]"]
  node_auth_service["Authentication<br/>[auth.ts]"]
  node_session["Session access<br/>[session.ts]"]
  node_settings["Account settings<br/>[page.tsx]"]
  node_permissions["Project permissions<br/>[permissions.ts]"]
end

subgraph group_projects["Project management"]
  node_dashboard["Project dashboard<br/>[page.tsx]"]
  node_project_create["Create and manage projects<br/>[actions.ts]"]
  node_project_view["Project overview<br/>[page.tsx]"]
end

subgraph group_planning["Itinerary and maps"]
  node_project_actions["Project planning actions<br/>[actions.ts]"]
  node_project_tabs["Project tabs<br/>[ProjectTabs.tsx]"]
  node_site_editor["Site editor<br/>[SiteEditor.tsx]"]
  node_site_registration["Site registration map"]
  node_site_list["Site list<br/>[SiteList.tsx]"]
  node_schedule["Schedule editor"]
  node_route_view["Route view<br/>[RouteView.tsx]"]
  node_directions["Route calculation<br/>[directions.ts]"]
end

subgraph group_membership["Invitations and members"]
  node_invitations["Invitation management"]
  node_invite_actions["Invitation actions<br/>[actions.ts]"]
  node_invite_accept["Accept invitation<br/>[actions.ts]"]
end

subgraph group_infrastructure["Persistence and services"]
  node_prisma["Database client<br/>[prisma.ts]"]
  node_database[("PostgreSQL")]
  node_storage["Image object storage<br/>[r2.ts]"]
  node_environment["Environment validation<br/>[env.ts]"]
end

node_user(("User"))

node_user -->|"signs in"| node_auth_ui
node_auth_ui -->|"authenticates"| node_auth_client
node_auth_api -->|"routes requests"| node_auth_service
node_auth_client -->|"calls auth"| node_auth_service
node_auth_service -->|"persists auth data"| node_prisma
node_auth_service -.->|"reads and writes"| node_database
node_dashboard -->|"checks session"| node_session
node_dashboard -->|"loads projects"| node_prisma
node_project_create -->|"requires auth"| node_session
node_project_create -->|"checks role"| node_permissions
node_project_create -->|"creates projects"| node_prisma
node_project_view -->|"checks session"| node_session
node_project_view -->|"checks access"| node_permissions
node_project_view -->|"loads project data"| node_prisma
node_project_view -->|"renders tabs"| node_project_tabs
node_project_view -->|"renders manager"| node_invitations
node_project_tabs -->|"renders sites"| node_site_list
node_project_tabs -->|"renders schedules"| node_schedule
node_project_tabs -->|"renders routes"| node_route_view
node_project_tabs -->|"renders map"| node_site_registration
node_site_editor -->|"updates sites"| node_project_actions
node_site_registration -->|"registers sites"| node_project_actions
node_schedule -->|"manages schedules"| node_project_actions
node_invitations -->|"manages invitations"| node_invite_actions
node_invite_actions -->|"requires auth"| node_session
node_invite_actions -->|"checks organizer"| node_permissions
node_invite_actions -->|"stores invitations"| node_prisma
node_project_actions -->|"requires auth"| node_session
node_project_actions -->|"checks organizer"| node_permissions
node_project_actions -->|"stores planning data"| node_prisma
node_project_actions -->|"calculates route"| node_directions
node_project_create -->|"cleans project images"| node_storage
node_project_actions -->|"cleans site images"| node_storage
node_prisma -->|"reads configuration"| node_environment
node_storage -->|"reads configuration"| node_environment
node_directions -->|"reads configuration"| node_environment
node_permissions -->|"queries membership"| node_prisma
node_settings -->|"checks session"| node_session

click node_auth_ui "https://github.com/frieren-kr/on-site/blob/main/app/sign-in/SignInForm.tsx"
click node_auth_client "https://github.com/frieren-kr/on-site/blob/main/lib/auth-client.ts"
click node_auth_api "https://github.com/frieren-kr/on-site/blob/main/app/api/auth/%5B...all%5D/route.ts"
click node_auth_service "https://github.com/frieren-kr/on-site/blob/main/lib/auth.ts"
click node_session "https://github.com/frieren-kr/on-site/blob/main/lib/session.ts"
click node_settings "https://github.com/frieren-kr/on-site/blob/main/app/settings/page.tsx"
click node_dashboard "https://github.com/frieren-kr/on-site/blob/main/app/dashboard/page.tsx"
click node_project_create "https://github.com/frieren-kr/on-site/blob/main/app/projects/actions.ts"
click node_project_view "https://github.com/frieren-kr/on-site/blob/main/app/projects/%5Bid%5D/page.tsx"
click node_project_actions "https://github.com/frieren-kr/on-site/blob/main/app/projects/%5Bid%5D/actions.ts"
click node_project_tabs "https://github.com/frieren-kr/on-site/blob/main/components/ProjectTabs.tsx"
click node_site_editor "https://github.com/frieren-kr/on-site/blob/main/components/SiteEditor.tsx"
click node_site_registration "https://github.com/frieren-kr/on-site/blob/main/components/SiteRegisterMap.tsx"
click node_site_list "https://github.com/frieren-kr/on-site/blob/main/components/SiteList.tsx"
click node_schedule "https://github.com/frieren-kr/on-site/blob/main/components/ScheduleSection.tsx"
click node_route_view "https://github.com/frieren-kr/on-site/blob/main/components/RouteView.tsx"
click node_directions "https://github.com/frieren-kr/on-site/blob/main/lib/directions.ts"
click node_invitations "https://github.com/frieren-kr/on-site/blob/main/components/InvitationManager.tsx"
click node_invite_actions "https://github.com/frieren-kr/on-site/blob/main/app/projects/%5Bid%5D/actions.ts"
click node_invite_accept "https://github.com/frieren-kr/on-site/blob/main/app/invite/%5Btoken%5D/actions.ts"
click node_permissions "https://github.com/frieren-kr/on-site/blob/main/lib/permissions.ts"
click node_prisma "https://github.com/frieren-kr/on-site/blob/main/lib/prisma.ts"
click node_storage "https://github.com/frieren-kr/on-site/blob/main/lib/r2.ts"
click node_environment "https://github.com/frieren-kr/on-site/blob/main/lib/env.ts"

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_auth_client,node_auth_api,node_auth_service,node_session,node_settings,node_permissions,node_user toneBlue
class node_dashboard,node_project_create,node_project_view toneAmber
class node_project_actions,node_project_tabs,node_site_editor,node_site_registration,node_site_list,node_schedule,node_route_view,node_directions toneMint
class node_invitations,node_invite_actions,node_invite_accept toneRose
class node_prisma,node_database,node_storage,node_environment toneIndigo
```

## Components

### Identity and access

- [Sign-in and sign-up](https://github.com/frieren-kr/on-site/blob/main/app/sign-in/SignInForm.tsx): `app/sign-in/SignInForm.tsx`
- [Auth client](https://github.com/frieren-kr/on-site/blob/main/lib/auth-client.ts): `lib/auth-client.ts`
- [Auth API](https://github.com/frieren-kr/on-site/blob/main/app/api/auth/%5B...all%5D/route.ts): `app/api/auth/[...all]/route.ts`
- [Authentication](https://github.com/frieren-kr/on-site/blob/main/lib/auth.ts): `lib/auth.ts`
- [Session access](https://github.com/frieren-kr/on-site/blob/main/lib/session.ts): `lib/session.ts`
- [Account settings](https://github.com/frieren-kr/on-site/blob/main/app/settings/page.tsx): `app/settings/page.tsx`
- [Project permissions](https://github.com/frieren-kr/on-site/blob/main/lib/permissions.ts): `lib/permissions.ts`

### Project management

- [Project dashboard](https://github.com/frieren-kr/on-site/blob/main/app/dashboard/page.tsx): `app/dashboard/page.tsx`
- [Create and manage projects](https://github.com/frieren-kr/on-site/blob/main/app/projects/actions.ts): `app/projects/actions.ts`
- [Project overview](https://github.com/frieren-kr/on-site/blob/main/app/projects/%5Bid%5D/page.tsx): `app/projects/[id]/page.tsx`

### Itinerary and maps

- [Project planning actions](https://github.com/frieren-kr/on-site/blob/main/app/projects/%5Bid%5D/actions.ts): `app/projects/[id]/actions.ts`
- [Project tabs](https://github.com/frieren-kr/on-site/blob/main/components/ProjectTabs.tsx): `components/ProjectTabs.tsx`
- [Site editor](https://github.com/frieren-kr/on-site/blob/main/components/SiteEditor.tsx): `components/SiteEditor.tsx`
- [Site registration map](https://github.com/frieren-kr/on-site/blob/main/components/SiteRegisterMap.tsx): `components/SiteRegisterMap.tsx`
- [Site list](https://github.com/frieren-kr/on-site/blob/main/components/SiteList.tsx): `components/SiteList.tsx`
- [Schedule editor](https://github.com/frieren-kr/on-site/blob/main/components/ScheduleSection.tsx): `components/ScheduleSection.tsx`
- [Route view](https://github.com/frieren-kr/on-site/blob/main/components/RouteView.tsx): `components/RouteView.tsx`
- [Route calculation](https://github.com/frieren-kr/on-site/blob/main/lib/directions.ts): `lib/directions.ts`

### Invitations and members

- [Invitation management](https://github.com/frieren-kr/on-site/blob/main/components/InvitationManager.tsx): `components/InvitationManager.tsx`
- [Invitation actions](https://github.com/frieren-kr/on-site/blob/main/app/projects/%5Bid%5D/actions.ts): `app/projects/[id]/actions.ts`
- [Accept invitation](https://github.com/frieren-kr/on-site/blob/main/app/invite/%5Btoken%5D/actions.ts): `app/invite/[token]/actions.ts`

### Persistence and services

- [Database client](https://github.com/frieren-kr/on-site/blob/main/lib/prisma.ts): `lib/prisma.ts`
- **PostgreSQL**
- [Image object storage](https://github.com/frieren-kr/on-site/blob/main/lib/r2.ts): `lib/r2.ts`
- [Environment validation](https://github.com/frieren-kr/on-site/blob/main/lib/env.ts): `lib/env.ts`

### Other components

- **User**

## Connections

- User → Sign-in and sign-up: signs in
- Sign-in and sign-up → Auth client: authenticates (evidence: `app/sign-in/SignInForm.tsx`)
- Auth API → Authentication: routes requests (evidence: `app/api/auth/[...all]/route.ts`)
- Auth client → Authentication: calls auth (evidence: `lib/auth-client.ts`)
- Authentication → Database client: persists auth data (evidence: `lib/auth.ts`)
- Authentication → PostgreSQL: reads and writes
- Project dashboard → Session access: checks session (evidence: `app/dashboard/page.tsx`)
- Project dashboard → Database client: loads projects (evidence: `app/dashboard/page.tsx`)
- Create and manage projects → Session access: requires auth (evidence: `app/projects/actions.ts`)
- Create and manage projects → Project permissions: checks role (evidence: `app/projects/actions.ts`)
- Create and manage projects → Database client: creates projects (evidence: `app/projects/actions.ts`)
- Project overview → Session access: checks session (evidence: `app/projects/[id]/page.tsx`)
- Project overview → Project permissions: checks access (evidence: `app/projects/[id]/page.tsx`)
- Project overview → Database client: loads project data (evidence: `app/projects/[id]/page.tsx`)
- Project overview → Project tabs: renders tabs (evidence: `app/projects/[id]/page.tsx`)
- Project overview → Invitation management: renders manager (evidence: `app/projects/[id]/page.tsx`)
- Project tabs → Site list: renders sites (evidence: `components/ProjectTabs.tsx`)
- Project tabs → Schedule editor: renders schedules (evidence: `components/ProjectTabs.tsx`)
- Project tabs → Route view: renders routes (evidence: `components/ProjectTabs.tsx`)
- Project tabs → Site registration map: renders map (evidence: `components/ProjectTabs.tsx`)
- Site editor → Project planning actions: updates sites (evidence: `components/SiteEditor.tsx`)
- Site registration map → Project planning actions: registers sites (evidence: `components/SiteRegisterMap.tsx`)
- Schedule editor → Project planning actions: manages schedules (evidence: `components/ScheduleSection.tsx`)
- Invitation management → Invitation actions: manages invitations (evidence: `components/InvitationManager.tsx`)
- Invitation actions → Session access: requires auth (evidence: `app/projects/[id]/actions.ts`)
- Invitation actions → Project permissions: checks organizer (evidence: `app/projects/[id]/actions.ts`)
- Invitation actions → Database client: stores invitations (evidence: `app/projects/[id]/actions.ts`)
- Project planning actions → Session access: requires auth (evidence: `app/projects/[id]/actions.ts`)
- Project planning actions → Project permissions: checks organizer (evidence: `app/projects/[id]/actions.ts`)
- Project planning actions → Database client: stores planning data (evidence: `app/projects/[id]/actions.ts`)
- Project planning actions → Route calculation: calculates route (evidence: `app/projects/[id]/actions.ts`)
- Create and manage projects → Image object storage: cleans project images (evidence: `app/projects/actions.ts`)
- Project planning actions → Image object storage: cleans site images (evidence: `app/projects/[id]/actions.ts`)
- Database client → Environment validation: reads configuration (evidence: `lib/prisma.ts`)
- Image object storage → Environment validation: reads configuration (evidence: `lib/r2.ts`)
- Route calculation → Environment validation: reads configuration (evidence: `lib/directions.ts`)
- Project permissions → Database client: queries membership (evidence: `lib/permissions.ts`)
- Account settings → Session access: checks session (evidence: `app/settings/page.tsx`)
