app/ or pages/. Keep AI primitives at
the project root: agents/, tools/, prompts/, workflows/, resources/,
and skills/. 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). - 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.
| File | URL |
|---|---|
app/page.tsx | / |
app/about/page.tsx | /about |
app/blog/[slug]/page.tsx | /blog/:slug |
app/api/users/route.ts | /api/users |
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, files with a default export are registered. For skills, directories containingSKILL.md are registered.
| Directory | Purpose | Import |
|---|---|---|
agents/ | AI agent definitions | veryfront/agent |
tools/ | Tool definitions with Zod schemas | veryfront/tool |
prompts/ | Prompt templates | veryfront/prompt |
workflows/ | Multi-step workflow DAGs | veryfront/workflow |
resources/ | MCP-exposable resources | veryfront/resource |
skills/ | Skill packs for agent skill tools | Enabled via agent({ skills: ... }) |
agents/assistant.ts registers as "assistant" and resolves with
getAgent("assistant").
Agent discovery also supports agents/assistant.md. Use frontmatter for
metadata and the markdown body for system instructions.
For skills, the directory name is the skill ID. 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.| Directory | Purpose |
|---|---|
components/ | Shared React components |
lib/ | Shared utilities and business logic |
content/ | App-owned content files |
public/ | Static assets served at root path |
styles/ | Global CSS files |
middleware/ | Custom middleware functions |
Special files
| File | Purpose |
|---|---|
app/layout.tsx | Root layout wrapping all pages |
app/error.tsx | Error boundary for the app |
app/not-found.tsx | Custom 404 page |
veryfront.config.ts | Framework configuration |
package.json | Dependencies and metadata |
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.