Skip to main content
A workspace is a ZiteJS monorepo: one npm workspace holding every app and automation, the generated database client, and a shared design system. Agents build inside it. This page is the map, so you and they know where everything lives and which files are off limits.

Layout

Each app lives in its own directory, apps/<appDir>/, alongside the workspace’s other apps. Paths the build tools take are relative to the monorepo root, so app files are addressed by their full path (apps/<appDir>/src/...), and root files such as .zite/db.ts without the apps/<appDir>/ prefix. create_app returns a new app’s dir.

Files the platform owns

The platform generates or owns these files. You can’t edit them: Two files you do edit have names the platform’s generated files import, so keep them:
  • src/routes/__root.tsx keeps createRootRouteWithContext<ZiteRouterContext>().
  • src/router.tsx keeps export function getRouter().

Inside an app

  • src/routes/ holds the pages, one file per route: index.tsx is /, customers/$id.tsx is /customers/:id, and a file or folder named _name is a layout that wraps the routes inside it without adding to the URL. See Pages and loaders.
  • src/routes/__root.tsx is the document shell: <html>, the head, the stylesheet, and <NavigationProgress />, the thin bar shown while a click’s next page loads. It already mounts <Toaster />, so don’t add another. Edit it for app-wide head tags and wrappers, keeping <HeadContent /> and <Scripts />.
  • src/router.tsx creates the router with createZiteRouter. Keep that call: it carries the signed-in user, the error screens, and a query client per request. defaultPreload: 'intent' loads a linked page, its loader included, when the link is hovered. Change it here for the whole app, or with preload on a <Link>.
  • Server code lives in two kinds of file. *.functions.ts (for example src/lib/customers.functions.ts) exports the server functions pages call. *.server.ts holds server-only helpers, and page code never imports one: the build refuses it. See Server functions.
  • API routes are routes under src/routes/api/ with server.handlers. See API routes.
  • Data an app ships with, such as a catalog, an archive, or a large lookup table, goes in the database, or in public/ as a JSON file pages fetch. Importing it compiles it into the server bundle too.
create_app scaffolds apps/<dir>/ with a placeholder home page at src/routes/index.tsx. Replace it with the app’s real pages.

Automations

An automation lives in automations/<dir>/, which create_automation scaffolds with no src/index.ts yet:
  • Write it as the default export of src/index.ts: export default createAutomation({ description, on, run }) from zitejs/start. Helpers go in other files under src/.
  • The directory is its id.
  • It has no routes, pages, components or styles, and its dependencies are the workspace root’s.
check_app, get_logs, and publish_app take an automation’s id as they take an app’s, commit builds it with the rest, publishing turns its on on, and run_automation runs a built one once on real data. An app holds no automations. See Apps.

Generated files

Files under any .zite/ directory are generated by ZiteJS: typed wrappers for the database and the app’s SDKs. Read them for types, but never edit them: your changes there are overwritten. Import them through their zitejs/* aliases, never by a relative path to .zite/. zitejs/start, zitejs/auth, zitejs/meta, zitejs/upload, zitejs/pdf, and zitejs/schedules come straight from the zitejs package, with nothing generated. To check an app, run check_app once its changes are written. It regenerates the route tree and the role types from your routes and zite.permissions.json, then type-checks. The platform builds the app itself, so you don’t run vite build, and a bare type-check reads the generated files as they were last written.

Import conventions

  • Platform code: always through zitejs/*: import { zite } from 'zitejs/db' is the database client. Never import from .zite/ by relative path.
  • Shared UI: @project/components/* is the shared design-system package in packages/components/: shadcn/ui primitives, hooks, and utilities. Import primitives from @project/components/ui/*, for example import { Button } from '@project/components/ui/button'.
  • Your own files: components, hooks, and utilities you create under the app’s src/, through relative paths (./components/Foo, ../hooks/useBar).
The @/ alias resolves to the app’s src/, which does not contain the shared primitives. hooks/*, lib/utils, and components/{ui,markdown,markdown-editor,theme-switcher} live in @project/components/* and must be imported from there. The cn classname helper lives at @project/components/lib/utils (note the /lib/):
@project/components/utils does not exist and fails to compile.

Styling

  • The theme lives in CSS variables in the app’s src/index.css. Restyle by changing their values, and keep every variable it defines.
  • Edit src/index.css and tailwind.config.ts for app-wide styling.
  • Theme color variables that tailwind.config.ts consumes as hsl(var(--...)) (--primary, --background, --accent, --chart-*, and so on) must each be a bare, space-separated HSL triple, such as --primary: 222.2 47.4% 11.2%;, with no hsl() wrapper and no hex, rgb, or oklch. Otherwise the wrapped result is invalid CSS and the color silently doesn’t apply.
  • Leave non-color and composite variables (--shadow-*, --radius, --font-*, and so on) in their native CSS format. Don’t rewrite them as HSL triples.
  • For dark mode, put the dark palette in the .dark {} block and keep :root as the light baseline. Switch by putting the dark class on <html> (document.documentElement), rather than rewriting :root.
  • src/index.css uses Tailwind v3 directives: @tailwind base; @tailwind components; @tailwind utilities;. Use these, not @import 'tailwindcss', which is Tailwind v4 syntax and breaks the build.
  • Any @import, such as a Google Fonts URL, comes first, above the @tailwind directives. @tailwind base expands into real CSS rules, and an @import after other rules fails the PostCSS build.

Config files

  • zite.config.json at the workspace root holds the connections every app can use, under integrations.
  • zite.config.json in each app holds that app’s settings: accessMode, authentication, integrationSettings, seoSettings, and more. See App config.
  • zite.auth.ts in an app, next to its zite.config.json, holds optional sign-in hooks. See App config.

Context

context/ at the workspace root holds Markdown documents you write for the agent: data model notes, policies, specs, process notes. context/index.json lists each file with a one-line description. The agent reads the index first, then the entries relevant to what it’s doing, and leaves the files alone unless you ask it to change them.