Total.js V5 0.0.20
The current Total.js framework for Node.js. Choose it for new server-side applications, REST APIs and real-time services.
Getting started
-
Introduction
What Total.js framework v5 is, what the total5 package includes and the main concepts of a Total.js application.
-
Installation and first app
Install the total5 package, write the start script, add a first route and action, and run the app in debug and release mode.
-
Your first form
Show a form, receive its data and answer with a new page.
-
Migrating from Total.js 4
Move a Total.js 4 application to Total.js 5, area by area, with the code before and after each change.
-
Running in production
Run a Total.js application on a server: no watcher, the right address, automatic restarts, nginx, clean stops and logs.
-
Configuration
The config file and its types, .env, CONF, LOADCONFIG() and DEBUG.
Reference 54 -
Application structure and modes
The start script, the folders and their loading order, debug and release mode, bundles, remote editing, modules and statistics.
Reference 36 -
Unit tests
Write unit tests with the Test runner of total5/test: test groups, results, fake actions and how to run them with total5 test.
Reference 9 -
Command line (total5)
The total5 and flow5 programs: a static web server, translations, minifying, bundles, remote editing, a proxy client, tests and running flows.
Reference 23
Web server
-
Routing
Declare routes with ROUTE(): methods, dynamic paths, authorization, actions, API endpoints, flags, file routes, CORS and proxies.
Reference 48 -
Controller
The
Reference 59$object of a route action: request data, uploaded files, responses, errors, headers and cookies. -
Actions
Declare business logic with NEWACTION(), validate its input, expose it as a route and run it from code with ACTION().
Reference 64 -
Schemas and validation
Inline schemas, JSON schemas and ErrorBuilder: how Total.js 5 validates and converts data.
Reference 57 -
Views
HTML views with @{} commands: rendering, layouts, conditions, loops, sections, meta tags, imports, helpers and templates.
Reference 48 -
Middleware
Run named functions before routes, WebSockets and actions with NEWMIDDLEWARE().
Reference 6 -
Static files
Serve the public folder with minification, caching, compression and ranges, and merge files into one.
Reference 26 -
WebSockets
Real-time connections with SOCKET routes, the WebSocket object and its clients, compression, ping and the WebSocket client.
Reference 55 -
Localization
Translate views, files and messages with resource files, choose the language of each request and create dictionaries with total5 translate.
Reference 25
Security
-
Authorization
Decide who the user of a request is with AUTH(), protect routes and actions, and use built-in sessions.
Reference 31 -
Encryption
Encrypt values with ENCRYPT() and DECRYPT(), bind them to the client of a request with ENCRYPTREQ() and DECRYPTREQ(), and choose the cipher.
Reference 7 -
Audit logs
Record who did what with AUDIT() and $.audit(), audit actions after they succeed, and store the records where you need them.
Reference 5
Data
-
NoSQL database
The embedded NoSQL database: NOSQL(name), files in databases/, inserting, finding, updating and removing documents with the query builder.
Reference 44 -
QueryBuilder
Query any database with one QueryBuilder: DATA, DB(), adapters, filters, paging and autoquery.
Reference 56 -
PostgreSQL
Connect to PostgreSQL with DATA.init() and run the QueryBuilder, raw SQL and transactions on it.
Reference 14 -
File storage
Store, read, serve and manage binary files with FILESTORAGE(), including uploaded files.
Reference 33
Integrations
-
HTTP requests
Call other HTTP services with RESTBuilder, REQUEST(), AJAX() and DOWNLOAD().
Reference 47 -
OpenClient
Open a WebSocket connection to another service with OPENCLIENT() and send messages that wait for an answer.
Reference 7 -
Sending email
Send e-mail with MAIL(), HTMLMAIL() and LOGMAIL(), configure SMTP, add attachments and build messages with the Mail module.
Reference 43 -
Message Service (TMS)
Publish events, receive messages and answer calls over TMS.
Reference 20 -
APIs
Register named APIs with NEWAPI(), call remote services through them with API(), and use the Total.js API service.
Reference 18 -
MCP server
Expose actions as tools for AI clients with the built-in MCP endpoint POST /$mcp/ and protect it with Total.mcp.auth; GET /$mcp/client.js gives agents the tools as code.
Reference 14 -
AI models
Register AI model handlers with NEWAIMODEL() and build chat requests with AIMODEL(): messages, config, callbacks, promises, streaming and tool calls.
Reference 35
Processes and events
-
Scheduling and events
Crons, global events, the events of the framework, debounced timers, pausing the server and the service timer.
Reference 26 -
Plugins and components
Plugins in the plugins/ folder, PLUGINS, UI bundles from COMPONENTATOR(), server components with NEWCOMPONENT(), and NPMINSTALL(), REQUIRE() and IMPORT().
Reference 46 -
FlowStream
Visual data flows: loading FlowStreams, components, instances, messages and the Total.js Flow editor.
Reference 55 -
Workers, threads and cluster
Worker threads, thread pools, cluster mode, shell commands, Python scripts and Python pipelines.
Reference 44
Utilities
-
Utilities
The global helpers of Total.js 5: the U/Utils module, identifiers, copies, the in-memory cache, shared objects, PATH, MEMORIZE(), BACKUP() and RESTORE().
Reference 61 -
Prototypes
Methods that Total.js adds to String, Number, Date and Array: formatting, parsing, validation, hashing, dates and array helpers.
Reference 70 -
Images
Resize, crop, convert, watermark and measure images with GraphicsMagick or ImageMagick.
Reference 55
Modules
-
Proxy
Forward requests with PROXY(), and publish an app of a private network through a public Total.js app with PROXYSERVER() and PROXYCLIENT().
Reference 2 -
LDAP
Read users and groups from an LDAP server such as Active Directory with LDAP().
Reference 1 -
Markdown
Convert Markdown to HTML with String.prototype.markdown(), and the Markdown syntax it supports.
Reference 2 -
HTML and XML parser
Parse HTML and XML on the server into a tree of elements that you can search and change.
Reference 17 -
Macros
Compile a small rule language into a function with NEWMACRO(), for rules that users write.
Reference 2 -
Tangular
The Tangular template engine: compile and render templates and register helpers.
Reference 4 -
Minification
Minify JavaScript, CSS and HTML from your code with the minificators of U.
Reference 3 -
CMS compiler
Compile pages made with the Total.js CMS editor and render them with their widgets.
Reference 7