# flappybeans/skillswitch architecture

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

- Interactive diagram: https://gitdiagram.com/flappybeans/skillswitch
- Repository: https://github.com/flappybeans/skillswitch

## Overview

This is a Next.js skill-swapping community: users create profiles, find peers, connect, arrange and confirm sessions, and earn leaderboard points. The tree also shows messaging, skill suggestions and moderation/admin capabilities. The graph combines sampled server-rendered workflows with the major feature areas named in the source index; unsampled feature internals and their data flows are not expanded beyond indexed references.

Main entry points: [`app/(app)/sessions/page.tsx`](https://github.com/flappybeans/skillswitch/blob/main/app/(app)/sessions/page.tsx) (Session board), [`lib/auth.ts`](https://github.com/flappybeans/skillswitch/blob/main/lib/auth.ts) (Current profile), [`lib/supabase/server.ts`](https://github.com/flappybeans/skillswitch/blob/main/lib/supabase/server.ts) (Server client), [`app/(app)/connections/page.tsx`](https://github.com/flappybeans/skillswitch/blob/main/app/(app)/connections/page.tsx) (Connections)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity &amp; profiles"]
  node_authui["Login &amp; signup<br/>[login-form.tsx]"]
  node_authactions["Authentication actions<br/>[actions.ts]"]
  node_profile["Profile management<br/>[page.tsx]"]
  node_publicprofile["Public profiles<br/>[page.tsx]"]
end

subgraph group_community["Peer discovery"]
  node_discovery["Find a pair<br/>[page.tsx]"]
  node_connections["Connections<br/>[page.tsx]"]
  node_matching["Matching rules<br/>[match.ts]"]
  node_appconnectionsactions["Connection actions<br/>[actions.ts]"]
end

subgraph group_exchange["Sessions &amp; points"]
  node_sessions["Session board<br/>[page.tsx]"]
  node_sessioncreation["Session proposals<br/>[new-session.tsx]"]
  node_sessionactions["Session actions"]
  node_sessionrules["Session lifecycle<br/>[sessions.ts]"]
  node_leaderboard["Leaderboard<br/>[page.tsx]"]
end

subgraph group_operations["Messaging &amp; administration"]
  node_messaging["Messages<br/>[page.tsx]"]
  node_admin["Admin &amp; moderation<br/>[page.tsx]"]
  node_flags["Flag review<br/>[page.tsx]"]
  node_adminfeatures["Admin actions<br/>[actions.ts]"]
  node_flaglogic["Flag helpers<br/>[flags.ts]"]
end

subgraph group_platform["Application services"]
  node_supabaseclient["Server client<br/>[server.ts]"]
  node_profileauth["Current profile<br/>[auth.ts]"]
  node_database[("Supabase backend")]
end

node_visitor(("Community user"))

node_visitor -->|"signs in"| node_authui
node_authui -->|"submits credentials"| node_authactions
node_authactions -->|"creates client"| node_supabaseclient
node_profileauth -->|"creates client"| node_supabaseclient
node_discovery -->|"uses matching rules"| node_matching
node_visitor -->|"finds peers"| node_discovery
node_visitor -->|"edits profile"| node_profile
node_visitor -->|"schedules sessions"| node_sessions
node_sessions -->|"checks profile"| node_profileauth
node_sessions -->|"queries backend"| node_supabaseclient
node_sessions -->|"renders proposal form"| node_sessioncreation
node_sessions -->|"renders controls"| node_sessionactions
node_sessions -->|"groups sessions"| node_sessionrules
node_leaderboard -->|"checks profile"| node_profileauth
node_leaderboard -->|"queries rankings"| node_supabaseclient
node_connections -->|"uses profile auth"| node_profileauth
node_connections -->|"renders controls"| node_appconnectionsactions
node_messaging -->|"uses profile auth"| node_profileauth
node_admin -->|"loads admin data"| node_adminfeatures
node_flags -->|"uses flag helpers"| node_flaglogic

click node_authui "https://github.com/flappybeans/skillswitch/blob/main/app/(auth)/login/login-form.tsx"
click node_authactions "https://github.com/flappybeans/skillswitch/blob/main/app/(auth)/actions.ts"
click node_profile "https://github.com/flappybeans/skillswitch/blob/main/app/(app)/profile/page.tsx"
click node_publicprofile "https://github.com/flappybeans/skillswitch/blob/main/app/(app)/u/%5Busername%5D/page.tsx"
click node_discovery "https://github.com/flappybeans/skillswitch/blob/main/app/(app)/find-pair/page.tsx"
click node_connections "https://github.com/flappybeans/skillswitch/blob/main/app/(app)/connections/page.tsx"
click node_matching "https://github.com/flappybeans/skillswitch/blob/main/lib/match.ts"
click node_sessions "https://github.com/flappybeans/skillswitch/blob/main/app/(app)/sessions/page.tsx"
click node_sessioncreation "https://github.com/flappybeans/skillswitch/blob/main/app/(app)/sessions/new-session.tsx"
click node_sessionactions "https://github.com/flappybeans/skillswitch/blob/main/app/(app)/sessions/session-actions.tsx"
click node_sessionrules "https://github.com/flappybeans/skillswitch/blob/main/lib/sessions.ts"
click node_leaderboard "https://github.com/flappybeans/skillswitch/blob/main/app/(app)/leaderboard/page.tsx"
click node_messaging "https://github.com/flappybeans/skillswitch/blob/main/app/(app)/messages/page.tsx"
click node_admin "https://github.com/flappybeans/skillswitch/blob/main/app/(app)/admin/page.tsx"
click node_flags "https://github.com/flappybeans/skillswitch/blob/main/app/(app)/admin/flags/page.tsx"
click node_supabaseclient "https://github.com/flappybeans/skillswitch/blob/main/lib/supabase/server.ts"
click node_profileauth "https://github.com/flappybeans/skillswitch/blob/main/lib/auth.ts"
click node_appconnectionsactions "https://github.com/flappybeans/skillswitch/blob/main/app/(app)/connections/actions.ts"
click node_adminfeatures "https://github.com/flappybeans/skillswitch/blob/main/app/(app)/admin/actions.ts"
click node_flaglogic "https://github.com/flappybeans/skillswitch/blob/main/lib/flags.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_authui,node_authactions,node_profile,node_publicprofile,node_visitor toneBlue
class node_discovery,node_connections,node_matching,node_appconnectionsactions toneAmber
class node_sessions,node_sessioncreation,node_sessionactions,node_sessionrules,node_leaderboard toneMint
class node_messaging,node_admin,node_flags,node_adminfeatures,node_flaglogic toneRose
class node_supabaseclient,node_profileauth,node_database toneIndigo
```

## Components

### Identity & profiles

- [Login & signup](https://github.com/flappybeans/skillswitch/blob/main/app/(auth)/login/login-form.tsx): `app/(auth)/login/login-form.tsx`
- [Authentication actions](https://github.com/flappybeans/skillswitch/blob/main/app/(auth)/actions.ts): `app/(auth)/actions.ts`
- [Profile management](https://github.com/flappybeans/skillswitch/blob/main/app/(app)/profile/page.tsx): `app/(app)/profile/page.tsx`
- [Public profiles](https://github.com/flappybeans/skillswitch/blob/main/app/(app)/u/%5Busername%5D/page.tsx): `app/(app)/u/[username]/page.tsx`

### Peer discovery

- [Find a pair](https://github.com/flappybeans/skillswitch/blob/main/app/(app)/find-pair/page.tsx): `app/(app)/find-pair/page.tsx`
- [Connections](https://github.com/flappybeans/skillswitch/blob/main/app/(app)/connections/page.tsx): `app/(app)/connections/page.tsx`
- [Matching rules](https://github.com/flappybeans/skillswitch/blob/main/lib/match.ts): `lib/match.ts`
- [Connection actions](https://github.com/flappybeans/skillswitch/blob/main/app/(app)/connections/actions.ts): `app/(app)/connections/actions.ts`

### Sessions & points

- [Session board](https://github.com/flappybeans/skillswitch/blob/main/app/(app)/sessions/page.tsx): `app/(app)/sessions/page.tsx`
- [Session proposals](https://github.com/flappybeans/skillswitch/blob/main/app/(app)/sessions/new-session.tsx): `app/(app)/sessions/new-session.tsx`
- [Session actions](https://github.com/flappybeans/skillswitch/blob/main/app/(app)/sessions/session-actions.tsx): `app/(app)/sessions/session-actions.tsx`
- [Session lifecycle](https://github.com/flappybeans/skillswitch/blob/main/lib/sessions.ts): `lib/sessions.ts`
- [Leaderboard](https://github.com/flappybeans/skillswitch/blob/main/app/(app)/leaderboard/page.tsx): `app/(app)/leaderboard/page.tsx`

### Messaging & administration

- [Messages](https://github.com/flappybeans/skillswitch/blob/main/app/(app)/messages/page.tsx): `app/(app)/messages/page.tsx`
- [Admin & moderation](https://github.com/flappybeans/skillswitch/blob/main/app/(app)/admin/page.tsx): `app/(app)/admin/page.tsx`
- [Flag review](https://github.com/flappybeans/skillswitch/blob/main/app/(app)/admin/flags/page.tsx): `app/(app)/admin/flags/page.tsx`
- [Admin actions](https://github.com/flappybeans/skillswitch/blob/main/app/(app)/admin/actions.ts): `app/(app)/admin/actions.ts`
- [Flag helpers](https://github.com/flappybeans/skillswitch/blob/main/lib/flags.ts): `lib/flags.ts`

### Application services

- [Server client](https://github.com/flappybeans/skillswitch/blob/main/lib/supabase/server.ts): `lib/supabase/server.ts`
- [Current profile](https://github.com/flappybeans/skillswitch/blob/main/lib/auth.ts): `lib/auth.ts`
- **Supabase backend**

### Other components

- **Community user**

## Connections

- Community user → Login & signup: signs in
- Login & signup → Authentication actions: submits credentials (evidence: `app/(auth)/login/login-form.tsx`)
- Authentication actions → Server client: creates client (evidence: `app/(auth)/actions.ts`)
- Current profile → Server client: creates client (evidence: `lib/auth.ts`)
- Find a pair → Matching rules: uses matching rules (evidence: `app/(app)/find-pair/page.tsx`)
- Community user → Find a pair: finds peers
- Community user → Profile management: edits profile
- Community user → Session board: schedules sessions
- Session board → Current profile: checks profile (evidence: `app/(app)/sessions/page.tsx`)
- Session board → Server client: queries backend (evidence: `app/(app)/sessions/page.tsx`)
- Session board → Session proposals: renders proposal form (evidence: `app/(app)/sessions/page.tsx`)
- Session board → Session actions: renders controls (evidence: `app/(app)/sessions/page.tsx`)
- Session board → Session lifecycle: groups sessions (evidence: `app/(app)/sessions/page.tsx`)
- Leaderboard → Current profile: checks profile (evidence: `app/(app)/leaderboard/page.tsx`)
- Leaderboard → Server client: queries rankings (evidence: `app/(app)/leaderboard/page.tsx`)
- Connections → Current profile: uses profile auth (evidence: `app/(app)/connections/page.tsx`)
- Connections → Connection actions: renders controls (evidence: `app/(app)/connections/page.tsx`)
- Messages → Current profile: uses profile auth (evidence: `app/(app)/messages/page.tsx`)
- Admin & moderation → Admin actions: loads admin data (evidence: `app/(app)/admin/page.tsx`)
- Flag review → Flag helpers: uses flag helpers (evidence: `app/(app)/admin/flags/page.tsx`)
