Vajra (वज्र)

Indestructible. Lightning Fast.

The batteries-included TypeScript backend framework built on Bun. Zero external dependencies. No over-engineering.

$
0 Tests
0 Pillars
0 Dependencies
v0.3 Latest

Why Vajra?

Software engineering got too complicated. We're fixing that.

📦

Dependency Hell? Gone.

Express needs 50+ packages for production. Vajra ships everything built-in. JWT, CORS, rate limiting, validation, SSR, WebSocket, AI. Zero external dependencies for core.

🔧

Breaking Updates? Never.

Tired of npm update breaking your app? Vajra controls every feature. No third-party package can break your build. Update once, everything works.

🧠

Over-Engineering? Not Here.

Next.js has 4 caching layers. React has "use client", "use server". Vajra keeps it simple. Server renders by default. Islands for interactivity. No magic directives.

Bun Native. Blazing Fast.

Built for Bun from day one. 100K+ requests/sec. Single binary deployment. Cold start under 50ms. 5x faster than Express without trying.

Get Started in 30 Seconds

app.ts
import { Vajra, logger, helmet, cors } from 'vajrajs';

const app = new Vajra();

app.use(logger());
app.use(helmet());
app.use(cors({ origin: '*' }));

app.get('/', (c) => c.json({ hello: 'vajra' }));

app.get('/users/:id', (c) => {
  return c.json({ id: c.params.id });
});

app.listen(3000);
// Vajra running on http://localhost:3000

6 Pillars. One Framework.

Everything you need for production. Built-in. Not bolted on.

01

Core

Router (100M ops/sec), Context, Middleware, Zod Validation, Static Files, Cookies, JWT, WebSocket, SSE

02

Security

Helmet, CSRF Protection, IP Filter (CIDR), Input Sanitization (XSS/SQLi/NoSQLi), HMAC Verification, BOLA Guard

03

Enterprise

Health Probes (K8s ready), Circuit Breaker, RBAC with Role Hierarchy, W3C Distributed Tracing

04

AI Native

Multi-provider LLM (Claude, GPT, Ollama), Agent Orchestration, Tool Calling, Guardrails, Cost Tracking

05

Microservices

defineModule(), Event Bus, Saga Transactions, Service Registry. Monolith in dev, microservices in prod.

06

SSR

Islands Architecture, Streaming SSR, defineRoute() with Loaders, Reactive Store, Head Manager. No "use client" confusion.

See It In Action

routes/users.ts
app.post('/users', validate({
  body: z.object({
    name: z.string().min(2),
    email: z.string().email(),
  })
}), async (c) => {
  const body = await c.body();
  const user = await db.users.create(body);
  return c.json(user, 201);
});
pages/product.tsx
const productPage = defineRoute({
  async load({ params }) {
    return { product: await db.findById(params.id) };
  },
  meta({ data }) {
    return { title: data.product.name };
  },
  render({ data }) {
    return <ProductPage product={data.product} />;
  },
  cache: { type: 'swr', maxAge: 60 },
});

app.page('/products/:id', productPage);
islands/cart.tsx
// Server renders everything. Islands add interactivity.
// JS ships ONLY for this component. Nothing else.

const AddToCart = island('AddToCart', ({ productId }) => {
  return (
    <button data-id={productId}>
      Add to Cart
    </button>
  );
}, {
  hydrate: 'visible',  // load | visible | idle | media
});
plugins/redis.ts
const redisPlugin = definePlugin({
  name: 'redis',
  defaults: { url: 'redis://localhost:6379' },

  async register(app, config) {
    const client = createClient({ url: config.url });
    await client.connect();
    app.decorate('redis', client);
  },

  async close(app) {
    await app.redis.disconnect();
  },
});

await app.plugin(redisPlugin);
agents/support.ts
const agent = createAgent({
  ai: createAI({ provider: 'claude' }),
  name: 'support-bot',
  tools: {
    searchDocs: {
      description: 'Search documentation',
      parameters: z.object({ query: z.string() }),
      handler: ({ query }) => search(query),
    },
  },
});

