Comparison
HazelJS vs NestJS
NestJS structures backends well. HazelJS Agent OS keeps familiar modules/DI and adds DNA packaging, crash-safe HITL, Skillgate, and local apply — clone Meridian to see it.
Updated August 7, 2026
HazelJS vs NestJS
TL;DR
- NestJS is a proven TypeScript framework for APIs and microservices — excellent structure, mature ecosystem.
- AI on NestJS usually means bolting on LangChain, Vercel AI SDK, or custom OpenAI clients yourself.
- HazelJS keeps Nest-familiar modules, decorators, and DI, and ships Agent OS: DNA packages, crash-safe HITL, Skillgate, and local apply in the same backend.
- Choose NestJS when you only need classic backends or are deeply locked into Nest packages.
- Choose HazelJS when durable agents are a core product surface — clone Meridian to see the path.
Who this is for
You should read this if you:
- Know NestJS and want agents without a second framework + glue
- Are evaluating NestJS alternatives for durable LLM / agent backends
- Want one DI container for HTTP controllers and AgentRuns
Stay on NestJS if you:
- Ship mostly CRUD/API services with little AI
- Depend heavily on Nest-specific community modules you cannot replace yet
- Cannot afford a migration window for an existing large Nest monorepo
The problem NestJS does not solve alone
NestJS gives you controllers, providers, modules, guards, and pipes. For production agents you still assemble:
- An LLM SDK (OpenAI, Anthropic, …)
- A chain/agent library (often LangChain)
- Approval / HITL that survives restarts
- Packaging for prompts and policies
- How REST becomes governed tools
That stack works — and it is a lot of glue. Teams end up with two mental models: Nest for HTTP, LangChain for AI.
Side-by-side comparison
| Aspect | NestJS | HazelJS Agent OS |
|---|---|---|
| HTTP + DI | Decorators, modules — mature | Same familiar patterns — Agent OS runs inside them |
| Durable agents | Bring your own runtime + workers | Native AgentRuntime — HITL, contracts, recovery |
| Agent packaging | Config files / tribal knowledge | DNA packages + Store — version like libraries |
| Governed tools | DIY OpenAPI wrappers | Skillgate — curated REST, writes need approval |
| Desired state | K8s or custom deploy scripts | Local apply / Definitions — K8s optional |
| Time to first path | Days of libs + glue | Clone Meridian: store:sync → platform:sync → dev |
Code: Nest-style HTTP vs Agent OS execute
Classic Nest-style controller feel in HazelJS:
import { Controller, Get, Post, Body, HazelModule } from '@hazeljs/core';
import { AITask } from '@hazeljs/ai';
@Controller({ path: '/chat' })
class ChatController {
@AITask({ provider: 'openai', model: 'gpt-4o' })
@Post()
async chat(@Body() body: { message: string }) {
return body.message;
}
@Get('health')
health() {
return { ok: true };
}
}
@HazelModule({ controllers: [ChatController] })
export class AppModule {}
Agent OS execute (no separate LangChain executor):
import { Agent, Tool } from '@hazeljs/agent';
@Agent({
name: 'support-agent',
systemPrompt: 'You are a helpful support agent.',
enableMemory: true,
enableRAG: true,
})
export class SupportAgent {
@Tool({
description: 'Look up order by ID',
parameters: [{ name: 'orderId', type: 'string', required: true }],
})
async lookupOrder(input: { orderId: string }) {
return { status: 'shipped', trackingNumber: 'TRACK123' };
}
}
Architecture decision
| If you need… | Prefer |
|---|---|
| Large existing Nest codebase, little AI | NestJS |
| New AI-native backend in TypeScript | HazelJS |
| Nest HTTP + serious agents/RAG | NestJS + LangChain or HazelJS (see NestJS + LangChain vs HazelJS) |
| Edge-first / multi-runtime only | Hono / similar (not HazelJS’s primary target) |
When NestJS is the better choice
Be honest with the tradeoff:
- Ecosystem gravity — Nest has more tutorials, jobs, and community packages.
- Team familiarity — rewriting working Nest services for AI you barely need is waste.
- Non-AI microservices — HazelJS still works, but Nest’s maturity may win on politics and hiring.
HazelJS wins when AI is a core product surface, not a side feature.
Migration path
Patterns map closely: modules → modules, providers → providers, controllers → controllers. Add @hazeljs/ai / @hazeljs/agent / @hazeljs/rag for AI slices first.
→ Full walkthrough: Migrate from NestJS to HazelJS.
FAQ
See the FAQ section on this page for structured answers (also exposed as FAQ schema for search).
Next steps
- Clone Meridian —
store:sync→platform:sync→dev - Read Agent OS overview and Agent OS guide
- Compare the common combo stack: NestJS + LangChain vs HazelJS
- Packages: Agent, Skillgate
- Star / clone: github.com/hazel-js/hazeljs
FAQ
- Is HazelJS a NestJS fork?
- No. HazelJS is an independent TypeScript framework with Nest-familiar decorators and modules. The product wedge is Agent OS — durable agents with DNA, HITL, Skillgate, and local apply — not a Nest clone.
- Can I use HazelJS with LangChain?
- You can call external libraries from HazelJS services if needed. Most teams use @hazeljs/agent (Agent OS), Skillgate, and optional HCEL chains so HTTP and agents share one DI container.
- When should I stay on NestJS?
- Stay on NestJS if AI is thin, your team is locked into Nest community modules, or migrating a large Nest monorepo is not worth the short-term cost.
- How do I try Agent OS first?
- Clone Meridian (hazeljs-meridian-ops): store:sync → platform:sync → npm run dev. That teaches DNA vs tools, Store vs platform vs run, Skillgate, and crash-safe HITL.
- Does HazelJS support Prisma, GraphQL, and gRPC?
- Yes — via @hazeljs/prisma, @hazeljs/graphql, and @hazeljs/grpc. Those are framework packages; Agent OS is the primary product story.
- Is HazelJS production-ready?
- HazelJS 1.x ships stable semver on npm latest across @hazeljs/*. Agent OS kernel (durable runs, HITL, DNA, Skillgate, local apply) is shipped. Hosted deploy remains optional later.
Docs & next steps
Related comparisons
- NestJS + LangChain vs HazelJS
Nest + LangChain works but creates two paradigms. HazelJS Agent OS unifies durable agents, DNA, Skillgate, and local apply in the same DI app as your APIs.
- HazelJS vs Express
Express maximizes freedom with middleware. HazelJS Agent OS maximizes structure for durable TypeScript agents — DNA, HITL, Skillgate, and controllers included.
- HazelJS vs LangChain
LangChain composes LLM pipelines. HazelJS Agent OS runs those agents inside a production TypeScript backend — DNA, crash-safe HITL, Skillgate, local apply, same DI as your APIs.