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:
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:
| Package | Description |
|---|---|
@veap/kernel | IoC dependency injection container, Application lifecycle builder, asynchronous eventBus, ConfigService, AppError / Result<T> helpers, and the veap CLI runner. |
@veap/database | Knex-powered Active Record ORM (Model), fluent QueryBuilder, relations (belongsTo, hasMany, polymorphic morphMany / morphToMany), AsyncLocalStorage transactions, and schema migrations. |
@veap/auth | Session management, password hashing (bcrypt), AES-GCM encryption, RBAC roles and permissions, email verification, and Next.js Server Actions (signIn, signUp, signOut). |
@veap/plugins | Modular plugin contract (IPlugin), virtual router (VeapRouter), UI extension slots (ExtensionPoint), customizable widget grids (WidgetComposer), and CLI management (veap add, veap eject). |
@veap/intl | Server and client internationalization, ICU message formatting (intl-messageformat), and automatic locale negotiation from cookies and HTTP headers. |
@veap/mail | Pluggable email delivery (sendMail) with SMTP/Nodemailer, console development logging, and custom transport adapters (CUSTOM_MAILER). |
@veap/settings | Database-persisted key-value application settings (SettingsService) with automatic in-memory caching. |
@veap/storage | File upload and deletion router (StorageService) with a hardened LocalFileProvider and custom cloud driver contracts (IStorageProvider). |
@veap/ui | Accessible React 19 and Tailwind CSS v4 component library built on Radix UI primitives. |
create-veap | Project 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 package | Description |
|---|---|
@veap/translatable | Stores multilingual model attributes in a single polymorphic translations table with proxy property access and locale-scoped queries. |
@veap/taggable | Attaches polymorphic, translatable tags (tags and taggables tables) to any model with query scopes (whereTag, whereAnyTag, whereAllTags). |
@veap/categorizable | Organizes models into hierarchical parent-child category trees (categories and categorizables tables) with a <CategoryTreeSelect /> UI component. |
@veap/commentable | Adds 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:
- Installation and scaffolding — create a new project with
create-veapor add Veap packages to an existing Next.js application. - Your first application — build the
lib/veap.tscomposition root, configure transport adapters, and resolve services from the container. - Next.js integration — wire Veap into Next.js
instrumentation.ts, Server Components, Server Actions, and Route Handlers while respecting server/client boundaries. - 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(),ServiceProviderlifecycle hooks, andApplication.configure(). - Configuration and error handling —
veap.config.ts,ConfigService(CONFIG_SERVICE), domain errors withAppError, and Server ActionResult<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
veapconsole runner (ConsoleApplication), built-in commands, and customCommandclasses (@veap/kernel/cli).
Packages (@veap/*)#
Learn how to configure and use each package in the Veap ecosystem:
@veap/database— Active Record models and relations,AsyncLocalStoragetransactions and migrations, and seeders and model factories.- Polymorphic ORM traits — Translatable (
@veap/translatable), Taggable (@veap/taggable), Categorizable (@veap/categorizable), and Commentable (@veap/commentable). @veap/auth— Sessions, Server Actions and RBAC, and email verification, cryptography, and 2FA hooks.@veap/plugins—IPlugincontract, virtual routing (VeapRouter), extension slots, and widgets.@veap/intl— Locale negotiation and ICU formatting in Server and Client Components.@veap/mail— Transactional emails and SMTP or custom mail drivers.@veap/settings— Persisted key-value settings and cached reads withSettingsService.@veap/storage— Local file storage and Server Action uploads with custom cloud drivers.@veap/ui— Tailwind CSS v4 tokens,ThemeProvider, and accessible Radix UI components.create-veap— Project scaffolding CLI and starter template structure.
Guides#
Explore cross-cutting recipes and production best practices:
- Testing Veap applications — container isolation, SQLite
:memory:databases,MemoryCookieStore, andBufferedOutput. - Authoring and customizing plugins — scaffolding workspace plugins with
veap make:plugin, ejecting npm plugins withveap eject, and publishing plugins. - Deployment and production readiness — Docker containerization, Next.js
force-dynamicboundaries, environment variables, CI migrations, and PaaS hosting. - Background tasks, queues, and distributed cache — non-blocking execution with
after(),EventBustopics, BullMQ queue workers, and Redis caching. - Troubleshooting and frequently asked questions — solving database connection exhaustion, SQLite locks, migration recovery, CLI headers, and hydration warnings.
Tutorials#
Build complete end-to-end applications step by step:
- Building a full-stack multilingual blog CMS — combine
@veap/database,@veap/translatable,@veap/taggable,@veap/auth, and@veap/pluginsinto a working CMS.
API reference#
Look up subpath exports, IoC tokens, class methods, and CLI commands by package:
- Core & infrastructure packages:
@veap/kernel,@veap/database,@veap/auth,@veap/plugins,@veap/intl,@veap/mail,@veap/settings,@veap/storage,@veap/ui, andcreate-veap. - Polymorphic ORM traits:
@veap/translatable,@veap/taggable,@veap/categorizable, and@veap/commentable. - Plugin & migration CLI tooling: Plugin CLI and generated files.