# mgilangjanuar/teledrive architecture

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

- Interactive diagram: https://gitdiagram.com/mgilangjanuar/teledrive
- Repository: https://github.com/mgilangjanuar/teledrive

## Overview

Teledrive is a cloud-drive application whose backend uses Telegram APIs for storage and account access. The main user workflow is sign-in, browsing or managing files in the dashboard, and opening or sharing files through the viewer. The graph also preserves messaging, settings, administration, and desktop-client capabilities visible in the repository. Several API route implementations are unsampled, so their specific internal calls are not asserted; relationships to those subsystems are shown only where the available excerpts, source index, or README support them.

Main entry points: [`web/src/utils/Fetcher.ts`](https://github.com/mgilangjanuar/teledrive/blob/main/web/src/utils/Fetcher.ts) (API client), [`web/src/App.tsx`](https://github.com/mgilangjanuar/teledrive/blob/main/web/src/App.tsx) (App routing), [`api/src/api/index.ts`](https://github.com/mgilangjanuar/teledrive/blob/main/api/src/api/index.ts) (API router), [`web/src/pages/dashboard/index.tsx`](https://github.com/mgilangjanuar/teledrive/blob/main/web/src/pages/dashboard/index.tsx) (Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_webapp["App routing<br/>[App.tsx]"]
  node_login["Login<br/>[Login.tsx]"]
  node_dashboard["Dashboard<br/>[index.tsx]"]
  node_fileactions["File management"]
  node_upload["Upload<br/>[Upload.tsx]"]
  node_messaging["Messaging<br/>[Messaging.tsx]"]
  node_viewerroute["View route<br/>[index.tsx]"]
  node_viewfiles["Shared folder listing<br/>[TableFiles.tsx]"]
  node_viewer["File viewer<br/>[Viewer.tsx]"]
  node_download["File download<br/>[Download.ts]"]
  node_fetcher["API client<br/>[Fetcher.ts]"]
  node_settings["Settings<br/>[Settings.tsx]"]
  node_admin["Administration<br/>[index.tsx]"]
end

subgraph group_api["API services"]
  node_apiapp["HTTP server<br/>[index.ts]"]
  node_apirouter["API router<br/>[index.ts]"]
  node_authroutes["Authentication routes<br/>[Auth.ts]"]
  node_fileroutes["File routes<br/>[Files.ts]"]
  node_messageroutes["Message routes<br/>[Messages.ts]"]
  node_dialogroutes["Dialog routes<br/>[Dialogs.ts]"]
  node_userroutes["User routes<br/>[Users.ts]"]
  node_configroutes["Configuration routes<br/>[Config.ts]"]
  node_cache[("Cache<br/>[Cache.ts]")]
end

subgraph group_telegram["Telegram integration"]
  node_tgclient["Telegram client<br/>[TGClient.ts]"]
  node_sessionauth["Session authentication<br/>[TGSessionAuth.ts]"]
end

subgraph group_clients["Client applications"]
  node_webeditor["Web editor integration<br/>[App.tsx]"]
  node_electron["Desktop client<br/>[main.js]"]
  node_android["Android client<br/>[App.js]"]
end

node_user(("Drive user"))
node_telegramservice{{"Telegram API"}}
node_redis[("Redis")]

node_user -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_login
node_webapp -->|"routes to"| node_dashboard
node_webapp -->|"routes to"| node_viewerroute
node_webapp -->|"routes to"| node_settings
node_webapp -->|"routes to"| node_admin
node_login -->|"requests through"| node_fetcher
node_dashboard -->|"renders"| node_fileactions
node_dashboard -->|"renders"| node_upload
node_dashboard -->|"renders"| node_messaging
node_dashboard -->|"requests through"| node_fetcher
node_fileactions -->|"requests through"| node_fetcher
node_upload -->|"requests through"| node_fetcher
node_upload -->|"uses Telegram"| node_telegramservice
node_viewerroute -->|"renders"| node_viewfiles
node_viewerroute -->|"renders"| node_viewer
node_viewerroute -->|"requests through"| node_fetcher
node_viewfiles -->|"requests through"| node_fetcher
node_viewer -->|"uses"| node_download
node_viewer -->|"requests through"| node_fetcher
node_settings -.->|"requests through"| node_fetcher
node_admin -->|"requests through"| node_fetcher
node_fetcher -->|"sends API requests"| node_apiapp
node_apiapp -->|"mounts"| node_apirouter
node_apirouter -->|"registers routes"| node_authroutes
node_apirouter -.->|"registers routes"| node_fileroutes
node_apirouter -.->|"registers routes"| node_messageroutes
node_apirouter -.->|"registers routes"| node_dialogroutes
node_apirouter -.->|"registers routes"| node_userroutes
node_apirouter -.->|"registers routes"| node_configroutes
node_authroutes -->|"uses middleware"| node_tgclient
node_authroutes -->|"uses middleware"| node_sessionauth
node_tgclient -->|"creates client for"| node_telegramservice
node_sessionauth -.->|"authenticates session"| node_telegramservice
node_authroutes -->|"reads and deletes"| node_cache
node_apiapp -->|"connects"| node_cache
node_cache -->|"stores cache data"| node_redis
node_electron -->|"opens web app"| node_webapp
node_android -.->|"client entry"| node_webapp

click node_webapp "https://github.com/mgilangjanuar/teledrive/blob/main/web/src/App.tsx"
click node_login "https://github.com/mgilangjanuar/teledrive/blob/main/web/src/pages/Login.tsx"
click node_dashboard "https://github.com/mgilangjanuar/teledrive/blob/main/web/src/pages/dashboard/index.tsx"
click node_fileactions "https://github.com/mgilangjanuar/teledrive/tree/main/web/src/pages/dashboard/components"
click node_upload "https://github.com/mgilangjanuar/teledrive/blob/main/web/src/pages/dashboard/components/Upload.tsx"
click node_messaging "https://github.com/mgilangjanuar/teledrive/blob/main/web/src/pages/dashboard/components/Messaging.tsx"
click node_viewerroute "https://github.com/mgilangjanuar/teledrive/blob/main/web/src/pages/view/index.tsx"
click node_viewfiles "https://github.com/mgilangjanuar/teledrive/blob/main/web/src/pages/view/components/TableFiles.tsx"
click node_viewer "https://github.com/mgilangjanuar/teledrive/blob/main/web/src/pages/view/components/Viewer.tsx"
click node_download "https://github.com/mgilangjanuar/teledrive/blob/main/web/src/utils/Download.ts"
click node_fetcher "https://github.com/mgilangjanuar/teledrive/blob/main/web/src/utils/Fetcher.ts"
click node_settings "https://github.com/mgilangjanuar/teledrive/blob/main/web/src/pages/Settings.tsx"
click node_admin "https://github.com/mgilangjanuar/teledrive/blob/main/web/src/pages/admin/index.tsx"
click node_apiapp "https://github.com/mgilangjanuar/teledrive/blob/main/api/src/index.ts"
click node_apirouter "https://github.com/mgilangjanuar/teledrive/blob/main/api/src/api/index.ts"
click node_authroutes "https://github.com/mgilangjanuar/teledrive/blob/main/api/src/api/v1/Auth.ts"
click node_fileroutes "https://github.com/mgilangjanuar/teledrive/blob/main/api/src/api/v1/Files.ts"
click node_messageroutes "https://github.com/mgilangjanuar/teledrive/blob/main/api/src/api/v1/Messages.ts"
click node_dialogroutes "https://github.com/mgilangjanuar/teledrive/blob/main/api/src/api/v1/Dialogs.ts"
click node_userroutes "https://github.com/mgilangjanuar/teledrive/blob/main/api/src/api/v1/Users.ts"
click node_configroutes "https://github.com/mgilangjanuar/teledrive/blob/main/api/src/api/v1/Config.ts"
click node_tgclient "https://github.com/mgilangjanuar/teledrive/blob/main/api/src/api/middlewares/TGClient.ts"
click node_sessionauth "https://github.com/mgilangjanuar/teledrive/blob/main/api/src/api/middlewares/TGSessionAuth.ts"
click node_cache "https://github.com/mgilangjanuar/teledrive/blob/main/api/src/service/Cache.ts"
click node_webeditor "https://github.com/mgilangjanuar/teledrive/blob/main/integrations/webeditor/App.tsx"
click node_electron "https://github.com/mgilangjanuar/teledrive/blob/main/electron/main.js"
click node_android "https://github.com/mgilangjanuar/teledrive/blob/main/android/Teledrive-Expo/App.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_webapp,node_login,node_dashboard,node_fileactions,node_upload,node_messaging,node_viewerroute,node_viewfiles,node_viewer,node_download,node_fetcher,node_settings,node_admin,node_user toneBlue
class node_apiapp,node_apirouter,node_authroutes,node_fileroutes,node_messageroutes,node_dialogroutes,node_userroutes,node_configroutes,node_cache,node_redis toneAmber
class node_tgclient,node_sessionauth,node_telegramservice toneMint
class node_webeditor,node_electron,node_android toneRose
```

## Components

### Web application

- [App routing](https://github.com/mgilangjanuar/teledrive/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Login](https://github.com/mgilangjanuar/teledrive/blob/main/web/src/pages/Login.tsx): `web/src/pages/Login.tsx`
- [Dashboard](https://github.com/mgilangjanuar/teledrive/blob/main/web/src/pages/dashboard/index.tsx): `web/src/pages/dashboard/index.tsx`
- [File management](https://github.com/mgilangjanuar/teledrive/tree/main/web/src/pages/dashboard/components): `web/src/pages/dashboard/components`
- [Upload](https://github.com/mgilangjanuar/teledrive/blob/main/web/src/pages/dashboard/components/Upload.tsx): `web/src/pages/dashboard/components/Upload.tsx`
- [Messaging](https://github.com/mgilangjanuar/teledrive/blob/main/web/src/pages/dashboard/components/Messaging.tsx): `web/src/pages/dashboard/components/Messaging.tsx`
- [View route](https://github.com/mgilangjanuar/teledrive/blob/main/web/src/pages/view/index.tsx): `web/src/pages/view/index.tsx`
- [Shared folder listing](https://github.com/mgilangjanuar/teledrive/blob/main/web/src/pages/view/components/TableFiles.tsx): `web/src/pages/view/components/TableFiles.tsx`
- [File viewer](https://github.com/mgilangjanuar/teledrive/blob/main/web/src/pages/view/components/Viewer.tsx): `web/src/pages/view/components/Viewer.tsx`
- [File download](https://github.com/mgilangjanuar/teledrive/blob/main/web/src/utils/Download.ts): `web/src/utils/Download.ts`
- [API client](https://github.com/mgilangjanuar/teledrive/blob/main/web/src/utils/Fetcher.ts): `web/src/utils/Fetcher.ts`
- [Settings](https://github.com/mgilangjanuar/teledrive/blob/main/web/src/pages/Settings.tsx): `web/src/pages/Settings.tsx`
- [Administration](https://github.com/mgilangjanuar/teledrive/blob/main/web/src/pages/admin/index.tsx): `web/src/pages/admin/index.tsx`

### API services

- [HTTP server](https://github.com/mgilangjanuar/teledrive/blob/main/api/src/index.ts): `api/src/index.ts`
- [API router](https://github.com/mgilangjanuar/teledrive/blob/main/api/src/api/index.ts): `api/src/api/index.ts`
- [Authentication routes](https://github.com/mgilangjanuar/teledrive/blob/main/api/src/api/v1/Auth.ts): `api/src/api/v1/Auth.ts`
- [File routes](https://github.com/mgilangjanuar/teledrive/blob/main/api/src/api/v1/Files.ts): `api/src/api/v1/Files.ts`
- [Message routes](https://github.com/mgilangjanuar/teledrive/blob/main/api/src/api/v1/Messages.ts): `api/src/api/v1/Messages.ts`
- [Dialog routes](https://github.com/mgilangjanuar/teledrive/blob/main/api/src/api/v1/Dialogs.ts): `api/src/api/v1/Dialogs.ts`
- [User routes](https://github.com/mgilangjanuar/teledrive/blob/main/api/src/api/v1/Users.ts): `api/src/api/v1/Users.ts`
- [Configuration routes](https://github.com/mgilangjanuar/teledrive/blob/main/api/src/api/v1/Config.ts): `api/src/api/v1/Config.ts`
- [Cache](https://github.com/mgilangjanuar/teledrive/blob/main/api/src/service/Cache.ts): `api/src/service/Cache.ts`

### Telegram integration

- [Telegram client](https://github.com/mgilangjanuar/teledrive/blob/main/api/src/api/middlewares/TGClient.ts): `api/src/api/middlewares/TGClient.ts`
- [Session authentication](https://github.com/mgilangjanuar/teledrive/blob/main/api/src/api/middlewares/TGSessionAuth.ts): `api/src/api/middlewares/TGSessionAuth.ts`

### Client applications

- [Web editor integration](https://github.com/mgilangjanuar/teledrive/blob/main/integrations/webeditor/App.tsx): `integrations/webeditor/App.tsx`
- [Desktop client](https://github.com/mgilangjanuar/teledrive/blob/main/electron/main.js): `electron/main.js`
- [Android client](https://github.com/mgilangjanuar/teledrive/blob/main/android/Teledrive-Expo/App.js): `android/Teledrive-Expo/App.js`

### Other components

- **Drive user**
- **Telegram API**
- **Redis**

## Connections

- Drive user → App routing: uses (evidence: `web/src/App.tsx`)
- App routing → Login: routes to (evidence: `web/src/App.tsx`)
- App routing → Dashboard: routes to (evidence: `web/src/App.tsx`)
- App routing → View route: routes to (evidence: `web/src/App.tsx`)
- App routing → Settings: routes to (evidence: `web/src/App.tsx`)
- App routing → Administration: routes to (evidence: `web/src/App.tsx`)
- Login → API client: requests through (evidence: `web/src/pages/Login.tsx`)
- Dashboard → File management: renders (evidence: `web/src/pages/dashboard/index.tsx`)
- Dashboard → Upload: renders (evidence: `web/src/pages/dashboard/index.tsx`)
- Dashboard → Messaging: renders (evidence: `web/src/pages/dashboard/index.tsx`)
- Dashboard → API client: requests through (evidence: `web/src/pages/dashboard/index.tsx`)
- File management → API client: requests through (evidence: `web/src/pages/dashboard/components/Breadcrumb.tsx`)
- Upload → API client: requests through (evidence: `web/src/pages/dashboard/components/Upload.tsx`)
- Upload → Telegram API: uses Telegram (evidence: `web/src/pages/dashboard/components/Upload.tsx`)
- View route → Shared folder listing: renders (evidence: `web/src/pages/view/index.tsx`)
- View route → File viewer: renders (evidence: `web/src/pages/view/index.tsx`)
- View route → API client: requests through (evidence: `web/src/pages/view/index.tsx`)
- Shared folder listing → API client: requests through (evidence: `web/src/pages/view/components/TableFiles.tsx`)
- File viewer → File download: uses (evidence: `web/src/pages/view/components/Viewer.tsx`)
- File viewer → API client: requests through (evidence: `web/src/pages/view/components/Viewer.tsx`)
- Settings → API client: requests through
- Administration → API client: requests through (evidence: `web/src/pages/admin/index.tsx`)
- API client → HTTP server: sends API requests (evidence: `web/src/utils/Fetcher.ts`)
- HTTP server → API router: mounts (evidence: `api/src/index.ts`)
- API router → Authentication routes: registers routes (evidence: `api/src/api/index.ts`)
- API router → File routes: registers routes
- API router → Message routes: registers routes
- API router → Dialog routes: registers routes
- API router → User routes: registers routes
- API router → Configuration routes: registers routes
- Authentication routes → Telegram client: uses middleware (evidence: `api/src/api/v1/Auth.ts`)
- Authentication routes → Session authentication: uses middleware (evidence: `api/src/api/v1/Auth.ts`)
- Telegram client → Telegram API: creates client for (evidence: `api/src/api/middlewares/TGClient.ts`)
- Session authentication → Telegram API: authenticates session
- Authentication routes → Cache: reads and deletes (evidence: `api/src/api/v1/Auth.ts`)
- HTTP server → Cache: connects (evidence: `api/src/index.ts`)
- Cache → Redis: stores cache data (evidence: `api/src/service/Cache.ts`)
- Desktop client → App routing: opens web app (evidence: `electron/main.js`)
- Android client → App routing: client entry
