# addy015/mykeeper architecture

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

- Interactive diagram: https://gitdiagram.com/addy015/mykeeper
- Repository: https://github.com/addy015/mykeeper

## Overview

#### Purpose and Runtime
MyKeeper is a Next.js 16 App Router file-storage dashboard. It provides authenticated users a workspace to upload, browse, search, organize, and manage files, backed by Appwrite authentication, database, and storage services. It runs as a Node.js/Next.js application with React 19 and Tailwind CSS v4.

#### Application Entry and Route Shells
The global application shell and styling originate at `app/layout.js` and `app/globals.css`. Route groups split unauthenticated and authenticated/dashboard experiences:
- Auth shell: `app/(auth)/layout.js`
- Main workspace shell: `app/(root)/layout.js`
- Dashboard landing route: `app/(root)/page.js`

This separation is the primary UI/control boundary between account access and file-management operations.

#### Authentication Lifecycle
Authentication UI begins at `app/(auth)/sign-in/page.js`; callback completion is handled by `app/auth/callback/page.js`. User/session interactions are centralized in `lib/actions/user.actions.js`, which should act as the Appwrite-facing boundary for registration, login, session lookup, and logout rather than embedding backend access in route components.

#### File Workspace and Navigation
The dashboard’s primary file views are the root landing page and type-filtered dynamic route:
- `app/(root)/page.js`
- `app/(root)/[type]/page.js`

`components/Sidebar.jsx` supplies workspace navigation, while `components/Topbar.jsx` is the likely global command/search surface. `components/SortDropdown.jsx` controls presentation ordering. The expected flow is route selection/filtering → file retrieval/action layer → rendered file list/cards.

#### File Domain and Mutations
`lib/actions/file.actions.js` is the core file-domain boundary: it should coordinate Appwrite storage objects and associated metadata records for upload, retrieval, search, rename, sharing, and deletion. `components/FileCard.jsx` renders individual file entities, and the modal components isolate destructive or metadata-changing interactions:
- `components/modals/DeleteModal.jsx`
- `components/modals/RenameModal.jsx`
- `components/modals/ShareModal.jsx`

These UI components initiate mutations, while the action layer owns persistence and Appwrite integration.

#### Storage Visibility
`components/StorageSummary.jsx` presents aggregate storage usage, requiring file metadata or Appwrite storage totals to flow from the backend/action layer into the dashboard. File details are exposed separately through `components/modals/DetailsModal.jsx`, keeping inspection distinct from mutation flows.

#### Backend and Service Boundaries
Appwrite client/service initialization is centralized in `lib/appwrite.js`; environment-provided endpoint, project, and resource identifiers configure the external BaaS connection. Appwrite supplies the material infrastructure for authentication, database metadata, and binary file storage. `lib/utils.js` and `lib/plain.js` support shared application transformations or plain-data boundaries.

A small application health/integration endpoint exists at `app/api/ping/route.js`, with `components/AppwritePing.js` providing a UI-side probe. This establishes a lightweight boundary for checking service availability without coupling all dashboard rendering to direct connectivity checks.

