Getting Started

Introduction

What is dnax Framework? Discover a robust backend solution.

dnax Framework is a robust backend server built on Bun as the JavaScript runtime and MongoDB as the database. It provides a complete suite of tools to build scalable APIs quickly with multi-tenant support, JWT authentication, real-time capabilities, and more.

import { app } from '@dnax/core';

app.boot({
  server: { port: 4000 },
  tenants: [
    {
      id: 'v1',
      dir: 'v1',
      database: { uri: 'mongodb://localhost:27017/mydb' },
    },
  ],
});

Why dnax?

  • Performance — Powered by Bun, one of the fastest JavaScript runtimes available.
  • Simplicity — A single endpoint pattern (POST /api/:tenant/:collection/:action) for all operations. No boilerplate.
  • Multi-Tenant — Isolate data between tenants with separate databases and configuration, out of the box.
  • Type Safety — Full TypeScript support across server, collections, scripts, routes, and the client SDK.
  • Batteries Included — Authentication, validation, hooks, custom actions, custom routes, scripts, real-time — all built in.

Technology Stack

TechnologyRoleDescription
BunRuntimeFast JavaScript/TypeScript runtime and package manager
HonoWeb FrameworkUltrafast HTTP framework for routing and middleware
MongoDBDatabaseDocument database with automatic schema validation and indexing
JoiValidationSchema validation auto-generated from field definitions
JWT (jose)AuthenticationStateless token-based auth with sign and verify helpers
Socket.IOReal-TimeWebSocket support available at /socket.io/

Use Cases

SaaS Platforms

Build multi-tenant applications where each client has isolated data:

tenants: [
  {
    id: 'acme',
    dir: 'src-acme',
    database: { uri: 'mongodb://localhost:27017/acme' },
  },
  {
    id: 'globex',
    dir: 'src-globex',
    database: { uri: 'mongodb://localhost:27017/globex' },
  },
]

REST APIs

Ship a fully-featured API in minutes — define collections, fields, auth, and access control. dnax handles CRUD, validation, hooks, and error formatting.

define.Collection({
  slug: 'products',
  fields: [
    { name: 'name', type: 'string', required: true },
    { name: 'price', type: 'number', required: true },
    { name: 'sku', type: 'random', randomOptions: { length: 8, startWith: 'SKU-' } },
  ],
});

Rapid Prototyping

Go from zero to a running backend with auth, CRUD, and real-time in a single file. Ideal for hackathons, MVPs, and internal tools.

Agency Projects

Manage multiple client projects from one codebase with separate tenants, databases, routes, and scripts per client.

Webhooks & Integrations

Use custom routes to receive webhooks or expose public endpoints alongside the collection API:

define.Route({
  enabled: true,
  method: 'POST',
  path: '/webhooks/stripe',
  handler: async ({ c, rest }) => {
    const event = await c.req.json();
    await rest.insertOne('events', event);
    return c.json({ received: true });
  },
});

Next

  • Quick Start — create a project and your first API call step by step
  • Project structure — recommended repo layout (config/, tenant folder e.g. v1/, uploads, …)
  • Installation — requirements and package install
  • Tenantdir, database, and folder layout
Copyright © 2026