v2.4.1

Introduction

#divisions is a high-performance, modular framework for building distributed systems. It provides a unified interface for managing resources, handling asynchronous workflows, and scaling stateless services across cloud environments.

ℹ️ Note

This documentation covers #divisions v2.x. For legacy v1.x references, please switch the version selector in the header.

Why #divisions?

Installation

Install the core package using your preferred package manager:

Terminal
# npm
npm install @divisions/core

# yarn
yarn add @divisions/core

# pnpm
pnpm add @divisions/core

Quick Start

Initialize a new divisions instance and start handling requests:

index.ts
import { Divisions, Logger, Metrics } from "@divisions/core";

const app = new Divisions({
  port: 3000,
  plugins: [Logger, Metrics],
});

app.on("request", (ctx) => {
  ctx.respond({
    status: 200,
    body: { message: "#divisions ready" }
  });
});

app.start().then(() => console.log("✅ Server listening"));

Configuration

#divisions uses a hierarchical config system that supports environment variables, YAML files, and runtime overrides.

Parameter Type Default Description
DIV_MODE string "production" Runtime environment mode
DIV_LOG_LEVEL enum "info" Min logging severity
DIV_RETRY_COUNT number 3 Max retry attempts for failed tasks
DIV_METRICS_ENDPOINT string "/metrics" HTTP path for Prometheus metrics
⚠️ Security Warning

Never expose DIV_API_KEY in client-side bundles or public repositories. Use secret managers or environment injection for production deployments.

Architecture Overview

The framework follows a layered architecture pattern:

  1. Transport Layer — Handles HTTP/2, gRPC, and WebSocket multiplexing
  2. Router Layer — Tree-based routing with middleware chaining
  3. Logic Layer — Business handlers and domain services
  4. Data Layer — Caching, persistence adapters, and message queues
💡 Tip

Use the app.inspect() method to visualize your middleware pipeline and route tree during development.

⌘K to open ↑↓ to navigate ↵ to select Esc to close