Main entry points: [`lib/actions/file.actions.js`](https://github.com/addy015/mykeeper/blob/main/lib/actions/file.actions.js) (File actions), [`lib/appwrite.js`](https://github.com/addy015/mykeeper/blob/main/lib/appwrite.js) (Appwrite client), [`app/(root)/layout.js`](https://github.com/addy015/mykeeper/blob/main/app/(root)/layout.js) (Workspace shell), [`app/(root)/page.js`](https://github.com/addy015/mykeeper/blob/main/app/(root)/page.js) (Dashboard landing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["UI shells and workspace"]
  node_app_shell["Global app shell<br/>Next.js layout<br/>[layout.js]"]
  node_workspace_shell["Workspace shell<br/>Route-group layout<br/>[layout.js]"]
  node_dashboard["Dashboard landing<br/>Workspace route<br/>[page.js]"]
  node_type_view["Type-filtered files<br/>Dynamic workspace route<br/>[page.js]"]
  node_navigation["Sidebar navigation<br/>Workspace navigation<br/>[Sidebar.jsx]"]
  node_commands["Topbar search<br/>Command surface<br/>[Topbar.jsx]"]
  node_sorting["Sort controls<br/>Presentation control<br/>[SortDropdown.jsx]"]
end

subgraph group_auth["Authentication"]
  node_auth_shell["Auth shell<br/>Route-group layout<br/>[layout.js]"]
  node_sign_in["Sign-in page<br/>Auth route<br/>[page.js]"]
  node_auth_callback["Auth callback<br/>Callback route<br/>[page.js]"]
  node_user_actions{{"User actions<br/>Auth action layer<br/>[user.actions.js]"}}
end

subgraph group_files["File domain"]
  node_file_cards["File cards<br/>File renderer<br/>[FileCard.jsx]"]
  node_file_modals["File management modals<br/>Mutation and detail UI<br/>[DeleteModal.jsx]"]
  node_storage_summary["Storage summary<br/>Usage renderer<br/>[StorageSummary.jsx]"]
  node_file_actions{{"File actions<br/>File domain layer<br/>[file.actions.js]"}}
end

subgraph group_services["Service boundary"]
  node_appwrite_client{{"Appwrite client<br/>BaaS initialization<br/>[appwrite.js]"}}
  node_appwrite[("Appwrite services<br/>External BaaS")]
  node_ping_api{{"Service ping endpoint<br/>API route<br/>[route.js]"}}
  node_ping_ui["Appwrite ping probe<br/>Health UI<br/>[AppwritePing.js]"]
end

node_app_shell -->|"wraps"| node_auth_shell
node_app_shell -->|"wraps"| node_workspace_shell
node_auth_shell -->|"hosts"| node_sign_in
node_sign_in -->|"auth requests"| node_user_actions
node_auth_callback -->|"completes session"| node_user_actions
node_workspace_shell -->|"hosts"| node_dashboard
node_workspace_shell -->|"hosts"| node_type_view
node_navigation -->|"selects workspace view"| node_dashboard
node_navigation -->|"filters by type"| node_type_view
node_commands -->|"searches files"| node_file_actions
node_sorting -->|"orders presentation"| node_file_cards
node_dashboard -->|"loads files and usage"| node_file_actions
node_type_view -->|"retrieves filtered files"| node_file_actions
node_file_actions -->|"supplies file entities"| node_file_cards
node_file_actions -->|"supplies usage totals"| node_storage_summary
node_file_modals -->|"initiates mutations"| node_file_actions
node_file_actions -->|"uses"| node_appwrite_client
node_user_actions -->|"uses"| node_appwrite_client
node_appwrite_client -->|"connects to"| node_appwrite
node_ping_ui -->|"probes"| node_ping_api
node_ping_api -->|"checks connectivity"| node_appwrite_client

click node_app_shell "https://github.com/addy015/mykeeper/blob/main/app/layout.js"
click node_auth_shell "https://github.com/addy015/mykeeper/blob/main/app/(auth)/layout.js"
click node_sign_in "https://github.com/addy015/mykeeper/blob/main/app/(auth)/sign-in/page.js"
click node_auth_callback "https://github.com/addy015/mykeeper/blob/main/app/auth/callback/page.js"
click node_user_actions "https://github.com/addy015/mykeeper/blob/main/lib/actions/user.actions.js"
click node_workspace_shell "https://github.com/addy015/mykeeper/blob/main/app/(root)/layout.js"
click node_dashboard "https://github.com/addy015/mykeeper/blob/main/app/(root)/page.js"
click node_type_view "https://github.com/addy015/mykeeper/blob/main/app/(root)/%5Btype%5D/page.js"
click node_navigation "https://github.com/addy015/mykeeper/blob/main/components/Sidebar.jsx"
click node_commands "https://github.com/addy015/mykeeper/blob/main/components/Topbar.jsx"
click node_sorting "https://github.com/addy015/mykeeper/blob/main/components/SortDropdown.jsx"
click node_file_cards "https://github.com/addy015/mykeeper/blob/main/components/FileCard.jsx"
click node_file_modals "https://github.com/addy015/mykeeper/blob/main/components/modals/DeleteModal.jsx"
click node_storage_summary "https://github.com/addy015/mykeeper/blob/main/components/StorageSummary.jsx"
click node_file_actions "https://github.com/addy015/mykeeper/blob/main/lib/actions/file.actions.js"
click node_appwrite_client "https://github.com/addy015/mykeeper/blob/main/lib/appwrite.js"
click node_ping_api "https://github.com/addy015/mykeeper/blob/main/app/api/ping/route.js"
click node_ping_ui "https://github.com/addy015/mykeeper/blob/main/components/AppwritePing.js"

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_shell,node_workspace_shell,node_dashboard,node_type_view,node_navigation,node_commands,node_sorting toneBlue
class node_auth_shell,node_sign_in,node_auth_callback,node_user_actions toneAmber
class node_file_cards,node_file_modals,node_storage_summary,node_file_actions toneMint
class node_appwrite_client,node_appwrite,node_ping_api,node_ping_ui toneRose
```

## Components

### UI shells and workspace

- [Global app shell](https://github.com/addy015/mykeeper/blob/main/app/layout.js): Next.js layout · Provides global styling and application chrome. · `app/layout.js`
- [Workspace shell](https://github.com/addy015/mykeeper/blob/main/app/(root)/layout.js): Route-group layout · `app/(root)/layout.js`
- [Dashboard landing](https://github.com/addy015/mykeeper/blob/main/app/(root)/page.js): Workspace route · `app/(root)/page.js`
- [Type-filtered files](https://github.com/addy015/mykeeper/blob/main/app/(root)/%5Btype%5D/page.js): Dynamic workspace route · `app/(root)/[type]/page.js`
- [Sidebar navigation](https://github.com/addy015/mykeeper/blob/main/components/Sidebar.jsx): Workspace navigation · `components/Sidebar.jsx`
- [Topbar search](https://github.com/addy015/mykeeper/blob/main/components/Topbar.jsx): Command surface · `components/Topbar.jsx`
- [Sort controls](https://github.com/addy015/mykeeper/blob/main/components/SortDropdown.jsx): Presentation control · `components/SortDropdown.jsx`

### Authentication

- [Auth shell](https://github.com/addy015/mykeeper/blob/main/app/(auth)/layout.js): Route-group layout · `app/(auth)/layout.js`
- [Sign-in page](https://github.com/addy015/mykeeper/blob/main/app/(auth)/sign-in/page.js): Auth route · `app/(auth)/sign-in/page.js`
- [Auth callback](https://github.com/addy015/mykeeper/blob/main/app/auth/callback/page.js): Callback route · `app/auth/callback/page.js`
- [User actions](https://github.com/addy015/mykeeper/blob/main/lib/actions/user.actions.js): Auth action layer · Owns registration, login, session lookup, and logout. · `lib/actions/user.actions.js`

### File domain

- [File cards](https://github.com/addy015/mykeeper/blob/main/components/FileCard.jsx): File renderer · `components/FileCard.jsx`
- [File management modals](https://github.com/addy015/mykeeper/blob/main/components/modals/DeleteModal.jsx): Mutation and detail UI · Delete, rename, share, and inspection dialogs. · `components/modals/DeleteModal.jsx`
- [Storage summary](https://github.com/addy015/mykeeper/blob/main/components/StorageSummary.jsx): Usage renderer · `components/StorageSummary.jsx`
- [File actions](https://github.com/addy015/mykeeper/blob/main/lib/actions/file.actions.js): File domain layer · Coordinates file metadata and binary storage operations. · `lib/actions/file.actions.js`

### Service boundary

- [Appwrite client](https://github.com/addy015/mykeeper/blob/main/lib/appwrite.js): BaaS initialization · Configures Appwrite from environment-provided identifiers. · `lib/appwrite.js`
- **Appwrite services**: External BaaS · Authentication, metadata database, and binary storage.
- [Service ping endpoint](https://github.com/addy015/mykeeper/blob/main/app/api/ping/route.js): API route · `app/api/ping/route.js`
- [Appwrite ping probe](https://github.com/addy015/mykeeper/blob/main/components/AppwritePing.js): Health UI · `components/AppwritePing.js`

## Connections

- Global app shell → Auth shell: wraps
- Global app shell → Workspace shell: wraps
- Auth shell → Sign-in page: hosts
- Sign-in page → User actions: auth requests
- Auth callback → User actions: completes session
- Workspace shell → Dashboard landing: hosts
- Workspace shell → Type-filtered files: hosts
- Sidebar navigation → Dashboard landing: selects workspace view
- Sidebar navigation → Type-filtered files: filters by type
- Topbar search → File actions: searches files
- Sort controls → File cards: orders presentation
- Dashboard landing → File actions: loads files and usage
- Type-filtered files → File actions: retrieves filtered files
- File actions → File cards: supplies file entities
- File actions → Storage summary: supplies usage totals
- File management modals → File actions: initiates mutations
- File actions → Appwrite client: uses
- User actions → Appwrite client: uses
- Appwrite client → Appwrite services: connects to
- Appwrite ping probe → Service ping endpoint: probes
- Service ping endpoint → Appwrite client: checks connectivity
