Documentation Index
Fetch the complete documentation index at: https://veryfront.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Pages and routing
File-based routing, layouts, dynamic routes, and MDX pages. Examples below use the default app router. Veryfront Code also supports the pages router throughveryfront.config.ts with router: "pages".
Prerequisites
- A project created with
veryfront init(see Quickstart). - The dev server is the easiest way to test routes:
veryfront dev.
Router equivalents
Veryfront supports both router styles. The main difference is file shape:| URL / capability | App router | Pages router |
|---|---|---|
/ | app/page.tsx | pages/index.tsx |
/about | app/about/page.tsx | pages/about.tsx |
/blog/:slug | app/blog/[slug]/page.tsx | pages/blog/[slug].tsx |
/api/users | app/api/users/route.ts | pages/api/users.ts |
| Root layout | app/layout.tsx | pages/layout.tsx |
Basic pages
veryfront dev and open http://localhost:3000. The page should render Welcome.
Layouts
Layouts wrap pages and persist across navigation. Createlayout.tsx at any level:
/dashboard/settings renders inside both the root layout and the dashboard layout.
Dynamic routes
Use brackets for dynamic segments:usePageContext hook:
Post: hello.
Catch-all routes
Use[...segments] to match multiple path segments:
MDX pages
Rename any page to.mdx to write content in Markdown with JSX:
usePageContext() from veryfront/context:
Client components
By default, components render on the server. Add'use client' to make a component interactive:
Navigation
Use theLink component for client-side navigation:
Verify it worked
Start the dev server and request each page you added:HTTP/1.1 200 OK. Visit the same URLs in a browser
to confirm the React component renders without console errors.
Next
- Data fetching: load data on the server or at build time
- API routes: create backend endpoints
Related
veryfront/router: router API referenceveryfront/context: params, page data, and frontmatter hooksveryfront/mdx: MDX component overrides