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, generatedsrc/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-themesfor light and dark. nuqsfor 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 scopeScripts
| Command | What it does |
|---|---|
bun run dev:web | Dashboard SPA dev server on :3000, proxies /v1 to :8080. |
bun run dev:main | Marketing site (vinext) dev server. |
bun run build:web | Builds apps/web-ui/dist/. |
bun run build:main | Builds apps/main-web for Cloudflare Workers. |
bun run --filter @cloudrive/web-ui generate-routes | Regenerates src/routeTree.gen.ts (commit it). |
bun run --filter @cloudrive/web-ui preview | Serves the built dist/ locally. |
Environment
| Variable | Default | Notes |
|---|---|---|
VITE_API_URL | the page origin | Set only when the API lives on another origin. |
VITE_API_PROXY_TARGET | http://localhost:8080 | Dev server only: where /v1 is proxied. |
VITE_* values are inlined into the browser bundle at build time: never put secrets there.