# Total.js V4 0.0.99 > The previous Total.js framework for Node.js. Use this documentation to maintain applications built with Total.js 4. Status: current. License: MIT. Full text in one file: https://totaljs.es/docs/total-js-v4/0-0-99/llms-full.txt Source code: https://github.com/totaljs/framework4 ## Guides - [Introduction](https://totaljs.es/docs/total-js-v4/0-0-99/guides/introduction.md): Total.js 4 is a full-stack framework for Node.js written in pure JavaScript, with no dependencies. - [Installation and first app](https://totaljs.es/docs/total-js-v4/0-0-99/guides/installation.md): Install Total.js 4, write the start script and answer your first requests. - [Routing](https://totaljs.es/docs/total-js-v4/0-0-99/guides/routing.md): Methods, dynamic parameters, signed-in users, schemas, API routes, views and flags of ROUTE(). - [Controllers](https://totaljs.es/docs/total-js-v4/0-0-99/guides/controllers.md): The controller is `this` in every route action: it holds the request data and answers the request. - [Schemas and actions](https://totaljs.es/docs/total-js-v4/0-0-99/guides/schemas.md): Declare schemas with typed and validated fields, write operations and actions, use the $ object and call them from routes and code. - [Views](https://totaljs.es/docs/total-js-v4/0-0-99/guides/views.md): HTML templates in views/: expressions, conditions, loops, layouts, partials, sections, helpers and localization. - [Configuration](https://totaljs.es/docs/total-js-v4/0-0-99/guides/configuration.md): How Total.js loads the config files and .env files, how values are parsed, and how to read and change them through CONF. - [Authorization and sessions](https://totaljs.es/docs/total-js-v4/0-0-99/guides/authorization.md): Sign in requests with the AUTH() delegate, limit routes with the + and - flags, and keep sessions in cookies, tokens or the SESSION() store. - [Encryption](https://totaljs.es/docs/total-js-v4/0-0-99/guides/encryption.md): Encrypt values with ENCRYPT() and DECRYPT(), bind them to the browser of a request with ENCRYPTREQ() and DECRYPTREQ(), and set the secret. - [Middleware](https://totaljs.es/docs/total-js-v4/0-0-99/guides/middleware.md): Run code before routes and files with MIDDLEWARE(), in a route or for many routes at once with USE(). - [Static files](https://totaljs.es/docs/total-js-v4/0-0-99/guides/static-files.md): Serve the public directory, build the URLs of static files, map, merge and resize files, answer with file routes and localize static files. - [WebSockets](https://totaljs.es/docs/total-js-v4/0-0-99/guides/websockets.md): Declare WebSocket routes, handle clients and messages in the WebSocket controller, and connect to WebSocket servers with WEBSOCKETCLIENT(). - [NoSQL database](https://totaljs.es/docs/total-js-v4/0-0-99/guides/nosql.md): The embedded file database of Total.js 4: NOSQL() for JSON documents and TABLE() for rows with a schema, both stored in the databases/ folder and queried with the same builder. - [Localization](https://totaljs.es/docs/total-js-v4/0-0-99/guides/localization.md): Translate views, static files, errors and e-mails with resource files and a language for each request. - [HTTP requests](https://totaljs.es/docs/total-js-v4/0-0-99/guides/http-requests.md): Call other HTTP services with RESTBuilder, REQUEST() and DOWNLOAD(). - [Sending email](https://totaljs.es/docs/total-js-v4/0-0-99/guides/mail.md): Send email from views, HTML or logs with the SMTP server of the configuration, and send messages to any server with the Mail module. - [Scheduling and events](https://totaljs.es/docs/total-js-v4/0-0-99/guides/scheduling-and-events.md): Run jobs at a time, by cron or every few minutes, and react to framework events with ON() and EMIT(). - [File storage](https://totaljs.es/docs/total-js-v4/0-0-99/guides/file-storage.md): Save, read, serve and manage binary files with FILESTORAGE(). - [Operations and tasks](https://totaljs.es/docs/total-js-v4/0-0-99/guides/operations-and-tasks.md): Reusable business logic with operations, chained operations, tasks with steps, commands, extensions and PROMISIFY(). - [Utilities](https://totaljs.es/docs/total-js-v4/0-0-99/guides/utilities.md): Global helpers and the U object: identifiers, object copies, paths, files, queues and text functions. - [Prototypes](https://totaljs.es/docs/total-js-v4/0-0-99/guides/prototypes.md): Methods that Total.js 4 adds to strings, numbers, dates and arrays. - [FlowStream](https://totaljs.es/docs/total-js-v4/0-0-99/guides/flowstream.md): Run graphs of components from .flow files in /flowstreams/, write components and work with messages and FlowStream instances. - [QueryBuilder](https://totaljs.es/docs/total-js-v4/0-0-99/guides/querybuilder.md): Query SQL databases with DATA, DB() and the QueryBuilder, and connect your database with an adapter registered by NEWDB(). - [JSON schemas](https://totaljs.es/docs/total-js-v4/0-0-99/guides/json-schemas.md): Validate and convert data with JSON schemas: files in jsonschemas/, inline declarations and actions. - [Workers, threads and cluster](https://totaljs.es/docs/total-js-v4/0-0-99/guides/workers-and-threads.md): Run code in worker threads and child processes, run shell commands, and run the app as a cluster or as separate threads. - [Message Service and APIs](https://totaljs.es/docs/total-js-v4/0-0-99/guides/message-service-and-apis.md): Publish, receive and call over the Total.js Message Service, connect with TMSCLIENT(), call APIs with API() and NEWAPI(), and expose API routes. - [Images](https://totaljs.es/docs/total-js-v4/0-0-99/guides/images.md): Resize, crop, convert and measure images with the Image module and GraphicsMagick or ImageMagick. - [HTTP server: CORS, proxy and errors](https://totaljs.es/docs/total-js-v4/0-0-99/guides/http-server.md): Start the HTTP server, allow cross-origin requests, forward and redirect requests, and design error pages. - [Sitemap](https://totaljs.es/docs/total-js-v4/0-0-99/guides/sitemap.md): Describe the pages of a website in the sitemap file and use it for navigation and breadcrumbs. - [Cache, counters and small stores](https://totaljs.es/docs/total-js-v4/0-0-99/guides/caching-and-small-stores.md): Keep values in the in-memory cache, in files and in preferences, count statistics, and back up folders. - [Application structure and modes](https://totaljs.es/docs/total-js-v4/0-0-99/guides/application-structure.md): Which directories Total.js 4 loads and in which order, debug and release modes, bundles, packages and workers. - [Testing](https://totaljs.es/docs/total-js-v4/0-0-99/guides/testing.md): Run groups of tests with TESTER() and send virtual requests to your routes with TEST() and ACTION(). - [LDAP](https://totaljs.es/docs/total-js-v4/0-0-99/guides/ldap.md): Read entries from an LDAP server such as Active Directory with LDAP(). - [Markdown](https://totaljs.es/docs/total-js-v4/0-0-99/guides/markdown.md): Convert Markdown to HTML with String.markdown() and choose what it produces with its options. - [HTML parser](https://totaljs.es/docs/total-js-v4/0-0-99/guides/html-parser.md): Parse HTML on the server into a tree of nodes that you can search and change. - [Macros](https://totaljs.es/docs/total-js-v4/0-0-99/guides/macros.md): Compile a small rule language into a function with NEWMACRO(), for rules that users write. - [CMS compiler](https://totaljs.es/docs/total-js-v4/0-0-99/guides/cms.md): Compile pages made with the Total.js CMS editor and render them with their widgets. - [UI Builder compiler](https://totaljs.es/docs/total-js-v4/0-0-99/guides/ui-builder-compiler.md): Prepare a schema of the UI Builder designer for production with F.uibuildercompiler(). - [Tangular](https://totaljs.es/docs/total-js-v4/0-0-99/guides/tangular.md): The Tangular template engine: compile and render templates and use its helpers. - [Command line (total4)](https://totaljs.es/docs/total-js-v4/0-0-99/guides/command-line.md): The total4 command-line tool: creating projects, serving a folder, bundles, minifying and localization resources. ## Reference - [Routing](https://totaljs.es/docs/total-js-v4/0-0-99/reference/routing.md): The ROUTE() function: every way to declare a route in Total.js 4. - [Controller](https://totaljs.es/docs/total-js-v4/0-0-99/reference/controller.md): Properties and methods of the controller, the object that answers a request. - [Schemas](https://totaljs.es/docs/total-js-v4/0-0-99/reference/schemas.md): NEWSCHEMA(), schema methods, the $ object of operations, NEWACTION() and how to run operations from code. - [Views](https://totaljs.es/docs/total-js-v4/0-0-99/reference/views.md): Every command of the view engine and the controller methods that render views. - [Configuration](https://totaljs.es/docs/total-js-v4/0-0-99/reference/configuration.md): The CONF object, every built-in config key and the functions for loading configuration. - [Authorization](https://totaljs.es/docs/total-js-v4/0-0-99/reference/authorization.md): AUTH(), route flags, roles, cookies and the SESSION() store. - [Encryption](https://totaljs.es/docs/total-js-v4/0-0-99/reference/encryption.md): ENCRYPT(), DECRYPT(), ENCRYPTREQ(), DECRYPTREQ() and CONF.secret. - [Middleware](https://totaljs.es/docs/total-js-v4/0-0-99/reference/middleware.md): MIDDLEWARE(), USE(), MiddlewareOptions and the $ object of a middleware. - [Static files](https://totaljs.es/docs/total-js-v4/0-0-99/reference/static-files.md): File routes, the response methods for files, and the helpers and config of static files. - [WebSockets](https://totaljs.es/docs/total-js-v4/0-0-99/reference/websockets.md): The SOCKET route, the WebSocket controller, the connected client and WEBSOCKETCLIENT(). - [NoSQL database](https://totaljs.es/docs/total-js-v4/0-0-99/reference/nosql.md): NOSQL(), TABLE(), database methods, the query builder and the config keys of the embedded database. - [Localization](https://totaljs.es/docs/total-js-v4/0-0-99/reference/localization.md): Resource files, translation functions, the localization delegate and the translate tool. - [HTTP requests](https://totaljs.es/docs/total-js-v4/0-0-99/reference/http-requests.md): RESTBuilder, REQUEST() and DOWNLOAD(): the clients for other HTTP services. - [OpenClient](https://totaljs.es/docs/total-js-v4/0-0-99/reference/openclient.md): OPENCLIENT(): a WebSocket client for messages to other services. - [Mail](https://totaljs.es/docs/total-js-v4/0-0-99/reference/mail.md): Global mail functions, the mail configuration, the Mail module and the message object. - [Scheduling and events](https://totaljs.es/docs/total-js-v4/0-0-99/reference/scheduling-and-events.md): SCHEDULE(), the event functions, every built-in event and the timing helpers. - [File storage](https://totaljs.es/docs/total-js-v4/0-0-99/reference/file-storage.md): FILESTORAGE(), its methods, the meta object and the controller methods that serve stored files. - [Operations and tasks](https://totaljs.es/docs/total-js-v4/0-0-99/reference/operations-and-tasks.md): Global functions and the $ object of operations and tasks, plus commands, extensions and PROMISIFY(). - [Utilities](https://totaljs.es/docs/total-js-v4/0-0-99/reference/utilities.md): The functions of U (utils.js) and the global helpers and objects of the framework. - [Prototypes](https://totaljs.es/docs/total-js-v4/0-0-99/reference/prototypes.md): Methods of String, Number, Date and Array added by Total.js 4. - [FlowStream](https://totaljs.es/docs/total-js-v4/0-0-99/reference/flowstream.md): The Flow module, FlowStream instances, component definitions, component instances and messages. - [QueryBuilder](https://totaljs.es/docs/total-js-v4/0-0-99/reference/querybuilder.md): DATA, DB(), NEWDB() and every method of the SQL QueryBuilder. - [JSON schemas](https://totaljs.es/docs/total-js-v4/0-0-99/reference/json-schemas.md): JSONSCHEMA(), NEWJSONSCHEMA(), String.toJSONSchema(), the jsonschemas/ directory and the supported keywords. - [Workers, threads and cluster](https://totaljs.es/docs/total-js-v4/0-0-99/reference/workers-and-threads.md): NEWTHREAD(), NEWFORK(), NEWTHREADPOOL(), WORKER(), SHELL(), LOAD() and the cluster API. - [Message Service and APIs](https://totaljs.es/docs/total-js-v4/0-0-99/reference/message-service-and-apis.md): TMS functions, the TMS client, API(), NEWAPI(), TotalAPI() and API routes. - [Images](https://totaljs.es/docs/total-js-v4/0-0-99/reference/images.md): The global Image object, the methods of an image, and the image config keys. - [HTTP server](https://totaljs.es/docs/total-js-v4/0-0-99/reference/http-server.md): Functions for starting the server, CORS, proxies, redirects and error handling. - [Sitemap](https://totaljs.es/docs/total-js-v4/0-0-99/reference/sitemap.md): The sitemap file, SITEMAP(), the F.sitemap functions, the controller methods and @{sitemap}. - [Cache, counters and small stores](https://totaljs.es/docs/total-js-v4/0-0-99/reference/caching-and-small-stores.md): Reference of CACHE(), F.cache, FILECACHE(), PREF, MEMORIZE(), COUNTER(), INMEMORY(), TEXTDB(), BACKUP() and RESTORE(). - [Application structure](https://totaljs.es/docs/total-js-v4/0-0-99/reference/application-structure.md): Start scripts, directories, bundles, packages and global loaders. - [Testing](https://totaljs.es/docs/total-js-v4/0-0-99/reference/testing.md): TESTER(), TEST(), ACTION() and the methods of a test request. - [LDAP](https://totaljs.es/docs/total-js-v4/0-0-99/reference/ldap.md): LDAP() and its options. - [Markdown](https://totaljs.es/docs/total-js-v4/0-0-99/reference/markdown.md): String.markdown() and its options. - [HTML parser](https://totaljs.es/docs/total-js-v4/0-0-99/reference/html-parser.md): String.parseHTML(), HTMLElement and the methods of a node. - [Macros](https://totaljs.es/docs/total-js-v4/0-0-99/reference/macros.md): NEWMACRO() and the function it returns. - [CMS compiler](https://totaljs.es/docs/total-js-v4/0-0-99/reference/cms.md): CMSCOMPILER(), CMSRender and the methods of a compiled page. - [UI Builder compiler](https://totaljs.es/docs/total-js-v4/0-0-99/reference/ui-builder-compiler.md): F.uibuildercompiler(). - [Tangular](https://totaljs.es/docs/total-js-v4/0-0-99/reference/tangular.md): Tangular.render(), Tangular.compile(), Tangular.register(), Thelpers and Tangular.toArray(). - [Command line (total4)](https://totaljs.es/docs/total-js-v4/0-0-99/reference/command-line.md): Every command of the total4 command-line tool. ## Changelog - [0.0.99](https://totaljs.es/docs/total-js-v4/0-0-99/changelog/0-0-99.md): What changed in release 0.0.99 (2025-03-01). - [0.0.98](https://totaljs.es/docs/total-js-v4/0-0-99/changelog/0-0-98.md): What changed in release 0.0.98 (2025-01-13). - [0.0.97](https://totaljs.es/docs/total-js-v4/0-0-99/changelog/0-0-97.md): What changed in release 0.0.97 (2024-07-30). - [0.0.96](https://totaljs.es/docs/total-js-v4/0-0-99/changelog/0-0-96.md): What changed in release 0.0.96 (2024-05-03). - [0.0.95](https://totaljs.es/docs/total-js-v4/0-0-99/changelog/0-0-95.md): What changed in release 0.0.95 (2024-02-08).