app.post('/chat', async (c) => {
  return c.json(await agent.run(c.body.message));
});

How Vajra Compares

Feature Vajra Express Hono Fastify Next.js
SSR (Islands)Built-inNoPartialNoRSC
AI / LLMBuilt-inNoNoNoNo
Security SuiteBuilt-inPluginPluginPluginNo
Rate LimiterBuilt-inPluginPluginPluginNo
WebSocketBuilt-inPluginPluginPluginNo
Circuit BreakerBuilt-inNoNoNoNo
RBACBuilt-inNoNoNoNo
Plugin SystemBuilt-inMiddlewareMiddlewareBuilt-inConfig
Reactive StoreBuilt-inNoNoNoNo
Dependencies030+020+50+

Our Philosophy

Build Once, Don't Touch for Years

We don't break things with updates. Your app built on Vajra v0.3 will work on Vajra v1.0. Stability is a feature, not a compromise.

Simplicity Over Cleverness

No "use client". No "use server". No 4 caching layers. No magic. You write a function, it runs on the server. You make an island, it runs on the client. That's it.

Everything Built-in

99% of what you need for production is inside Vajra. JWT, CORS, rate limiting, validation, SSR, WebSocket, AI, microservices. Install one package, build anything.

No Fear Updates

When you run bun update, nothing breaks. We control every feature. No third-party dependency can ruin your weekend. Sleep well after deploying.

Performance

0+ Requests/sec
0 Tests Passing
<50ms Cold Start
0 Source Files

Everything Built-in

Router (O(1) lookup)
Middleware Pipeline
Zod Validation
JWT Auth
CORS
Helmet (Security Headers)
CSRF Protection
Rate Limiter (Token Bucket)
Input Sanitization
IP Filter (CIDR)
HMAC Verification
BOLA Guard
WebSocket + Auth
SSE (Resumable)
Static File Serving
Cookie Management
Health Probes
Circuit Breaker
RBAC (Role Hierarchy)
Distributed Tracing
Multi-LLM Client
AI Agent + Tools
Guardrails
Cost Tracking
defineModule()
Event Bus
Saga Transactions
Service Registry
SSR (Islands)
Streaming Renderer
defineRoute() Loaders
Reactive Store
Head Manager (SEO)
SSR Cache (SWR)
Plugin System
Prototype Pollution Safe

Choose Your Path

🔌

API Only

Build a REST API. Use any frontend. React, Vue, Svelte, Angular. Vajra handles the backend, your frontend framework handles the UI.

bun add vajrajs
🌐

Full-Stack (SSR)

Server-rendered pages with Islands for interactivity. SEO-friendly, fast TTFB, streaming. No separate frontend build.

bun add vajrajs
📁

Monorepo

Vajra API + React/Vue frontend in one repo. Shared TypeScript types, Zod schemas. Turborepo for builds.

bunx create-vajra --monorepo

FAQ

Vajra has 380+ tests with zero failures. Security modules are audited against OWASP Top 10. It is being used in production for real projects. However, as v0.x, the API may have minor changes before v1.0.

Yes. When used as an API framework, any frontend works. fetch() or axios calls from any framework. For SSR mode, Vajra has its own JSX runtime for server rendering, with Islands that can use any client framework.

Hono and Elysia are excellent routers. But they don't include security, AI, SSR, microservice modules, or circuit breakers. You'd need 10+ additional packages. Vajra includes everything from day one.

Vajra is built specifically for Bun. It uses Bun's native APIs (Bun.serve, Bun.file, WebSocket). Node.js is not supported. Bun is free, fast to install, and production-ready.

Yes. The core framework has zero npm dependencies. Zod is a peer dependency (you install it if you use validation). Everything else, from JWT to CORS to SSR, is built from scratch inside Vajra.

Join the Community