Introduction
Total.js 4 is a full-stack framework for Node.js written in pure JavaScript, with no dependencies.
Total.js 4 is a full-stack framework for Node.js written in pure JavaScript. It builds web applications, REST APIs, background services, desktop and IoT applications with one package, total4, and no dependencies: only Node.js.
What it gives you
- Routing: one
ROUTE()function for pages, REST endpoints, file handlers and WebSockets. See Routing. - Controllers: the object that answers a request (
this.json(),this.view(),this.plain()…). - Schemas and actions: validated input and operations (
insert,update,read, your own) that routes call directly. - Views: a template engine for HTML with layouts, partials and localization.
- Embedded databases: NoSQL and TextDB, stored in files inside the app.
- Localization: resource files and
@(Text)markers in views. - Workers, tasks and FlowStream: background work and visual data flows.
- The
total4command: templates, translations, bundles and packages.
How an app is organized
An app is a folder with a start script (index.js) and some of these folders. Total.js loads them when the app starts; none of them is required.
| Folder | What goes in it |
|---|---|
controllers/ | Routes (exports.install) and their actions |
schemas/ | Schemas and their actions |
definitions/ | Code that runs at start: helpers, auth, configuration |
views/ | HTML templates |
public/ | Static files: CSS, JavaScript, images |
resources/ | Localization files |
databases/ | Data of NoSQL, TextDB and file storages |
modules/, plugins/ | Reusable parts of an app |
workers/, tasks/ | Background work |
jsonschemas/, operations/, middleware/, flowstreams/ | JSON schemas, operations, middleware and FlowStream data |
private/ | Files that are never served |
Versions of this documentation
This project documents the official Total.js 4: the totaljs/framework4 repository and the total4 package on npm (latest 0.0.99). API entries say since which version they exist, so you know what you can use with the version of your app.