Application architecture
The application repository contains the Fastify API and the TanStack Start frontend. The API owns authorization, SQLite, uploads and processing. The frontend renders pages and streams requests to the API.
- Routes and data. The frontend uses file-based routes and generated TanStack Router types. Protected screens use a session-aware loader or query. Successful mutations invalidate the relevant owner-scoped library cache. The overview loads a small set of recent files, folders, and tags.
- API transport. The app uses one public origin for pages, API calls, downloads, and OAuth. Server functions resolve their backend using
BASE_API_URL. Public share routes use their own anonymous endpoints. SSE uses an isolated connection pool. - Storage and media. Drizzle migrations update SQLite. The API checks a file's availability before sending media, and browser media policies apply at the frontend proxy. Preview routes preserve ranges and cache validation. See moderation.
- UI conventions. Reuse the React Aria controls and theme tokens in the frontend package. Use the shared header, pagination, and pending skeletons for library pages. The signed-in development-only
/stylepage demonstrates components. - Performance. Preserve URL-based gallery state and owner-scoped query keys during navigation. Keep ordinary API requests separate from open event streams. For changes to proxy requests or media, compare cold and revalidated requests using a local fixture.
See development for project commands and troubleshooting for the operator view.