Fractl unlocks the future of tri-modal development - concurrent use of 3 different ways of programming:
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:
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.
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:
POST /_e/Accounts.Core/Company/acme/CompanyAccounts/AccountHead
{"Accounts.Core/AccountHead": {"Name": "Department01"}}
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"}}
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.
Copyright 2022 Fractl Inc.
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
Can you improve this documentation? These fine people already did:
Pratik Karki, Ranga Rao, Vijay Mathew, vijayfractl, vmatv8, Puneet Pahuja, muazzam0x48 & fractlraoEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close