# meno-g/streamly-video architecture

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

- Interactive diagram: https://gitdiagram.com/meno-g/streamly-video
- Repository: https://github.com/meno-g/streamly-video

## Overview

Streamly is a full-stack video platform. Viewers browse feeds, search and watch videos; signed-in users interact with videos, channels and playlists, while creators upload and manage their own content in Studio. Pages and API routes are the entry points; server queries and actions mediate reads and mutations against PostgreSQL, with storage drivers handling media files. The README documents the broader feature set; source-level edges are limited to relationships shown in the provided excerpts or SOURCE INDEX.

Main entry points: [`src/server/db.ts`](https://github.com/meno-g/streamly-video/blob/main/src/server/db.ts) (PostgreSQL access), [`src/app/api/upload/route.ts`](https://github.com/meno-g/streamly-video/blob/main/src/app/api/upload/route.ts) (Upload endpoint), [`src/server/session.ts`](https://github.com/meno-g/streamly-video/blob/main/src/server/session.ts) (Session helpers), [`src/server/auth.ts`](https://github.com/meno-g/streamly-video/blob/main/src/server/auth.ts) (Auth service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_viewing["Discovery and viewing"]
  node_home["Home and explore<br/>[page.tsx]"]
  node_video_feed["Video feed<br/>[video-feed.tsx]"]
  node_feed_api["Feed API<br/>[route.ts]"]
  node_video_queries["Video queries<br/>[videos.ts]"]
  node_search["Search<br/>[page.tsx]"]
  node_watch["Watch page<br/>[page.tsx]"]
  node_player["Custom player<br/>[video-player.tsx]"]
  node_media_api["Media delivery<br/>[route.ts]"]
end

subgraph group_community["Community and library"]
  node_interactions["Comments and interactions<br/>[interactions.ts]"]
  node_library["Library pages<br/>[page.tsx]"]
  node_playlists["Playlist queries<br/>[playlists.ts]"]
  node_notifications["Notifications<br/>[notifications.ts]"]
end

subgraph group_creator["Creator tools"]
  node_upload["Upload endpoint<br/>[route.ts]"]
  node_storage["Storage drivers<br/>[index.ts]"]
  node_studio["Creator Studio<br/>[page.tsx]"]
  node_studio_queries["Studio queries<br/>[studio.ts]"]
end

subgraph group_platform["Platform services"]
  node_auth_pages["Login and register<br/>[page.tsx]"]
  node_auth_forms["Auth forms<br/>[auth-forms.tsx]"]
  node_auth_service["Auth service<br/>[auth.ts]"]
  node_session["Session helpers<br/>[session.ts]"]
  node_db[("PostgreSQL access<br/>[db.ts]")]
  node_validation["Input validation<br/>[validations.ts]"]
end

node_viewer(("Viewer"))

node_viewer -->|"browses"| node_home
node_home -->|"renders feed"| node_video_feed
node_viewer -->|"searches"| node_search
node_viewer -->|"watches"| node_watch
node_watch -->|"renders player"| node_player
node_viewer -->|"signs in"| node_auth_pages
node_auth_pages -->|"renders forms"| node_auth_forms
node_auth_forms -->|"submits credentials"| node_auth_service
node_auth_service -->|"looks up user"| node_db
node_session -->|"reads session"| node_auth_service
node_session -->|"loads user"| node_db
node_video_feed -->|"loads pages"| node_feed_api
node_feed_api -->|"requests feed"| node_video_queries
node_video_queries -->|"reads videos"| node_db
node_viewer -->|"uses library"| node_library
node_library -->|"loads playlists"| node_playlists
node_playlists -->|"reads playlists"| node_db
node_viewer -->|"interacts"| node_interactions
node_viewer -->|"checks alerts"| node_notifications
node_viewer -->|"uploads video"| node_upload
node_upload -->|"checks identity"| node_session
node_upload -->|"validates metadata"| node_validation
node_upload -->|"stores media"| node_storage
node_upload -->|"creates video"| node_db
node_viewer -->|"manages videos"| node_studio
node_studio -->|"loads analytics"| node_studio_queries
node_studio_queries -.->|"reads metrics"| node_db
node_player -.->|"requests media"| node_media_api

click node_home "https://github.com/meno-g/streamly-video/blob/main/src/app/(main)/page.tsx"
click node_video_feed "https://github.com/meno-g/streamly-video/blob/main/src/components/video/video-feed.tsx"
click node_feed_api "https://github.com/meno-g/streamly-video/blob/main/src/app/api/videos/route.ts"
click node_video_queries "https://github.com/meno-g/streamly-video/blob/main/src/server/queries/videos.ts"
click node_search "https://github.com/meno-g/streamly-video/blob/main/src/app/(main)/search/page.tsx"
click node_watch "https://github.com/meno-g/streamly-video/blob/main/src/app/(main)/watch/%5BvideoId%5D/page.tsx"
click node_player "https://github.com/meno-g/streamly-video/blob/main/src/components/watch/video-player.tsx"
click node_media_api "https://github.com/meno-g/streamly-video/blob/main/src/app/api/media/%5B...key%5D/route.ts"
click node_auth_pages "https://github.com/meno-g/streamly-video/blob/main/src/app/(auth)/login/page.tsx"
click node_auth_forms "https://github.com/meno-g/streamly-video/blob/main/src/components/auth/auth-forms.tsx"
click node_auth_service "https://github.com/meno-g/streamly-video/blob/main/src/server/auth.ts"
click node_session "https://github.com/meno-g/streamly-video/blob/main/src/server/session.ts"
click node_db "https://github.com/meno-g/streamly-video/blob/main/src/server/db.ts"
click node_interactions "https://github.com/meno-g/streamly-video/blob/main/src/server/actions/interactions.ts"
click node_library "https://github.com/meno-g/streamly-video/blob/main/src/app/(main)/library/page.tsx"
click node_playlists "https://github.com/meno-g/streamly-video/blob/main/src/server/queries/playlists.ts"
click node_notifications "https://github.com/meno-g/streamly-video/blob/main/src/server/actions/notifications.ts"
click node_upload "https://github.com/meno-g/streamly-video/blob/main/src/app/api/upload/route.ts"
click node_storage "https://github.com/meno-g/streamly-video/blob/main/src/server/storage/index.ts"
click node_studio "https://github.com/meno-g/streamly-video/blob/main/src/app/(main)/studio/page.tsx"
click node_studio_queries "https://github.com/meno-g/streamly-video/blob/main/src/server/queries/studio.ts"
click node_validation "https://github.com/meno-g/streamly-video/blob/main/src/lib/validations.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_home,node_video_feed,node_feed_api,node_video_queries,node_search,node_watch,node_player,node_media_api,node_viewer toneBlue
class node_interactions,node_library,node_playlists,node_notifications toneAmber
class node_upload,node_storage,node_studio,node_studio_queries toneMint
class node_auth_pages,node_auth_forms,node_auth_service,node_session,node_db,node_validation toneRose
```

## Components

### Discovery and viewing

- [Home and explore](https://github.com/meno-g/streamly-video/blob/main/src/app/(main)/page.tsx): `src/app/(main)/page.tsx`
- [Video feed](https://github.com/meno-g/streamly-video/blob/main/src/components/video/video-feed.tsx): `src/components/video/video-feed.tsx`
- [Feed API](https://github.com/meno-g/streamly-video/blob/main/src/app/api/videos/route.ts): `src/app/api/videos/route.ts`
- [Video queries](https://github.com/meno-g/streamly-video/blob/main/src/server/queries/videos.ts): `src/server/queries/videos.ts`
- [Search](https://github.com/meno-g/streamly-video/blob/main/src/app/(main)/search/page.tsx): `src/app/(main)/search/page.tsx`
- [Watch page](https://github.com/meno-g/streamly-video/blob/main/src/app/(main)/watch/%5BvideoId%5D/page.tsx): `src/app/(main)/watch/[videoId]/page.tsx`
- [Custom player](https://github.com/meno-g/streamly-video/blob/main/src/components/watch/video-player.tsx): `src/components/watch/video-player.tsx`
- [Media delivery](https://github.com/meno-g/streamly-video/blob/main/src/app/api/media/%5B...key%5D/route.ts): `src/app/api/media/[...key]/route.ts`

### Community and library

- [Comments and interactions](https://github.com/meno-g/streamly-video/blob/main/src/server/actions/interactions.ts): `src/server/actions/interactions.ts`
- [Library pages](https://github.com/meno-g/streamly-video/blob/main/src/app/(main)/library/page.tsx): `src/app/(main)/library/page.tsx`
- [Playlist queries](https://github.com/meno-g/streamly-video/blob/main/src/server/queries/playlists.ts): `src/server/queries/playlists.ts`
- [Notifications](https://github.com/meno-g/streamly-video/blob/main/src/server/actions/notifications.ts): `src/server/actions/notifications.ts`

### Creator tools

- [Upload endpoint](https://github.com/meno-g/streamly-video/blob/main/src/app/api/upload/route.ts): `src/app/api/upload/route.ts`
- [Storage drivers](https://github.com/meno-g/streamly-video/blob/main/src/server/storage/index.ts): `src/server/storage/index.ts`
- [Creator Studio](https://github.com/meno-g/streamly-video/blob/main/src/app/(main)/studio/page.tsx): `src/app/(main)/studio/page.tsx`
- [Studio queries](https://github.com/meno-g/streamly-video/blob/main/src/server/queries/studio.ts): `src/server/queries/studio.ts`

### Platform services

- [Login and register](https://github.com/meno-g/streamly-video/blob/main/src/app/(auth)/login/page.tsx): `src/app/(auth)/login/page.tsx`
- [Auth forms](https://github.com/meno-g/streamly-video/blob/main/src/components/auth/auth-forms.tsx): `src/components/auth/auth-forms.tsx`
- [Auth service](https://github.com/meno-g/streamly-video/blob/main/src/server/auth.ts): `src/server/auth.ts`
- [Session helpers](https://github.com/meno-g/streamly-video/blob/main/src/server/session.ts): `src/server/session.ts`
- [PostgreSQL access](https://github.com/meno-g/streamly-video/blob/main/src/server/db.ts): `src/server/db.ts`
- [Input validation](https://github.com/meno-g/streamly-video/blob/main/src/lib/validations.ts): `src/lib/validations.ts`

### Other components

- **Viewer**

## Connections

- Viewer → Home and explore: browses
- Home and explore → Video feed: renders feed (evidence: `src/app/(main)/page.tsx`)
- Viewer → Search: searches
- Viewer → Watch page: watches
- Watch page → Custom player: renders player
- Viewer → Login and register: signs in
- Login and register → Auth forms: renders forms (evidence: `src/components/auth/auth-forms.tsx`)
- Auth forms → Auth service: submits credentials (evidence: `src/components/auth/auth-forms.tsx`)
- Auth service → PostgreSQL access: looks up user (evidence: `src/server/auth.ts`)
- Session helpers → Auth service: reads session (evidence: `src/server/session.ts`)
- Session helpers → PostgreSQL access: loads user (evidence: `src/server/session.ts`)
- Video feed → Feed API: loads pages (evidence: `src/components/video/video-feed.tsx`)
- Feed API → Video queries: requests feed (evidence: `src/app/api/videos/route.ts`)
- Video queries → PostgreSQL access: reads videos (evidence: `src/server/queries/videos.ts`)
- Viewer → Library pages: uses library
- Library pages → Playlist queries: loads playlists (evidence: `src/app/(main)/library/page.tsx`)
- Playlist queries → PostgreSQL access: reads playlists (evidence: `src/server/queries/playlists.ts`)
- Viewer → Comments and interactions: interacts
- Viewer → Notifications: checks alerts
- Viewer → Upload endpoint: uploads video
- Upload endpoint → Session helpers: checks identity (evidence: `src/app/api/upload/route.ts`)
- Upload endpoint → Input validation: validates metadata (evidence: `src/app/api/upload/route.ts`)
- Upload endpoint → Storage drivers: stores media (evidence: `src/app/api/upload/route.ts`)
- Upload endpoint → PostgreSQL access: creates video (evidence: `src/app/api/upload/route.ts`)
- Viewer → Creator Studio: manages videos
- Creator Studio → Studio queries: loads analytics (evidence: `src/app/(main)/studio/page.tsx`)
- Studio queries → PostgreSQL access: reads metrics
- Custom player → Media delivery: requests media
