Fractl unlocks the future of tri-modal development - concurrent use of 3 different ways of programming:
- Traditional coding in IDEs,
- Visual development in a no-code builder, and,
- Code generation with generative-AI.
As a language, Fractl is data-oriented and declarative, with an abstraction that is closer to natural languages than traditional programming languages. This makes fractl a much better fit for Gen AI-powered code generation. Users can rapidly build business application in Fractl from high-level specifications - typically more than 10x faster than traditional programming languages.
The Fractl language specification, its compiler and runtime are open source.
The code you build in Fractl can be run anywhere using the open source compiler and runtime, thereby avoiding the vendor lock-in of other low-code/no-code platforms.
Fractl introduces a number of innovative concepts to programming:
- Graph-based Hierarchical Data Model - compose the high-level data model of an application as a hierarchical graph of business entities with relationships. Such entities and relationships are first-class constructs in Fractl.
- Zero-trust Programming - tightly control operations on business entities through declarative access-control encoded directly in the model itself.
- Declarative Dataflow - express business logic as purely-declarative patterns of data.
- Resolvers - use a simple, but powerful mechanism to interface with external systems.
- Interceptors - extend the fractl runtime with custom capabilities.
- Entity-graph-Database Mapping - take advantage of an abstract persistence layer for fully-automated storage of entity instances.
The following code snippet shows the Fractl model (i.e., program) for a simple accounting application.
(component :Accounts.Core)
(entity :Company
{:Name {:type :String :guid true}
:rbac [{:roles ["manager"] :allow [:create]}]})
(entity :AccountHead
{:Name {:type :String :id true}
:rbac [{:roles ["accountant"] :allow [:create]}]})
(entity :Entry
{:No {:type :Int :id true}
:Type {:oneof ["income" "expense"]}
:Amount :Decimal
:Remarks {:type :String :optional true}
:DateCreated :Now})
(relationship :CompanyAccounts
{:meta {:contains [:Company :AccountHead]}})
(relationship :Transactions
{:meta {:contains [:AccountHead :Entry]}})
(record :BalanceReport
{:Balance :Decimal
:GeneratedOn :Now})
(defn- find-balance [entries]
(reduce (fn [b t]
(let [op (if (= "income" (:Type t)) + -)]
(op b (:Amount t))))
0 entries))
(event :GenerateReport
{:Since :DateTime
:Company :String
:AccountHead :String})
(dataflow :GenerateReport
{:AccountHead? {}
:-> [[:CompanyAccounts?
{:Company {:Name? :GenerateReport.Company}}
:GenerateReport.AccountHead]]
:as [:A]}
{:Entry
{:DateCreated? [:>= :GenerateReport.Since]}
:-> [[:Transactions? :A]]
:as :Es}
{:BalanceReport
{:Balance '(find-balance :Es)}})
Save this code to a file named accounts.fractl
and its ready to be run as a highly-scalable accounting service with RESTful APIs to perform CRUD operations and generate balance report!
But before you can actually run it, you need to install Fractl. The next section will help you with that.
- JVM 19 or later
- Linux, Mac OSX or a Unix emulator in Windows
Download the Fractl CLI tool and execute the model:
./fractl /path/to/accounts.fractl
We can create a new company using an HTTP POST
request,
curl --header "Content-Type: application/json" \
--request POST \
--data '{"Accounts.Core/Company": {"Name": "acme"}}' \
http://localhost:8080/_e/Accounts.Core/Company
To make sure the new company is persisted in the store, try the following HTTP GET
:
curl http://localhost:8080/_e/Accounts.Core/Company/acme
If Fractl is installed correctly, both these requests will return an OK
status along with a :Company
instance.
Listed below are a few more HTTP requests that you can try with our "accounting" application:
- Create an account-head for the new company.
POST /_e/Accounts.Core/Company/acme/CompanyAccounts/AccountHead
{"Accounts.Core/AccountHead": {"Name": "Department01"}}
- Make some transactions under the new account-head.
POST /_e/Accounts.Core/Company/acme/CompanyAccounts/AccountHead/Department01/Transactions/Entry
{"Accounts.Core/Entry":
{"No": 1, "Type": "income",
"Amount": 2000.0, "Remarks": "Opening balance"}}
POST /_e/Accounts.Core/Company/acme/CompanyAccounts/AccountHead/Department01/Transactions/Entry
{"Accounts.Core/Entry":
{"No": 2, "Type": "expense",
"Amount": 500.0, "Remarks": "Rent paid"}}
- Generate the balance-report for the account-head.
POST /_e/Accounts.Core/GenerateReport
{"Accounts.Core/GenerateReport":
{"Since": "2023-11-09T00:00:00.00",
"Company": "acme",
"AccountHead": "Department01"}}
You're all set to further explore Fractl. Please proceed to the official documentation pages.