Kaelum.JS β Minimalist Node.js framework to simplify creation of web pages and REST APIs.
Designed for students and developers who want a fast, opinionated project scaffold and a small, friendly API that encapsulates common Express.js boilerplate.
π Read the full documentation here
Create a new project (interactive):
npx kaelum createOr create non-interactively (project name + template):
npx kaelum create my-app --template web
# or
npx kaelum create my-api --template apiThen:
cd my-app
npm install
npm startNo need to install Kaelum globally β
npxhandles execution.
-
CLI that scaffolds a ready-to-run project (Web or API template) using an opinionated MVC structure.
-
Thin abstraction layer over Express.js that:
- automates JSON / URL-encoded parsing by default,
- automatically configures common security middlewares via
setConfig(CORS, Helmet), - exposes a small, easy-to-learn API for routes, middleware and configuration.
-
Small set of helpers for common tasks:
start,addRoute,apiRoute,setConfig,static,redirect,healthCheck,useErrorHandler, and more.
Kaelum aims to reduce the initial setup burden while keeping flexibility for advanced users.
my-web-app/
βββ public/ # Static files (CSS, JS)
β βββ style.css
βββ views/ # HTML templates
β βββ index.html
βββ controllers/ # Controller logic (MVC)
β βββ .gitkeep
βββ middlewares/ # Custom middlewares
β βββ logger.js
βββ routes.js # Route definitions (example uses Kaelum helpers)
βββ app.js # Server initialization (uses Kaelum API)
βββ package.json
my-api-app/
βββ controllers/
β βββ usersController.js
βββ middlewares/
β βββ authMock.js
βββ routes.js
βββ app.js
βββ package.json
Kaelum exposes a factory β use
require('kaelum')and call it to get an app instance:
const kaelum = require("kaelum");
const app = kaelum();Enable/disable common features:
app.setConfig({
cors: true, // apply CORS (requires cors package in dependencies)
helmet: true, // apply Helmet
static: "public", // serve static files from "public"
bodyParser: true, // default: enabled (JSON + urlencoded)
logs: false, // enable request logging via morgan (if installed)
port: 3000, // prefered port (used when calling app.start() without port)
});setConfigpersists settings to the Kaelum config and will install/remove Kaelum-managed middlewares.- Kaelum enables JSON/urlencoded parsing by default so beginners won't forget to parse request bodies.
Starts the HTTP server. If port is omitted, Kaelum reads port from setConfig or falls back to 3000.
app.start(3000, () => console.log("Running"));Register routes easily:
app.addRoute("/home", {
get: (req, res) => res.send("Welcome!"),
post: (req, res) => res.send("Posted!"),
});
// apiRoute builds RESTy resources with nested subpaths:
app.apiRoute("users", {
get: listUsers,
post: createUser,
"/:id": {
get: getUserById,
put: updateUser,
delete: deleteUser,
},
});addRoute also accepts a single handler function (assumed GET).
Flexible helper to register middleware(s):
// single middleware
app.setMiddleware(require("helmet")());
// array of middlewares
app.setMiddleware([mw1, mw2]);
// mount middleware on a path
app.setMiddleware("/admin", authMiddleware);Register a redirect route:
app.redirect("/old-url", "/new-url", 302);Adds a health endpoint returning { status: 'OK', uptime, timestamp, pid }.
Attach Kaelum's default JSON error handler:
app.useErrorHandler({ exposeStack: false });It will return standardized JSON for errors and log server-side errors (5xx) to console.error.
git clone https://github.com/MatheusCampagnolo/kaelum.git
cd kaelum
npm install
npm linkNow you can test the CLI locally:
npx kaelum create my-test --template web- Reduces repetitive boilerplate required to start Node/Express web projects.
- Opinionated scaffolding (MVC) helps beginners adopt better structure.
- Keeps a small API surface: easy to teach and document.
- Extensible β
setConfigand middleware helpers allow adding features without exposing Express internals.
Kaelum is under active development. CLI scaffolds web and API templates, and the framework includes the MVP helpers (
start,addRoute,apiRoute,setConfig,static,redirect,healthCheck,useErrorHandler) and security toggles forcorsandhelmet.
MIT β see LICENSE.
- Templates use
commonjs(require/module.exports). - Update template dependencies to reference the correct Kaelum version when releasing new npm versions.