Cloudrive

Frontend overview

Cloudrive splits its frontend into apps/web-ui (Vite SPA dashboard), apps/main-web (vinext marketing site), and packages/shared.

  • apps/web-ui (@cloudrive/web-ui) holds sign-in, onboarding, and the signed-in dashboard SPA (Vite + TanStack Router/Query).
  • apps/main-web (@cloudrive/main) holds the public marketing, contact, and legal pages (vinext on Cloudflare Workers).
  • packages/shared (@cloudrive/shared) holds shared UI primitives (./ui), reusable blocks and form fields (./block), hooks (./hooks), DTOs (./dtos), constants (./constants), types (./types), and utilities (./lib).

Stack

  • React 19 on Vite, TypeScript (same major as the repo root).
  • TanStack Router with file-based routes (src/routes, generated src/routeTree.gen.ts).
  • TanStack Query for server state, TanStack Form + zod for forms.
  • axios for the REST API, better-auth's client as the auth transport.
  • Tailwind CSS v4 and shadcn/ui (Radix) components, next-themes for light and dark.
  • nuqs for state kept in the URL (?org=, ?ws=, ?tab=, pagination).

Layout

src/
  routes/                 pages: guard + render one block component
  components/
    ui/                   shadcn/ui primitives, no app knowledge
    block/common/         shared composites (tables, dialogs, inputs)
    block/form/           TanStack Form field components
    block/<feature>/      feature UI (drive, storage, s3, settings, onboarding, …)
    block/landing|legal|contact/  public site sections
    layout/               sidebar shell, page header, marketing navbar
  config/env.ts           the only place env is read
  data/sidebar-menu.ts    sidebar menus
  hooks/                  session, workspace context, form hook, storage usage, …
  lib/
    api/                  models → dtos → services → queries (see API layer)
    auth/                 token storage, refresh, session, sign-in flows
    providers/            React Query client, theme + nuqs + tooltip providers
  types/                  API envelope, menu, form and column types
  styles.css              theme tokens (dashboard) + the .marketing scope

Scripts

CommandWhat it does
bun run dev:webDashboard SPA dev server on :3000, proxies /v1 to :8080.
bun run dev:mainMarketing site (vinext) dev server.
bun run build:webBuilds apps/web-ui/dist/.
bun run build:mainBuilds apps/main-web for Cloudflare Workers.
bun run --filter @cloudrive/web-ui generate-routesRegenerates src/routeTree.gen.ts (commit it).
bun run --filter @cloudrive/web-ui previewServes the built dist/ locally.

Environment

VariableDefaultNotes
VITE_API_URLthe page originSet only when the API lives on another origin.
VITE_API_PROXY_TARGEThttp://localhost:8080Dev server only: where /v1 is proxied.

VITE_* values are inlined into the browser bundle at build time: never put secrets there.

On this page