I'm excited to announce the official launch of HazelJS - the first truly AI-native TypeScript framework designed to accelerate backend development with built-in AI capabilities, autonomous agents, and enterprise-grade features out of the box.
What is HazelJS?
HazelJS is a modern, AI-first TypeScript framework that combines the best practices of dependency injection, modular architecture, and production-ready features into a single, cohesive ecosystem. Built with AI at its core, it provides everything you need to build intelligent, scalable, and maintainable backend applications powered by cutting-edge AI technologies.
Why We Built HazelJS: The AI-Native Approach
After years of building backend systems, we noticed a seismic shift in how applications are being built. AI is no longer a feature - it's becoming the foundation. Developers are struggling with:
- Fragmented AI integrations: Different SDKs for each AI provider with inconsistent APIs
- Complex agent architectures: Building autonomous agents requires orchestrating LLMs, tools, memory, and state management
- RAG implementation challenges: Vector databases, embeddings, and semantic search are hard to get right
- Lack of AI-native frameworks: Traditional frameworks weren't designed for the AI-first era
We created HazelJS to solve these problems - providing the first truly AI-native framework where AI capabilities are first-class citizens, not afterthoughts. Build intelligent applications with the same ease as traditional CRUD apps.
Key Features
🎯 Core Framework
- Dependency Injection: Powerful IoC container with decorator-based configuration
- Modular Architecture: Build applications with reusable, testable modules
- Type Safety: Full TypeScript support with comprehensive type definitions
- Middleware & Guards: Flexible request/response pipeline with authentication and authorization
🤖 AI-Native Integration (The Heart of HazelJS)
One unified API for all AI providers - switch between models without changing your code:
- OpenAI: GPT-4, GPT-4 Turbo, GPT-3.5 - Industry-leading language models
- Anthropic: Claude 3.5 Sonnet, Claude 3 Opus - Advanced reasoning and analysis
- Cohere: Command, Embed, Rerank - Enterprise-grade NLP
- Google Gemini: Multimodal AI capabilities
// Same code works with any provider!
const response = await ai.complete({
provider: 'openai', // or 'anthropic', 'cohere', 'gemini'
model: 'gpt-4',
messages: [{ role: 'user', content: 'Explain quantum computing' }]
});
Why this matters: Build once, deploy anywhere. Test with different models, optimize costs, avoid vendor lock-in.
🔐 Authentication & Security
- JWT-based authentication out of the box
- Role-based access control (RBAC)
- OAuth 2.0 integration
- Security best practices built-in
⚡ Performance & Scalability
- Multi-tier Caching: Memory, Redis, and CDN support
- WebSocket & SSE: Real-time communication with room management
- Serverless Ready: Deploy to AWS Lambda or Google Cloud Functions
- Service Discovery: Microservices architecture support
🧠 AI-Native Advanced Capabilities
Autonomous AI Agents 🤖
Build intelligent agents that can think, plan, and execute tasks autonomously:
- Tool Execution: Agents can call functions and APIs to interact with the real world
- Memory Management: Persistent context and conversation history
- State Management: Track agent execution across multiple steps
- Approval Workflows: Human-in-the-loop for sensitive operations
const agent = new Agent({
name: 'DataAnalyst',
description: 'Analyzes data and generates insights',
tools: [queryDatabase, generateChart, sendEmail],
llm: { provider: 'openai', model: 'gpt-4' }
});
const result = await agent.execute('Analyze last month sales and email report');
RAG (Retrieval-Augmented Generation) 🔍
Production-ready semantic search and knowledge retrieval:
- Vector Embeddings: Generate embeddings with any provider
- Semantic Search: Find relevant context using cosine similarity
- Multiple Vector Stores: Support for Pinecone, Weaviate, and more
- Automatic Chunking: Smart document splitting for optimal retrieval
// Add knowledge to your AI
await rag.addDocuments([
{ content: 'Product documentation...', metadata: { source: 'docs' } }
]);
// Query with semantic search
const context = await rag.search('How do I configure caching?', { topK: 3 });
// Use in AI completions
const answer = await ai.complete({
provider: 'openai',
messages: [
{ role: 'system', content: `Context: ${context}` },
{ role: 'user', content: 'How do I configure caching?' }
]
});
Traditional Backend Features
- Cron Jobs: Scheduled task execution with timezone support
- Prisma Integration: Type-safe database access with repository pattern
Getting Started
Getting started with HazelJS is simple:
# Install the CLI
npm install -g @hazeljs/cli
# Create a new project
hazel new my-app
# Start building!
cd my-app
npm run dev
Visit the official documentation for comprehensive guides and examples.
AI-Native Use Cases
HazelJS excels at building modern AI-powered applications:
🎯 Intelligent Chatbots & Virtual Assistants
Build conversational AI with context awareness, tool calling, and multi-turn conversations. Perfect for customer support, internal tools, or AI companions.
📊 AI-Powered Data Analysis
Create autonomous agents that can query databases, analyze data, generate visualizations, and provide insights - all through natural language.
📚 Knowledge Base & Documentation AI
Implement RAG systems that can answer questions about your documentation, codebase, or internal knowledge base with semantic search.
🔧 AI Workflow Automation
Build agents that can orchestrate complex workflows, integrate with external APIs, and make decisions based on business logic.
💬 Content Generation & Summarization
Generate blog posts, summaries, translations, or any text-based content with support for multiple AI providers and streaming responses.
🔍 Semantic Search & Recommendations
Implement vector-based search for products, content, or documents with intelligent ranking and personalization.
Real-World Example
Here's a simple example of building an AI-powered API endpoint with HazelJS:
import { Controller, Post, Body, Injectable } from '@hazeljs/core';
import { AIService } from '@hazeljs/ai';
@Injectable()
export class ChatService {
constructor(private ai: AIService) {}
async chat(message: string) {
return await this.ai.complete({
provider: 'openai',
model: 'gpt-4',
messages: [{ role: 'user', content: message }],
});
}
}
@Controller('/api/chat')
export class ChatController {
constructor(private chatService: ChatService) {}
@Post()
async handleChat(@Body() body: { message: string }) {
return await this.chatService.chat(body.message);
}
}
That's it! You have a fully functional AI-powered API with proper dependency injection, type safety, and error handling.
The AI-Native Architecture Advantage
What makes HazelJS truly AI-native? It's not just about having AI integrations - it's about designing the entire framework around AI-first principles:
Unified AI Abstraction Layer
Instead of learning different SDKs for each AI provider, HazelJS provides a single, consistent API. Switch between OpenAI, Anthropic, Cohere, or Gemini with a single configuration change.
Built-in Agent Orchestration
Most frameworks treat agents as an afterthought. HazelJS includes a production-ready agent runtime with:
- Tool registration and execution
- Conversation memory and state management
- Multi-step reasoning and planning
- Error handling and retry logic
- Human approval workflows
First-Class RAG Support
Vector search and semantic retrieval are core primitives, not third-party plugins. Generate embeddings, store vectors, and perform semantic search with the same ease as querying a database.
Streaming by Default
AI responses can be slow. HazelJS supports streaming responses out of the box, providing real-time feedback to users as the AI generates content.
Cost & Performance Optimization
- Intelligent caching: Cache AI responses to reduce API costs
- Provider fallbacks: Automatically switch providers if one fails
- Token counting: Track usage and optimize prompts
- Rate limiting: Prevent API quota exhaustion
Production-Ready Features
HazelJS isn't just another framework - it's built for production from day one:
- ✅ 1,129+ passing tests across all packages
- ✅ Automated CI/CD with GitHub Actions
- ✅ Comprehensive documentation with real-world examples
- ✅ Active development with regular updates
- ✅ TypeScript-first with full type safety
- ✅ Monorepo architecture for easy maintenance
Package Ecosystem
HazelJS is built as a modular monorepo with 14 specialized packages:
@hazeljs/core- Core framework and dependency injection@hazeljs/ai- AI provider integrations@hazeljs/agent- AI agent runtime with tools and memory@hazeljs/auth- Authentication and authorization@hazeljs/cache- Multi-tier caching system@hazeljs/websocket- Real-time communication@hazeljs/serverless- Serverless deployment adapters@hazeljs/rag- Vector search and embeddings@hazeljs/prisma- Database ORM integration@hazeljs/cron- Scheduled task execution- And more!
Each package can be used independently or together as a complete framework.
Open Source & Community
HazelJS is fully open source and available on GitHub. We believe in building in public and welcome contributions from the community.
Get Involved
- ⭐ Star us on GitHub
- 📖 Read the documentation
- 💬 Join our Discord community
- 🐛 Report issues or request features
- 🤝 Contribute to the project
What's Next?
We're just getting started! Our roadmap includes:
- GraphQL support
- gRPC integration
- Enhanced monitoring and observability
- More AI provider integrations
- Advanced agent capabilities
- Performance optimizations
Try It Today
Ready to accelerate your backend development? Install HazelJS today:
npm install @hazeljs/core@beta
Visit hazeljs.com to explore the full documentation, examples, and guides.
About the Author
I'm Muhammad Arslan, a software engineer passionate about building tools that make developers' lives easier. HazelJS is the culmination of years of experience building production systems and learning what works at scale.
Follow the project on GitHub and visit hazeljs.com to stay updated with the latest developments.
Links:
- 🌐 Website: hazeljs.com
- 📚 Documentation: hazeljs.com/docs
- 💻 GitHub: github.com/hazel-js/hazeljs
- 📦 NPM: @hazeljs