Skip to content

Frontend Architecture

TechnologyVersionPurpose
React19UI framework
TypeScript6Type safety
React Router7Client-side routing
Tailwind CSS4Utility-first styling
Vite8Build tool + dev server
tus-js-client4Resumable uploads
iconoir-react7Icon library
/login → LoginPage (also handles first-run setup)
/browse/* → BrowserPage (directory listing + search)
/edit/* → EditorPage (text file editor)
/play/* → PlayerPage (video/audio player)
/preview/* → PreviewPage (image/document preview)

All routes except /login are protected by an auth guard in App.tsx. Pages are loaded via React.lazy for code splitting.

No external state library. State is managed through:

  • useAuth — Auth context provider wrapping the app. Manages token, user, login/logout/refresh. Stores token in memory (not localStorage). A rustyfile:auth-expired custom window event triggers automatic logout.
  • useFiles — Directory listing, delete, and create-directory operations. Wraps the API client.
  • useTusUpload — Upload queue with concurrency control (max 3). Manages TUS lifecycle, progress tracking, and cancellation.
  • useSearch — Search with debounced input. Wraps the /api/fs/search endpoint with type/size/date filters.
  • useDragDrop — Drag-and-drop event handling. Falls back to file picker.

api/client.ts provides a fetch wrapper that:

  • Automatically attaches the Bearer token from auth context
  • Parses JSON responses
  • On 401 from any non-auth endpoint, dispatches rustyfile:auth-expired to trigger logout
  • Throws ApiClientError with status and code fields for error handling
Layout
├── Sidebar (desktop navigation, quicklinks, storage meter placeholder)
├── BottomNav (mobile tab bar)
└── Page content
├── Breadcrumbs (clickable path segments)
├── FileList → FileRow (sortable directory listing)
├── UploadManager (progress panel)
├── UploadFAB (mobile floating action button)
├── DropZone (drag-over overlay)
└── VideoControls (scrubber, play/pause, volume, fullscreen)
Terminal window
cd frontend
pnpm install
pnpm build # tsc -b && vite build → frontend/dist/
pnpm dev # dev server on :5173, proxies /api/* to :8080

The production build outputs hashed assets to frontend/dist/. When the Rust binary is built with --features embed-frontend (default), these files are embedded via rust-embed and served with immutable cache headers.

The UI follows “The Industrial Monolith” — a brutalist design language built for speed and clarity.

TokenValueUsage
--color-background#090909Page background
--color-surface#141414Card/panel backgrounds
--color-surface-high#201F1FElevated surfaces
--color-surface-bright#353534Highlighted surfaces
--color-borders#2C2C2CBorders and dividers
--color-primary#E45301Primary orange accent
--color-primary-light#FFB599Light orange variant
--color-primary-container#F76015Action buttons
--color-text-main#F2F2F2Body text
--color-muted#7A7A7ASecondary text
--color-outline#A98A7ETertiary/outline color
FontUsage
Space Grotesk (400–700)Headlines, display, navigation
JetBrains Mono (400–700)Metadata, labels, code, data
  • 0px border radius everywhere — sharp corners, no exceptions
  • Hard shadows (4px 4px 0px 0px #000) — physical offset, never blurred
  • 2% noise texture overlay via SVG filter for analog depth
  • Surface hierarchy — stacked plates: background → surface → surface-high → bright
  • No divider lines — use background color shifts between sections

Desktop uses a sidebar with navigation and quicklinks. Mobile switches to a bottom tab bar (Browse, Editor, Media, Stash).

Mobile file browser Mobile media player