app/ or pages/. Keep runtime primitives
at the project root: agents/, tools/, prompts/, workflows/,
resources/, skills/, tasks/, schedules/, webhooks/, and evals/.
Veryfront discovers those directories on startup.
The examples use the default app router. Set router: "pages" in
veryfront.config.ts to use the pages router.
Prerequisites
- A project created with
veryfront init(see Create project), or a blank project withveryfrontinstalled (see Installation). Veryfront discovers these directories by convention either way. - Familiarity with how a file path maps to a route in modern React frameworks.
Directory layout
Routing directories
app/
The app/ directory contains pages, layouts, and API routes. File paths map to
URLs.
Pages use
page.tsx or page.mdx. API routes use route.ts. Layouts use
layout.tsx.
If veryfront.config.ts sets router: "pages", use pages/ and pages/api/ instead.
Typical pages-router layout:
Auto-discovered directories
These directories are scanned automatically at startup. For TypeScript-based primitives, valid default or named exports are registered. For skills, immediate child directories containingSKILL.md are registered.
TypeScript primitives are registered from their exported definitions. Discovery
scans
.ts and .tsx files. Agents can use the filename as the ID when no
explicit ID is provided.
Agent discovery also supports agents/assistant.md. Use frontmatter for
metadata and the markdown body for system instructions.
For skills, the directory name is always the skill ID; a differing legacy or
display-style frontmatter name is treated as presentation metadata and never
changes lookup. For example, skills/incident-response/SKILL.md registers as
"incident-response".
Verify discovery by starting the dev server after adding an agent, tool, or
workflow:
getAgent("assistant") should resolve after agents/assistant.ts exists and
the server reloads.
Customizing discovery paths
Override the default directories inveryfront.config.ts:
Convention directories
These directories are not auto-discovered. They are common project conventions.Generated directories
These directories hold derived output only, so deleting them is safe: the next command regenerates whatever it needs.dist/ is always written into the
project root. During development .cache/ is written there too, but a
production runtime keeps it outside the project. See “Where the cache root
lives” below.
Where the cache root lives
The cache root is.cache/ in the project directory during development. Under
a production runtime it is not in the project at all: when NODE_ENV or
VERYFRONT_MODE is production and HOME is set, the cache root is
.cache/veryfront inside the home directory instead, so a deployed project
directory that is read-only still has somewhere to write. Both roots hold the
same veryfront-mdx-esm/ and veryfront-http-bundle/ subdirectories.
Set VERYFRONT_CACHE_DIR (or VF_CACHE_DIR) to choose the location yourself.
It wins in both modes, so it is also how you keep generated bundles out of the
project tree during development:
Keeping the cache out of version control
The cache root keeps itself out of version control. When the file is absent, both commands create a.gitignore in the cache root containing *, which
ignores the directory’s contents and the file itself, so a project that adopted
Veryfront into an existing tree does not have to edit its own .gitignore. A
marker you wrote yourself (a .cache/.gitignore of your own, say) is never
overwritten in either root, so keep the generated bundles ignored there if you
replace it. veryfront init also lists .cache/ in the .gitignore it
scaffolds.
Deleting the cache root costs only time. The next run recompiles the pages and
refetches the remote dependencies it needs.
Special files
Verify it worked
Add a file in any auto-discovered directory and restartveryfront dev. For
example, add agents/hello.ts:
getAgent("hello")
should resolve from a route or test.