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.
This documentation covers #divisions v2.x. For legacy v1.x references, please switch the version selector in the header.
Why #divisions?
- Modular Architecture — Compose only what you need. Zero bloat.
- Type-Safe — Full TypeScript support with strict inference.
- Observability First — Built-in tracing, metrics, and structured logging.
- Edge-Ready — Runs anywhere: serverless, edge, or bare metal.
Installation
Install the core package using your preferred package manager:
# 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:
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 |
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:
- Transport Layer — Handles HTTP/2, gRPC, and WebSocket multiplexing
- Router Layer — Tree-based routing with middleware chaining
- Logic Layer — Business handlers and domain services
- Data Layer — Caching, persistence adapters, and message queues
Use the app.inspect() method to visualize your middleware pipeline and route tree during development.