# davefatkin/einvault architecture

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

- Interactive diagram: https://gitdiagram.com/davefatkin/einvault
- Repository: https://github.com/davefatkin/einvault

## Overview

EinVault is a self-hosted animal-companion care tracker. Members and caretakers use role-specific pages to maintain companion records, log daily activity, review journals and health history, and manage reminders; administrators manage users and companions. Server routes and services support these workflows, with SQLite as the documented local store. The README also describes search, calendar feeds, bearer-token access, and optional media/document integrations. Some subsystem paths and connections below reflect documented capabilities only; unsampled implementation wiring is not asserted.

Main entry points: [`src/lib/server/auth`](https://github.com/davefatkin/einvault/tree/main/src/lib/server/auth) (Authentication), [`src/routes/(app)/+page.server.ts`](https://github.com/davefatkin/einvault/blob/main/src/routes/(app)/%2Bpage.server.ts) (Activity dashboard), [`src/lib/server/db/index.ts`](https://github.com/davefatkin/einvault/blob/main/src/lib/server/db/index.ts) (SQLite database), [`src/hooks.server.ts`](https://github.com/davefatkin/einvault/blob/main/src/hooks.server.ts) (Request guards)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and accounts"]
  node_auth["Authentication"]
  node_request_hooks["Request guards<br/>[hooks.server.ts]"]
  node_admin["Admin workflows"]
end

subgraph group_care["Companion care"]
  node_member_app["Member workflows"]
  node_dashboard["Activity dashboard<br/>[+page.server.ts]"]
  node_caretaker["Caretaker workflows"]
  node_daily_events["Activity logging<br/>[daily-events.ts]"]
  node_journal["Journal and media<br/>[journal.ts]"]
  node_health["Health records<br/>[health.ts]"]
  node_notes["Companion notes<br/>[notes.ts]"]
  node_reminders["Care reminders<br/>[reminders.ts]"]
  node_quick_logs["Quick logs<br/>[quick-logs.ts]"]
end

subgraph group_platform["Shared platform"]
  node_database[("SQLite database<br/>[index.ts]")]
  node_schema["Data schema<br/>[schema.ts]"]
  node_search["Unified search<br/>[search.ts]"]
  node_calendar["Calendar feeds<br/>[calendar.ts]"]
end

subgraph group_integrations["APIs and integrations"]
  node_api["Bearer API"]
  node_media_storage["Media storage"]
  node_video["Video processing<br/>[worker.ts]"]
  node_external_services["Optional services"]
end

node_user(("People"))

node_user -->|"sends requests"| node_request_hooks
node_request_hooks -->|"validates session"| node_auth
node_user -->|"uses care pages"| node_member_app
node_user -->|"logs care"| node_caretaker
node_user -->|"manages app"| node_admin
node_dashboard -->|"logs events"| node_daily_events
node_dashboard -->|"lists buttons"| node_quick_logs
node_dashboard -->|"handles reminders"| node_reminders
node_user -->|"uses headless API"| node_api
node_user -->|"searches records"| node_search
node_user -->|"subscribes to feed"| node_calendar
node_database -->|"uses schema"| node_schema
node_external_services -.->|"stores media"| node_media_storage
node_media_storage -.->|"supplies source media"| node_video
node_external_services -.->|"optional integrations"| node_api
node_auth -->|"persists enrollment"| node_database
node_auth -->|"stores encrypted secret"| node_database
node_auth -->|"verifies codes"| node_auth

click node_auth "https://github.com/davefatkin/einvault/tree/main/src/lib/server/auth"
click node_request_hooks "https://github.com/davefatkin/einvault/blob/main/src/hooks.server.ts"
click node_admin "https://github.com/davefatkin/einvault/tree/main/src/routes/(app)/(admin)"
click node_member_app "https://github.com/davefatkin/einvault/tree/main/src/routes/(app)/(companion)"
click node_dashboard "https://github.com/davefatkin/einvault/blob/main/src/routes/(app)/%2Bpage.server.ts"
click node_caretaker "https://github.com/davefatkin/einvault/tree/main/src/routes/(caretaker)"
click node_daily_events "https://github.com/davefatkin/einvault/blob/main/src/lib/server/daily-events.ts"
click node_journal "https://github.com/davefatkin/einvault/blob/main/src/lib/server/journal.ts"
click node_health "https://github.com/davefatkin/einvault/blob/main/src/lib/server/health.ts"
click node_notes "https://github.com/davefatkin/einvault/blob/main/src/lib/server/notes.ts"
click node_reminders "https://github.com/davefatkin/einvault/blob/main/src/lib/server/reminders.ts"
click node_quick_logs "https://github.com/davefatkin/einvault/blob/main/src/lib/server/quick-logs.ts"
click node_database "https://github.com/davefatkin/einvault/blob/main/src/lib/server/db/index.ts"
click node_schema "https://github.com/davefatkin/einvault/blob/main/src/lib/server/db/schema.ts"
click node_search "https://github.com/davefatkin/einvault/blob/main/src/lib/server/search.ts"
click node_calendar "https://github.com/davefatkin/einvault/blob/main/src/lib/server/calendar.ts"
click node_api "https://github.com/davefatkin/einvault/tree/main/src/routes/api"
click node_media_storage "https://github.com/davefatkin/einvault/tree/main/src/lib/server/storage"
click node_video "https://github.com/davefatkin/einvault/blob/main/src/lib/server/video/worker.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,node_request_hooks,node_admin toneBlue
class node_member_app,node_dashboard,node_caretaker,node_daily_events,node_journal,node_health,node_notes,node_reminders,node_quick_logs toneAmber
class node_database,node_schema,node_search,node_calendar toneMint
class node_api,node_media_storage,node_video,node_external_services toneRose
class node_user toneIndigo
```

## Components

### Access and accounts

- [Authentication](https://github.com/davefatkin/einvault/tree/main/src/lib/server/auth): `src/lib/server/auth`
- [Request guards](https://github.com/davefatkin/einvault/blob/main/src/hooks.server.ts): `src/hooks.server.ts`
- [Admin workflows](https://github.com/davefatkin/einvault/tree/main/src/routes/(app)/(admin)): `src/routes/(app)/(admin)`

### Companion care

- [Member workflows](https://github.com/davefatkin/einvault/tree/main/src/routes/(app)/(companion)): `src/routes/(app)/(companion)`
- [Activity dashboard](https://github.com/davefatkin/einvault/blob/main/src/routes/(app)/%2Bpage.server.ts): `src/routes/(app)/+page.server.ts`
- [Caretaker workflows](https://github.com/davefatkin/einvault/tree/main/src/routes/(caretaker)): `src/routes/(caretaker)`
- [Activity logging](https://github.com/davefatkin/einvault/blob/main/src/lib/server/daily-events.ts): `src/lib/server/daily-events.ts`
- [Journal and media](https://github.com/davefatkin/einvault/blob/main/src/lib/server/journal.ts): `src/lib/server/journal.ts`
- [Health records](https://github.com/davefatkin/einvault/blob/main/src/lib/server/health.ts): `src/lib/server/health.ts`
- [Companion notes](https://github.com/davefatkin/einvault/blob/main/src/lib/server/notes.ts): `src/lib/server/notes.ts`
- [Care reminders](https://github.com/davefatkin/einvault/blob/main/src/lib/server/reminders.ts): `src/lib/server/reminders.ts`
- [Quick logs](https://github.com/davefatkin/einvault/blob/main/src/lib/server/quick-logs.ts): `src/lib/server/quick-logs.ts`

### Shared platform

- [SQLite database](https://github.com/davefatkin/einvault/blob/main/src/lib/server/db/index.ts): `src/lib/server/db/index.ts`
- [Data schema](https://github.com/davefatkin/einvault/blob/main/src/lib/server/db/schema.ts): `src/lib/server/db/schema.ts`
- [Unified search](https://github.com/davefatkin/einvault/blob/main/src/lib/server/search.ts): `src/lib/server/search.ts`
- [Calendar feeds](https://github.com/davefatkin/einvault/blob/main/src/lib/server/calendar.ts): `src/lib/server/calendar.ts`

### APIs and integrations

- [Bearer API](https://github.com/davefatkin/einvault/tree/main/src/routes/api): `src/routes/api`
- [Media storage](https://github.com/davefatkin/einvault/tree/main/src/lib/server/storage): `src/lib/server/storage`
- [Video processing](https://github.com/davefatkin/einvault/blob/main/src/lib/server/video/worker.ts): `src/lib/server/video/worker.ts`
- **Optional services**

### Other components

- **People**

## Connections

- People → Request guards: sends requests (evidence: `src/hooks.server.ts`)
- Request guards → Authentication: validates session (evidence: `src/hooks.server.ts`)
- People → Member workflows: uses care pages (evidence: `README.md`)
- People → Caretaker workflows: logs care (evidence: `README.md`)
- People → Admin workflows: manages app (evidence: `README.md`)
- Activity dashboard → Activity logging: logs events (evidence: `src/routes/(app)/+page.server.ts`)
- Activity dashboard → Quick logs: lists buttons (evidence: `src/routes/(app)/+page.server.ts`)
- Activity dashboard → Care reminders: handles reminders (evidence: `src/routes/(app)/+page.server.ts`)
- People → Bearer API: uses headless API (evidence: `README.md`)
- People → Unified search: searches records (evidence: `README.md`)
- People → Calendar feeds: subscribes to feed (evidence: `README.md`)
- SQLite database → Data schema: uses schema (evidence: `src/lib/server/db/index.ts`)
- Optional services → Media storage: stores media (evidence: `README.md`)
- Media storage → Video processing: supplies source media
- Optional services → Bearer API: optional integrations (evidence: `README.md`)
- Authentication → SQLite database: persists enrollment (evidence: `src/lib/server/auth/enrollment.ts`)
- Authentication → SQLite database: stores encrypted secret (evidence: `src/lib/server/auth/enrollment.ts`)
- Authentication → Authentication: verifies codes (evidence: `src/lib/server/auth/enrollment.ts`)
