Add to an existing project

Add Veryfront to an existing TypeScript project. For a new app, see Create project.

Veryfront installs as a normal dependency. It does not rewrite your package.json scripts, your tsconfig.json, or any source file you already have.

Prerequisites

  • Node.js 22.3 or later.
  • An existing TypeScript project.

Install the framework

bash
npm install veryfront [email protected] [email protected]

React and React DOM are required peers; install the matching pair shown above. The package ships the framework and the veryfront CLI, so you can run commands with npx veryfront <command> without a global install. See Installation for pnpm, yarn, bun, Deno, and global-CLI variants.

Configure TypeScript

Extend the package's base TypeScript config:

json
{
  "extends": "veryfront/tsconfig.json",
  "include": ["src", "app"]
}

Make sure include covers wherever you keep your own source as well as your routes.

The base config sets "noEmit": true because Veryfront bundles your routes. If your build uses tsc to emit JavaScript, extending this config stops emitting even though the build exits successfully. Keep your config and add the options below, or set "noEmit": false in the config your build uses.

Setting the options yourself

If your project cannot extend that config, including when your build emits with tsc, three settings matter:

json
{
  "compilerOptions": {
    "moduleResolution": "bundler",
    "jsx": "react-jsx",
    "skipLibCheck": true
  }
}

moduleResolution must understand package exports. Veryfront's entry points are subpaths such as veryfront/agent, which the older node and classic modes cannot resolve:

text
app/a.ts(1,23): error TS2307: Cannot find module 'veryfront/agent' or its corresponding type declarations.
  There are types at 'node_modules/veryfront/esm/src/agent/index.d.ts', but this result could not be
  resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.

bundler, node16, and nodenext all work.

jsx is needed because Veryfront routes are .tsx files.

skipLibCheck is recommended rather than required. Installing veryfront on its own no longer pulls MDX into your dependency tree, so a strict project typechecks clean without it.

It becomes necessary once you opt into MDX:

bash
npm install @veryfront/ext-content-mdx

That package depends on @types/mdx, which refers to a global JSX namespace React 19 no longer declares. Everything under node_modules/@types is included by tsc automatically, so it fails on a dependency you never import:

text
node_modules/@types/mdx/types.d.ts(23,38): error TS2503: Cannot find namespace 'JSX'.

Scaffolded projects set all three already, which is why the first two only surface when adding Veryfront to a project you already have.

Without @veryfront/ext-content-mdx installed, .mdx and .md routes report a missing ContentProcessor naming the package to install. Every other route works. The compiled veryfront binary embeds MDX support and is unaffected.

Add an entry route

Veryfront serves the app/ directory. Without it the dev server still starts, but reports that it found no route directories. Create one page:

tsx
// app/page.tsx
export default function Home() {
  return <h1>Hello from Veryfront</h1>;
}

Run it

bash
npx veryfront dev

The CLI prints the URL it bound:

text
✓ App ready       http://localhost:3000
  Execution       This machine

The dev server uses port 3000 by default. When that port is taken it falls forward and prints the port it actually used, so open the URL the CLI prints.

Verify it worked

Open the URL the CLI printed. The page renders Hello from Veryfront.

To ensure the server returns the page, use the port from the printed URL:

bash
curl -s http://localhost:<PORT>/

The response contains Hello from Veryfront.

Your existing scripts are untouched. Confirm the build you had before still runs:

bash
npm run build

If that build emits files, check that its output was actually regenerated. A tsc build that inherited "noEmit": true still exits 0 while writing nothing.

Next steps

GoalPage
Define an agentCreate agent
Expose an agent routeCreate API
Add a chat UICreate frontend
Choose where models runProviders