# bhuvanshankar45/lunaris architecture

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

- Interactive diagram: https://gitdiagram.com/bhuvanshankar45/lunaris
- Repository: https://github.com/bhuvanshankar45/lunaris

## Overview

Lunaris is a privacy-first messaging and calling application. The main journey is account creation and identity setup, mutual-consent connections, local encrypted conversations relayed as opaque packets, and private calls; profile, privacy, and settings screens support that journey. The page-level controller connects the major screens, while API routes and server storage handle identity, connections, privacy actions, and relay packets. The README documents additional chat, group-call, and security capabilities; where their wiring was not shown, relationships are omitted or marked unverified.

Main entry points: [`src/app/page.tsx`](https://github.com/bhuvanshankar45/lunaris/blob/main/src/app/page.tsx) (App controller), [`src/components/auth/AuthModal.tsx`](https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/auth/AuthModal.tsx) (Authentication), [`src/components/chat/ChatView.tsx`](https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/chat/ChatView.tsx) (Messaging), [`src/lib/server/storage.ts`](https://github.com/bhuvanshankar45/lunaris/blob/main/src/lib/server/storage.ts) (Server storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_app["App controller<br/>[page.tsx]"]
  node_welcome["Welcome screen<br/>[WelcomeScreen.tsx]"]
  node_auth["Authentication<br/>[AuthModal.tsx]"]
  node_dashboard["Dashboard<br/>[DashboardView.tsx]"]
  node_connections["Connections"]
  node_chat["Messaging<br/>[ChatView.tsx]"]
  node_lobby["Call lobby<br/>[CallLobby.tsx]"]
  node_call["Calls and group grid<br/>[CallView.tsx]"]
  node_profile["Profile<br/>[ProfileView.tsx]"]
  node_privacy["Privacy controls<br/>[PrivacyView.tsx]"]
  node_settings["Settings<br/>[SettingsView.tsx]"]
end

subgraph group_security["Identity and encryption"]
  node_identity["ID generation<br/>[id-generator.ts]"]
  node_primitives["Crypto primitives<br/>[primitives.ts]"]
  node_ratchet["Double Ratchet<br/>[double-ratchet.ts]"]
  node_files["File encryption<br/>[file-encryption.ts]"]
end

subgraph group_server["API and relay"]
  node_register["Registration API<br/>[route.ts]"]
  node_login["Login API<br/>[route.ts]"]
  node_connection_api["Connection APIs<br/>[route.ts]"]
  node_lookup["User lookup API<br/>[route.ts]"]
  node_privacy_api["Privacy APIs<br/>[route.ts]"]
  node_relay_api["Relay APIs<br/>[route.ts]"]
  node_store[("Server storage<br/>[storage.ts]")]
end

subgraph group_local["Local state"]
  node_vault[("Encrypted local vault<br/>[vault.ts]")]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_welcome
node_app -->|"renders"| node_auth
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_connections
node_app -->|"renders"| node_chat
node_app -->|"renders"| node_lobby
node_app -->|"renders"| node_call
node_app -->|"renders"| node_profile
node_app -->|"renders"| node_privacy
node_app -->|"renders"| node_settings
node_auth -->|"generates keys"| node_primitives
node_auth -->|"generates ID"| node_identity
node_auth -->|"submits registration"| node_register
node_register -->|"generates ID"| node_identity
node_register -->|"registers user"| node_store
node_login -->|"checks account"| node_store
node_connections -.->|"requests connection"| node_connection_api
node_connections -.->|"looks up ID"| node_lookup
node_privacy -.->|"requests deletion"| node_privacy_api
node_privacy_api -->|"purges packets"| node_store
node_relay_api -->|"relays packets"| node_store
node_ratchet -->|"derives keys"| node_primitives
node_files -->|"encrypts files"| node_primitives
node_app -->|"uses local state"| node_vault
node_settings -->|"updates preferences"| node_vault
node_chat -.->|"encrypts messages"| node_ratchet
node_chat -.->|"encrypts media"| node_files
node_chat -.->|"sends packets"| node_relay_api
node_lobby -.->|"enters call"| node_call

click node_app "https://github.com/bhuvanshankar45/lunaris/blob/main/src/app/page.tsx"
click node_welcome "https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/auth/WelcomeScreen.tsx"
click node_auth "https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/auth/AuthModal.tsx"
click node_dashboard "https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/dashboard/DashboardView.tsx"
click node_connections "https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/connections/ConnectionsView.tsx"
click node_chat "https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/chat/ChatView.tsx"
click node_lobby "https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/calling/CallLobby.tsx"
click node_call "https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/calling/CallView.tsx"
click node_profile "https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/profile/ProfileView.tsx"
click node_privacy "https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/privacy/PrivacyView.tsx"
click node_settings "https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/settings/SettingsView.tsx"
click node_identity "https://github.com/bhuvanshankar45/lunaris/blob/main/src/lib/crypto/id-generator.ts"
click node_primitives "https://github.com/bhuvanshankar45/lunaris/blob/main/src/lib/crypto/primitives.ts"
click node_ratchet "https://github.com/bhuvanshankar45/lunaris/blob/main/src/lib/crypto/double-ratchet.ts"
click node_files "https://github.com/bhuvanshankar45/lunaris/blob/main/src/lib/crypto/file-encryption.ts"
click node_vault "https://github.com/bhuvanshankar45/lunaris/blob/main/src/lib/storage/vault.ts"
click node_register "https://github.com/bhuvanshankar45/lunaris/blob/main/src/app/api/auth/register/route.ts"
click node_login "https://github.com/bhuvanshankar45/lunaris/blob/main/src/app/api/auth/login/route.ts"
click node_connection_api "https://github.com/bhuvanshankar45/lunaris/blob/main/src/app/api/connections/request/route.ts"
click node_lookup "https://github.com/bhuvanshankar45/lunaris/blob/main/src/app/api/users/lookup/route.ts"
click node_privacy_api "https://github.com/bhuvanshankar45/lunaris/blob/main/src/app/api/privacy/clear-chat/route.ts"
click node_relay_api "https://github.com/bhuvanshankar45/lunaris/blob/main/src/app/api/relay/send/route.ts"
click node_store "https://github.com/bhuvanshankar45/lunaris/blob/main/src/lib/server/storage.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_app,node_welcome,node_auth,node_dashboard,node_connections,node_chat,node_lobby,node_call,node_profile,node_privacy,node_settings,node_user toneBlue
class node_identity,node_primitives,node_ratchet,node_files toneAmber
class node_register,node_login,node_connection_api,node_lookup,node_privacy_api,node_relay_api,node_store toneMint
class node_vault toneRose
```

## Components

### Client experience

- [App controller](https://github.com/bhuvanshankar45/lunaris/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Welcome screen](https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/auth/WelcomeScreen.tsx): `src/components/auth/WelcomeScreen.tsx`
- [Authentication](https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/auth/AuthModal.tsx): `src/components/auth/AuthModal.tsx`
- [Dashboard](https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/dashboard/DashboardView.tsx): `src/components/dashboard/DashboardView.tsx`
- [Connections](https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/connections/ConnectionsView.tsx): `src/components/connections/ConnectionsView.tsx`
- [Messaging](https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/chat/ChatView.tsx): `src/components/chat/ChatView.tsx`
- [Call lobby](https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/calling/CallLobby.tsx): `src/components/calling/CallLobby.tsx`
- [Calls and group grid](https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/calling/CallView.tsx): `src/components/calling/CallView.tsx`
- [Profile](https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/profile/ProfileView.tsx): `src/components/profile/ProfileView.tsx`
- [Privacy controls](https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/privacy/PrivacyView.tsx): `src/components/privacy/PrivacyView.tsx`
- [Settings](https://github.com/bhuvanshankar45/lunaris/blob/main/src/components/settings/SettingsView.tsx): `src/components/settings/SettingsView.tsx`

### Identity and encryption

- [ID generation](https://github.com/bhuvanshankar45/lunaris/blob/main/src/lib/crypto/id-generator.ts): `src/lib/crypto/id-generator.ts`
- [Crypto primitives](https://github.com/bhuvanshankar45/lunaris/blob/main/src/lib/crypto/primitives.ts): `src/lib/crypto/primitives.ts`
- [Double Ratchet](https://github.com/bhuvanshankar45/lunaris/blob/main/src/lib/crypto/double-ratchet.ts): `src/lib/crypto/double-ratchet.ts`
- [File encryption](https://github.com/bhuvanshankar45/lunaris/blob/main/src/lib/crypto/file-encryption.ts): `src/lib/crypto/file-encryption.ts`

### API and relay

- [Registration API](https://github.com/bhuvanshankar45/lunaris/blob/main/src/app/api/auth/register/route.ts): `src/app/api/auth/register/route.ts`
- [Login API](https://github.com/bhuvanshankar45/lunaris/blob/main/src/app/api/auth/login/route.ts): `src/app/api/auth/login/route.ts`
- [Connection APIs](https://github.com/bhuvanshankar45/lunaris/blob/main/src/app/api/connections/request/route.ts): `src/app/api/connections/request/route.ts`
- [User lookup API](https://github.com/bhuvanshankar45/lunaris/blob/main/src/app/api/users/lookup/route.ts): `src/app/api/users/lookup/route.ts`
- [Privacy APIs](https://github.com/bhuvanshankar45/lunaris/blob/main/src/app/api/privacy/clear-chat/route.ts): `src/app/api/privacy/clear-chat/route.ts`
- [Relay APIs](https://github.com/bhuvanshankar45/lunaris/blob/main/src/app/api/relay/send/route.ts): `src/app/api/relay/send/route.ts`
- [Server storage](https://github.com/bhuvanshankar45/lunaris/blob/main/src/lib/server/storage.ts): `src/lib/server/storage.ts`

### Local state

- [Encrypted local vault](https://github.com/bhuvanshankar45/lunaris/blob/main/src/lib/storage/vault.ts): `src/lib/storage/vault.ts`

### Other components

- **User**

## Connections

- User → App controller: uses (evidence: `README.md`)
- App controller → Welcome screen: renders (evidence: `src/app/page.tsx`)
- App controller → Authentication: renders (evidence: `src/app/page.tsx`)
- App controller → Dashboard: renders (evidence: `src/app/page.tsx`)
- App controller → Connections: renders (evidence: `src/app/page.tsx`)
- App controller → Messaging: renders (evidence: `src/app/page.tsx`)
- App controller → Call lobby: renders (evidence: `src/app/page.tsx`)
- App controller → Calls and group grid: renders (evidence: `src/app/page.tsx`)
- App controller → Profile: renders (evidence: `src/app/page.tsx`)
- App controller → Privacy controls: renders (evidence: `src/app/page.tsx`)
- App controller → Settings: renders (evidence: `src/app/page.tsx`)
- Authentication → Crypto primitives: generates keys (evidence: `src/components/auth/AuthModal.tsx`)
- Authentication → ID generation: generates ID (evidence: `src/components/auth/AuthModal.tsx`)
- Authentication → Registration API: submits registration (evidence: `src/components/auth/AuthModal.tsx`)
- Registration API → ID generation: generates ID (evidence: `src/app/api/auth/register/route.ts`)
- Registration API → Server storage: registers user (evidence: `src/app/api/auth/register/route.ts`)
- Login API → Server storage: checks account (evidence: `src/app/api/auth/login/route.ts`)
- Connections → Connection APIs: requests connection
- Connections → User lookup API: looks up ID
- Privacy controls → Privacy APIs: requests deletion
- Privacy APIs → Server storage: purges packets (evidence: `src/app/api/privacy/clear-chat/route.ts`)
- Relay APIs → Server storage: relays packets (evidence: `src/app/api/relay/send/route.ts`)
- Double Ratchet → Crypto primitives: derives keys (evidence: `src/lib/crypto/double-ratchet.ts`)
- File encryption → Crypto primitives: encrypts files (evidence: `src/lib/crypto/file-encryption.ts`)
- App controller → Encrypted local vault: uses local state (evidence: `src/app/page.tsx`)
- Settings → Encrypted local vault: updates preferences (evidence: `src/components/settings/SettingsView.tsx`)
- Messaging → Double Ratchet: encrypts messages
- Messaging → File encryption: encrypts media
- Messaging → Relay APIs: sends packets
- Call lobby → Calls and group grid: enters call
