Mantra is a framework based on Node.js to develop scalable and progressive projects with highly decoupled components following lean methodology with fast and high evolution.
Mantra is the core for building platforms, startups applications, enterprise systems or, virtually, any other kind of projects.
Mantra has been designed to develop high performance applications to be deployed in any scenario.
A Mantra project follows some design and software architecture principles defined in Mantra Paradigm Development Principles. With them, technical debt is minimized and testeability of components are extremely high.
Also, by its nature, the assets of a Mantra project are very well organized with separation of concerns and the code for common tasks tends to be minimal.
Install Mantra
mantrad is the command line interface (cli) to manage Mantra applications. Install it with:
Clone current version and install globally with:
$ git clone -b v1.3.0 https://github.com/mantrajsframework/mantrad
$ cd mantrad
$ sudo npm install . -g
$ sudo npm rebuild
Check current version with:
$ mantrad version
Mantra "Hello World"
Run your first Mantra project with Mantra Hello World sample step by step.
What it is?
Mantra is a Node.js framework for lean, scalable and high performance projects, based on small and highly decoupled components.
A Mantra application is based on multiple components that interact between them using a global interaction layer (Mantra API).
Each component exposes assets (APIs, posts and gets controllers, data models, views, blocks, middlewares, cron jobs, commands, prerequests, access conditions, etc.). Mantra is in charge of the decoupled interaction between all of them. Any component can define any other asset with new functionality.
The framework intends to define simple components with very specific functionality, following S.O.L.I.D. and Dependency Injection principles, with extremely simple data models, easy updates, multiapplications within the same project and extremely well organized projects.
Mantra depends on:
- RedEntities as object mapper for data repositories, another project of Mantra.
- Express as core web server.
- Mustache template redering mecanism for views.
Mantra works and has been tested in Linux environments with Node.js 12.x, 13.x, 14.x, 15.x, 16.x, 17.x and 18.x.
Currently, MySql, MariaDB, PostgreSql, Sqlite and Aurora databases are supported. Future versions will support more data providers and rendering engines.
What kind of applications can be built with Mantra?
You can use Mantra for building many different kinds of applications:
- Scalable and high performance web applications.
- Multisite web applications (multiple sites using same set of components).
- Command line interface applications.
- Applications with no UI to run any kind of tasks.
- Microservices applications.
- Standalone applications with specific purposes.
- A mix of all above in the same project.
In the same Mantra project can live together all applications needed to run it: main UI, operation UI, maintenance apps, task scheduler, etc.
Mantra application samples, components and projects
In adition to the documentation, the best way to learn how to write Mantra projects is reading samples.
You can find multiple samples at Mantra Demos repository or listed at Mantra site demos section.
Also, you can download for free many official components and projects ready to use from Mantra site.
Documentation and how-tos
Learn to build Mantra projects with this documentation and read how-to guides published continuosly at Manta site how-to section.
You can also read this documentation at Mantra site.
- 01 Mantra Development Paradigm
- 02 Mantra Hello World
- 03 Anatomy Of A Mantra Project
- 04 Component Assets
- 05 Mantra Component Definition
- 06 Component Hooks Registering
- 07 Component Views
- 08 Component Blocks
- 09 Component Apis
- 10 Component Gets
- 11 Component Posts
- 12 Component Cron
- 13 Component Middlewares
- 14 Component Access Conditions
- 15 Component Prerequests
- 16 Component Extend
- 17 Component Commands
- 18 Component Configuration
- 19 Component Events Subscription
- 20 Component Entity Model
- 21 Mantra Data Access Layer
- 22 Installing And Uninstalling Components
- 23 Component Updating
- 24 Adapting Root Html Document To Mantra
- 25 Mantra Services
- 26 Html Templates
- 27 Mantra Bootstrap Process
- 28 Mantra Core Commands
- 29 Mantra Core Components
- 30 Mantra Core Events
- 31 Mantra Logger
- 32 InstanceId
- 33 Mantra API Reference
- 34 Mantra Utils Reference
- 35 AssetsLocations Reference
- 36 mantraconfig.json File
- 37 mantracoreapi.js File Reference
- 38 Mantra Console API reference
- 39 Updating Components Data Models
- 40 Injections
- 41 Next Steps