Skip to content

finom/vovk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2,270 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vovk
Back-end Framework for Next.js App Router
Documentation    Quick Start    Performance


Vovk.ts CI MIT License Runtime NPM Version CLI NPM Version

Vovk.ts lets you build a structured back end on top of Next.js App Router Route Handlers—and generate a type-safe client, OpenAPI, and AI tools from the same code. Under the hood: you write Controllers (real handlers), and Vovk emits schema artifacts for codegen—without maintaining a separate contract layer.

Requirements: Node.js 22+ and Next.js 15+

Install to existing Next.js project

npx vovk-cli@latest init

See: https://vovk.dev/quick-install

Why you’d use it

  • Stay native to Next.js (routing, streaming, middleware/auth patterns, deployment targets)
  • Structured API layer (Controller → Service → Repository) on top of Route Handlers
  • Schema emission as a build artifact (.vovk-schema/) to power codegen/docs/AI tools
  • Typed request handling via procedure(...) with { params, query, body }
  • Back-end segmentation via segments: split your API into independently configured units that each compile into their own serverless function
  • Mix in third-party OpenAPI schemas as modules that share the same client/tooling pipeline (OpenAPI mixins)
  • Derive AI tools from your API surface (controllers and emitted RPC modules can be exposed as AI tools with parameters + execute)

What it looks like

Controller + decorator:

export default class UserController {
  @get('{id}')
  static async getUser(req: NextRequest, { id }: { id: string }) {
    // ...
  }
}

With procedure you validate and type inputs in-place:

export default class UserController {
  @get('{id}')
  static getUser = procedure({
    params: z.object({
      id: z.string().uuid(),
    }),
    handle: async (req, { id }) => {
      // ...
    },
  });
}

Codegen emits fetch-powered client:

import { UserRPC, PetstoreAPI } from 'vovk-client';

const user = await UserRPC.getUser({ params: { id: '123' } });
const pet = await PetstoreAPI.getPetById({ params: { petId: 1 } });

Controllers (current context execution), RPC/API modules (HTTP calls) can be used to derive AI tools:

const { tools } = deriveTools({ modules: { UserRPC, TaskController, PetstoreAPI } });
console.log(tools); // [{ name, description, parameters, execute }, ...]

Procedures can be executed locally for SSR/PPR:

await UserController.getUser.fn({ params: { id: '123' } });

Runtime vs toolchain

  • vovk (runtime): decorators, procedure, routing helpers, deriveTools
  • vovk-cli (toolchain): codegen, docs generation, bundling/publishing
  • vovk-client (optional): re-exported composed client for easy imports

Packages overview: https://vovk.dev/packages

Links


License: MIT (see LICENSE).

About

đŸș Back-end Framework for Next.js App Router

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published