Documentation

Welcome to the Baxxon documentation. Baxxon is a minimalist, structural web framework for Node.js designed to be learned in minutes, not days.

Getting Started

Installation

Baxxon is available via npm. Create a new directory and install it to begin.

mkdir my-app && cd my-app
npm init -y
npm install baxxon

Interactive Setup

Upon installation, Baxxon will ask if you want to automatically create a sites/ directory with a "Hello World" example. This is the fastest way to see the framework in action.


Core Concepts

The Visual Contract

Baxxon eliminates routing ambiguity by splitting the web into two mutually exclusive categories based on the URL structure:

Dynamic Logic via JS Modules

Baxxon believes in "No Magic." Your dynamic routes are handled by standard Node.js JS Modules. Each module exports a default function that receives the bx controller.

// modules/index.js
export default function(bx) {
    bx.render.HTML('<h1>Hello World</h1>');
}

The Slash-Param Engine

Baxxon uses a deterministic parser that treats trailing URL segments as data. No complex regex or routing tables are required.

// Example URL: /products/category/shoes/sort/price

// Access as Key/Value pairs (unpaired segments default to '1')
bx.reqURL.searchParams.get('category') // "shoes"
bx.reqURL.searchParams.get('sort')     // "price"

// Access as a raw positional array
bx.params[1] // "shoes"

The bx Controller API

The bx object is your primary interface to the framework's features.

Properties

Rendering Methods

Methods to terminate a request and deliver content:


Built-in Tools

TextDB (Filesystem Database)

Baxxon includes TextDB, a minimalist flat-file database where folders are tables and .txt files are records.

import TextDB from 'baxxon/textdb';

const db = new TextDB({ 
    rootPath: './data', 
    dirs: ['users'] 
});

await db.setData(); // Loads all data from the filesystem
const users = db.getData();

Consistent API Logic

In Baxxon, an API is simply a JS module that returns JSON. The framework uses the same logic and directory structure for APIs as it does for HTML pages, ensuring a unified development experience.