Start using ModularBr to implement modular architecture in your projects.

Inspirations behind ModularBr

ModularBr, like Flutter Modular, was inspired by the NgModule feature of Angular, which is a way to organize and modularize an Angular application. Flutter Modular, in turn, adapted this concept to the Flutter environment, creating a state and route management framework that has become very popular in the Flutter community. ModularBr was created as an alternative for the Delphi environment, bringing many of the benefits and concepts of Flutter Modular to the Delphi world. With ModularBr, developers can create scalable and well-organized applications, making code maintenance and evolution easier. InjectorBr is one of the main tools of ModularBr, allowing for simple and efficient dependency injection, as well as enabling the creation of modules that can be easily reused in other parts of the application.

Start a project

To start using ModularBr, the first step is to initialize the application with the command ModularApp.Init(TAppModule.Create), where AppModule is the main module of your application and serves as the entry point.

The AppModule is the entry point for ModularBr and is responsible for defining global routes and dependency injections for the entire lifespan of the application. In order for the AppModule to have access to the necessary methods to define these configurations, it needs to inherit from the TModule class.

An example structure of the AppModule can be seen below:

unit app.module;



  TAppModule = class(TModule)
    function Routes: TRoutes; override;
    function Binds: TBinds; override;


{ TAppModule }

function TAppModule.Binds: TBinds;
  // Dependency Injection
  Result := [];

function TAppModule.Routes: TRoutes;
  // Routes
  Result := [RouteModule('/nfe/:id', TNFeModule)];


This is just a basic example, but the structure can be adapted according to the application's needs.

Last updated