# rajibdpi/trynas architecture

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

- Interactive diagram: https://gitdiagram.com/rajibdpi/trynas
- Repository: https://github.com/rajibdpi/trynas

## Overview

TryNAS is a self-hosted NAS file browser and administration dashboard. Users browse and manage local or attached remote files, preview and transfer content, and can share files; administrators also manage accounts, permissions, settings, and system monitoring. The Go server routes API requests to feature modules, with SQLite for application records and configured storage for files. The tree and excerpts establish server routing, module composition, authentication, and several feature implementations; many frontend-to-API and feature-to-storage details are not shown, so those links are omitted rather than inferred.

Main entry points: [`app/router.go`](https://github.com/rajibdpi/trynas/blob/main/app/router.go) (API router), [`app/app.go`](https://github.com/rajibdpi/trynas/blob/main/app/app.go) (Feature composition), [`cmd/server.go`](https://github.com/rajibdpi/trynas/blob/main/cmd/server.go) (HTTP server), [`frontend/modules/workspace/workspace.tsx`](https://github.com/rajibdpi/trynas/blob/main/frontend/modules/workspace/workspace.tsx) (Web interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_frontend["Web interface<br/>[workspace.tsx]"]
  node_file_ui["File browser and previews<br/>[file-browser.tsx]"]
  node_settings_ui["Settings interface<br/>[app-settings.tsx]"]
  node_theme["Theme preferences<br/>[color-theme.ts]"]
end

subgraph group_server["Server runtime"]
  node_server["HTTP server<br/>[server.go]"]
  node_router["API router<br/>[router.go]"]
  node_app["Feature composition<br/>[app.go]"]
  node_database[("SQLite records<br/>[database.go]")]
  node_upload_proxy["Upload proxy<br/>[upload-proxy.mjs]"]
end

subgraph group_files["File management"]
  node_files["Local file operations<br/>[operations.go]"]
  node_archive["Archive handling<br/>[zip_preview.go]"]
  node_providers["Remote storage<br/>[remote_storage.go]"]
  node_trash["Trash and restore<br/>[operations.go]"]
  node_favorites["Favorites<br/>[favorites.go]"]
  node_sharing["File sharing<br/>[share.go]"]
end

subgraph group_access["Identity and access"]
  node_auth["Authentication<br/>[auth.go]"]
  node_users["User management<br/>[users.go]"]
  node_permissions["Folder permissions<br/>[permissions.go]"]
end

subgraph group_admin["Administration"]
  node_settings["Server settings<br/>[server.go]"]
  node_metrics["System monitoring<br/>[metrics.go]"]
  node_activity["Activity log<br/>[activity.go]"]
end

node_user(("User"))
node_external_storage[("Configured file storage")]

node_user -->|"uses"| node_frontend
node_frontend -->|"opens files"| node_file_ui
node_frontend -->|"configures"| node_settings_ui
node_server -->|"serves routes"| node_router
node_router -->|"serves fallback"| node_frontend
node_app -->|"composes"| node_auth
node_app -->|"composes"| node_files
node_app -->|"composes"| node_providers
node_app -->|"composes"| node_database
node_router -->|"routes auth"| node_auth
node_router -->|"routes file APIs"| node_files
node_router -->|"routes ZIP preview"| node_archive
node_router -->|"routes storage APIs"| node_providers
node_router -->|"routes user APIs"| node_users
node_router -->|"routes permissions"| node_permissions
node_router -->|"routes trash APIs"| node_trash
node_router -->|"routes favorites"| node_favorites
node_router -->|"routes sharing"| node_sharing
node_router -->|"routes settings"| node_settings
node_router -->|"routes monitoring"| node_metrics
node_router -->|"routes activity"| node_activity
node_server -->|"opens and migrates"| node_database
node_server -->|"initializes"| node_app
node_server -.->|"optional frontend proxy"| node_upload_proxy
node_user -.->|"stores files"| node_external_storage
node_user -.->|"sets appearance"| node_theme

click node_frontend "https://github.com/rajibdpi/trynas/blob/main/frontend/modules/workspace/workspace.tsx"
click node_file_ui "https://github.com/rajibdpi/trynas/blob/main/frontend/modules/files/file-browser.tsx"
click node_settings_ui "https://github.com/rajibdpi/trynas/blob/main/frontend/modules/settings/app-settings.tsx"
click node_server "https://github.com/rajibdpi/trynas/blob/main/cmd/server.go"
click node_router "https://github.com/rajibdpi/trynas/blob/main/app/router.go"
click node_app "https://github.com/rajibdpi/trynas/blob/main/app/app.go"
click node_auth "https://github.com/rajibdpi/trynas/blob/main/auth/auth.go"
click node_users "https://github.com/rajibdpi/trynas/blob/main/users/users.go"
click node_permissions "https://github.com/rajibdpi/trynas/blob/main/permissions/permissions.go"
click node_files "https://github.com/rajibdpi/trynas/blob/main/files/operations.go"
click node_archive "https://github.com/rajibdpi/trynas/blob/main/files/zip_preview.go"
click node_providers "https://github.com/rajibdpi/trynas/blob/main/providers/remote_storage.go"
click node_trash "https://github.com/rajibdpi/trynas/blob/main/trash/operations.go"
click node_favorites "https://github.com/rajibdpi/trynas/blob/main/favorites/favorites.go"
click node_sharing "https://github.com/rajibdpi/trynas/blob/main/share/share.go"
click node_database "https://github.com/rajibdpi/trynas/blob/main/database/database.go"
click node_settings "https://github.com/rajibdpi/trynas/blob/main/settings/server.go"
click node_metrics "https://github.com/rajibdpi/trynas/blob/main/metrics/metrics.go"
click node_activity "https://github.com/rajibdpi/trynas/blob/main/activity/activity.go"
click node_theme "https://github.com/rajibdpi/trynas/blob/main/frontend/modules/settings/color-theme.ts"
click node_upload_proxy "https://github.com/rajibdpi/trynas/blob/main/frontend/upload-proxy.mjs"

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_frontend,node_file_ui,node_settings_ui,node_theme,node_user toneBlue
class node_server,node_router,node_app,node_database,node_upload_proxy,node_external_storage toneAmber
class node_files,node_archive,node_providers,node_trash,node_favorites,node_sharing toneMint
class node_auth,node_users,node_permissions toneRose
class node_settings,node_metrics,node_activity toneIndigo
```

## Components

### Web interface

- [Web interface](https://github.com/rajibdpi/trynas/blob/main/frontend/modules/workspace/workspace.tsx): `frontend/modules/workspace/workspace.tsx`
- [File browser and previews](https://github.com/rajibdpi/trynas/blob/main/frontend/modules/files/file-browser.tsx): `frontend/modules/files/file-browser.tsx`
- [Settings interface](https://github.com/rajibdpi/trynas/blob/main/frontend/modules/settings/app-settings.tsx): `frontend/modules/settings/app-settings.tsx`
- [Theme preferences](https://github.com/rajibdpi/trynas/blob/main/frontend/modules/settings/color-theme.ts): `frontend/modules/settings/color-theme.ts`

### Server runtime

- [HTTP server](https://github.com/rajibdpi/trynas/blob/main/cmd/server.go): `cmd/server.go`
- [API router](https://github.com/rajibdpi/trynas/blob/main/app/router.go): `app/router.go`
- [Feature composition](https://github.com/rajibdpi/trynas/blob/main/app/app.go): `app/app.go`
- [SQLite records](https://github.com/rajibdpi/trynas/blob/main/database/database.go): `database/database.go`
- [Upload proxy](https://github.com/rajibdpi/trynas/blob/main/frontend/upload-proxy.mjs): `frontend/upload-proxy.mjs`

### File management

- [Local file operations](https://github.com/rajibdpi/trynas/blob/main/files/operations.go): `files/operations.go`
- [Archive handling](https://github.com/rajibdpi/trynas/blob/main/files/zip_preview.go): `files/zip_preview.go`
- [Remote storage](https://github.com/rajibdpi/trynas/blob/main/providers/remote_storage.go): `providers/remote_storage.go`
- [Trash and restore](https://github.com/rajibdpi/trynas/blob/main/trash/operations.go): `trash/operations.go`
- [Favorites](https://github.com/rajibdpi/trynas/blob/main/favorites/favorites.go): `favorites/favorites.go`
- [File sharing](https://github.com/rajibdpi/trynas/blob/main/share/share.go): `share/share.go`

### Identity and access

- [Authentication](https://github.com/rajibdpi/trynas/blob/main/auth/auth.go): `auth/auth.go`
- [User management](https://github.com/rajibdpi/trynas/blob/main/users/users.go): `users/users.go`
- [Folder permissions](https://github.com/rajibdpi/trynas/blob/main/permissions/permissions.go): `permissions/permissions.go`

### Administration

- [Server settings](https://github.com/rajibdpi/trynas/blob/main/settings/server.go): `settings/server.go`
- [System monitoring](https://github.com/rajibdpi/trynas/blob/main/metrics/metrics.go): `metrics/metrics.go`
- [Activity log](https://github.com/rajibdpi/trynas/blob/main/activity/activity.go): `activity/activity.go`

### Other components

- **User**
- **Configured file storage**

## Connections

- User → Web interface: uses (evidence: `README.md`)
- Web interface → File browser and previews: opens files (evidence: `README.md`)
- Web interface → Settings interface: configures (evidence: `README.md`)
- HTTP server → API router: serves routes (evidence: `cmd/server.go`)
- API router → Web interface: serves fallback (evidence: `app/router.go`)
- Feature composition → Authentication: composes (evidence: `app/app.go`)
- Feature composition → Local file operations: composes (evidence: `app/app.go`)
- Feature composition → Remote storage: composes (evidence: `app/app.go`)
- Feature composition → SQLite records: composes (evidence: `app/app.go`)
- API router → Authentication: routes auth (evidence: `app/router.go`)
- API router → Local file operations: routes file APIs (evidence: `app/router.go`)
- API router → Archive handling: routes ZIP preview (evidence: `app/router.go`)
- API router → Remote storage: routes storage APIs (evidence: `app/router.go`)
- API router → User management: routes user APIs (evidence: `app/router.go`)
- API router → Folder permissions: routes permissions (evidence: `app/router.go`)
- API router → Trash and restore: routes trash APIs (evidence: `app/router.go`)
- API router → Favorites: routes favorites (evidence: `app/router.go`)
- API router → File sharing: routes sharing (evidence: `app/router.go`)
- API router → Server settings: routes settings (evidence: `app/router.go`)
- API router → System monitoring: routes monitoring (evidence: `app/router.go`)
- API router → Activity log: routes activity (evidence: `app/router.go`)
- HTTP server → SQLite records: opens and migrates (evidence: `cmd/server.go`)
- HTTP server → Feature composition: initializes (evidence: `cmd/server.go`)
- HTTP server → Upload proxy: optional frontend proxy
- User → Configured file storage: stores files (evidence: `README.md`)
- User → Theme preferences: sets appearance
