The Veap Documentation

Veap is a modular, backend-focused TypeScript framework built for Next.js (App Router, React Server Components, and Server Actions). Out of the box, @veap/kernel binds default…

[Browse topics below or select a chapter from the sidebar]

Veap is a modular, backend-focused TypeScript framework built for Next.js (App Router, React Server Components, and Server Actions). Out of the box, @veap/kernel binds default Next.js adapters (NextCookieStore and NextRequestContext) to its HTTP transport ports (COOKIE_STORE and REQUEST_CONTEXT). Because all other Veap packages communicate with the HTTP layer strictly through those two IoC ports rather than importing Next.js directly, Veap works with zero transport configuration in Next.js while remaining easy to run in other frameworks (such as Hono, Express, or standalone Node.js/Bun services) by overriding those ports with custom adapters.

How Veap works#

Every Veap application starts from a central composition root (lib/veap.ts) powered by @veap/kernel. When app.bootstrap() runs, it automatically boots KernelServiceProvider (which sets up the default Next.js COOKIE_STORE and REQUEST_CONTEXT adapters, ConfigService, EventBus, ConsoleLogger, and MemoryCacheProvider) followed by the feature ServiceProvider classes your application registers:

ts
import { Application } from "@veap/kernel";
import { DatabaseServiceProvider } from "@veap/database";
import { AuthServiceProvider } from "@veap/auth";
import { StorageServiceProvider } from "@veap/storage";

export const app = Application.configure()
  .use(DatabaseServiceProvider)
  .use(AuthServiceProvider)
  .use(StorageServiceProvider)
  .create();

Core ecosystem packages#

Veap is distributed as a set of focused packages. You can adopt the full stack or install individual packages incrementally:

PackageDescription
@veap/kernelIoC dependency injection container, Application lifecycle builder, asynchronous eventBus, ConfigService, AppError / Result<T> helpers, and the veap CLI runner.
@veap/databaseKnex-powered Active Record ORM (Model), fluent QueryBuilder, relations (belongsTo, hasMany, polymorphic morphMany / morphToMany), AsyncLocalStorage transactions, and schema migrations.
@veap/authSession management, password hashing (bcrypt), AES-GCM encryption, RBAC roles and permissions, email verification, and Next.js Server Actions (signIn, signUp, signOut).
@veap/pluginsModular plugin contract (IPlugin), virtual router (VeapRouter), UI extension slots (ExtensionPoint), customizable widget grids (WidgetComposer), and CLI management (veap add, veap eject).
@veap/intlServer and client internationalization, ICU message formatting (intl-messageformat), and automatic locale negotiation from cookies and HTTP headers.
@veap/mailPluggable email delivery (sendMail) with SMTP/Nodemailer, console development logging, and custom transport adapters (CUSTOM_MAILER).
@veap/settingsDatabase-persisted key-value application settings (SettingsService) with automatic in-memory caching.
@veap/storageFile upload and deletion router (StorageService) with a hardened LocalFileProvider and custom cloud driver contracts (IStorageProvider).
@veap/uiAccessible React 19 and Tailwind CSS v4 component library built on Radix UI primitives.
create-veapProject scaffolding CLI (bun create veap) for initializing new Next.js + Veap applications.

Polymorphic ORM traits#

In addition to the core infrastructure packages, Veap ships four reusable polymorphic traits for @veap/database models:

Trait packageDescription
@veap/translatableStores multilingual model attributes in a single polymorphic translations table with proxy property access and locale-scoped queries.
@veap/taggableAttaches polymorphic, translatable tags (tags and taggables tables) to any model with query scopes (whereTag, whereAnyTag, whereAllTags).
@veap/categorizableOrganizes models into hierarchical parent-child category trees (categories and categorizables tables) with a <CategoryTreeSelect /> UI component.
@veap/commentableAdds threaded polymorphic comments, nested replies, and moderation statuses (pending, approved, spam, rejected, trash) to any model.

Getting started path#

Follow these four guides in order to set up and structure your first Veap application:

  1. Installation and scaffolding — create a new project with create-veap or add Veap packages to an existing Next.js application.
  2. Your first application — build the lib/veap.ts composition root, configure transport adapters, and resolve services from the container.
  3. Next.js integration — wire Veap into Next.js instrumentation.ts, Server Components, Server Actions, and Route Handlers while respecting server/client boundaries.
  4. Project structure and configuration — understand the directory layout, veap.config.ts, lib/plugins.gen.ts, and plugin ejection.

Kernel fundamentals (@veap/kernel)#

Dive deeper into the core architectural primitives provided by @veap/kernel:

  • IoC container and service providers — dependency injection tokens, @Injectable() and @Inject(), ServiceProvider lifecycle hooks, and Application.configure().
  • Configuration and error handling — veap.config.ts, ConfigService (CONFIG_SERVICE), domain errors with AppError, and Server Action Result<T> helpers (ok, handleActionError).
  • Events, caching, and logging — publish-subscribe EventBus (EVENT_BUS), CACHE_PROVIDER (MemoryCacheProvider), and structured console logging (LOGGER).
  • Console and CLI commands — the veap console runner (ConsoleApplication), built-in commands, and custom Command classes (@veap/kernel/cli).

Packages (@veap/*)#

Learn how to configure and use each package in the Veap ecosystem:

Guides#

Explore cross-cutting recipes and production best practices:

Tutorials#

Build complete end-to-end applications step by step:

API reference#

Look up subpath exports, IoC tokens, class methods, and CLI commands by package:

veap
Preparing0%