Bold for Delphi - Quick Start Guide ๐
February 21, 2026 ยท View on GitHub
Get your first Bold application running in 15 minutes! โฑ๏ธ
What is Bold? ๐ก
Bold for Delphi is a Model-Driven Architecture (MDA) framework that:
- Lets you define your domain model in UML
- Auto-generates strongly-typed Delphi classes from your model
- Handles object-relational mapping (ORM) to any database
- Provides OCL (Object Constraint Language) for queries
- Includes data-aware VCL components with automatic UI updates
The core idea: You work with objects, Bold handles the database.
UML Model โ Code Generator โ Business Classes โ Bold Runtime โ Database
Prerequisites โ
- Delphi 11.3, 12.1 CE, 12.3, or 13
- Database: The following FireDAC-supported databases should work. SQLite, SQL Server, PostgreSQL, Firebird, MariaDB/MySQL and Oracle. SQLite requires no installation.
- Bold packages installed (see Installation below)
Installation ๐ฆ
Step 1: Get the Source
git clone https://github.com/bero/BoldForDelphi.git
Or download and extract to a folder like C:\BoldForDelphi.
Step 2: Get the Packages
Option A: Download Pre-built Binaries (Recommended)
Download the binary package for your Delphi version from: https://github.com/bero/BoldForDelphi/releases/
Extract to packages\Bin\.
Add the new package from menu Component/Install packages...
Then press Add and select your bpl-file
Option B: Build from Source ๐ง
Compiling from source gives you the latest version, or lets you use Bold with unsupported Delphi versions.
Open the package project for your Delphi version in the IDE:
| Delphi Version | Open this file |
|---|---|
| Delphi 11.3 Alexandria | packages\Delphi11.3\dclBold.dproj |
| Delphi 12.1 CE Athens | packages\Delphi12.1_CE\dclBold.dproj |
| Delphi 12.3 Athens | packages\Delphi12.3\dclBold.dproj |
| Delphi 13 Athens | packages\Delphi13\dclBold.dproj |
Then:
- File โ Open Project and select the
.dprojfrom the table above - Project โ Build (or Shift+F9) to compile the package
- In the Project Manager panel, right-click the
.bpland choose Install - Verify via menu Component โ Install Packages... โ you should see "Bold for Delphi" in the list
The compiled BPL is output to packages\Bin\.
You should now see Bold components in the Tool Palette. ๐
Using an unsupported Delphi version:
If your Delphi version is not listed above:
- Copy the folder of the closest supported version (e.g., copy
Delphi13for Delphi 14) - Rename the folder to match your Delphi version (e.g.,
Delphi14) - Open
dclBold.dprojin the IDE - Go to Project โ Options โ Description and update the Lib Suffix to match your compiler version
- Build and install as described above
- If it works, consider submitting a pull request to include the new package folder
Your First Bold Application ๐๏ธ
First option is to look at a ready-made small app:
examples\Simple\ObjectSpace\MasterDetail\MasterDetail.dproj
Important: This example uses design-time Bold components, so you must install the Bold package first (Step 2 above). Then open and compile MasterDetail. It defaults to SQLite โ no database server needed, just press F9.
Second option is to build app from scratch. More fun and more learning ๐ We'll build a simple app with Person and Building objects, where persons can own buildings.
Step 1: Create a New VCL Application
- File โ New โ VCL Forms Application
- Save the project (e.g.
Building.dproj)
Step 2: Add a Data Module
- File โ New โ Other โ Delphi Files โ Data Module
- Save as
DataModule1.pas
Step 3: Add Core Bold Components
Drop these components on your DataModule from the Bold palette:
| Component | Purpose |
|---|---|
TBoldModel | Holds your UML model |
TBoldSystemHandle | Main runtime system |
TBoldSystemTypeInfoHandle | Type information for design-time |
TBoldPersistenceHandleDB | Database persistence |
Connect them:
BoldSystemHandle1.BoldModelโBoldModel1BoldSystemHandle1.PersistenceHandleโBoldPersistenceHandleDB1BoldSystemTypeInfoHandle1.BoldModelโBoldModel1
Step 4: Add Database Connection
-
Drop a
TFDConnection(FireDAC) on the DataModule -
Configure it for your database. SQLite is the easiest to start with โ no server needed:
[Database] Persistence=FireDAC Type=SQLite [SQLite] Database=BoldDemo.dbThe database file is created automatically on first run.
Other database configurations (SQL Server, PostgreSQL, Firebird, MariaDB, Oracle)
For SQL Server:
[Database] Persistence=FireDAC Type=MSSQL [MSSQL] Server=localhost Database=BoldDemo OSAuthent=True User=sa Password=For PostgreSQL:
[Database] Persistence=FireDAC Type=PostgreSQL [PostgreSQL] Server=localhost Database=bolddemo VendorLib=C:\Program Files\PostgreSQL\18\bin\libpq.dll User=postgres Password=<your_password>For Firebird:
[Database] Persistence=FireDAC Type=Firebird [Firebird] Server=localhost Database=C:\Data\BoldDemo.fdb VendorLib=C:\Program Files\Firebird\Firebird_5_0\fbclient.dll User=SYSDBA Password=<your_password>For MariaDB (or MySQL):
[Database] Persistence=FireDAC Type=MariaDB [MariaDB] Server=localhost Port=3306 Database=bolddemo User=root Password=<your_password> VendorLib=C:\Program Files\MariaDB\MariaDB Connector C 64-bit\lib\libmariadb.dllNote: MariaDB requires the MariaDB Connector/C client library. Download from https://mariadb.com/downloads/connectors/ (Connector/C, Windows 64-bit). For MySQL, point VendorLib to
libmysql.dllinstead.For Oracle:
[Database] Persistence=FireDAC Type=Oracle [Oracle] Database=//localhost:1521/XEPDB1 User=bolduser Password=<your_password> VendorLib=C:\oracle\instantclient_23_7\oci.dllNote: Oracle requires the Oracle Instant Client. The
Databaseparameter uses Easy Connect format://host:port/service_name. -
Drop a
TBoldDatabaseAdapterFireDACcomponent -
Set
BoldDatabaseAdapterFireDAC1.ConnectionโFDConnection1 -
Set
BoldPersistenceHandleDB1.DatabaseAdapterโBoldDatabaseAdapterFireDAC1
Step 5: Create Your Model
- Double-click
BoldModel1to open the Model Editor - Create your classes:
Person class:
- Right-click โ Add Class โ Name:
Person - Add attributes:
FirstName: StringLastName: StringAssets: Currency
Building class:
- Add Class โ Name:
Building - Add attributes:
Address: StringZipCode: Integer
Create an association (Ownership):
- Select both classes
- Right-click โ Add Association
- Name:
Ownership - Person side:
OwnedBuildings(0..*) - Building side:
Owners(0..*)
- File โ Save & Generate all files
This creates BusinessClasses.pas with strongly-typed classes.
Step 6: Add Business Classes to Project
- Add the generated
BusinessClasses.pasto your project - Add to DataModule uses clause:
uses BusinessClasses;
Step 7: Design the Main Form
On your main form, add:
List Handles (from Bold Handles palette):
-
TBoldListHandlenamedblhAllPersonsRootHandleโDataModule1.BoldSystemHandle1ExpressionโPerson.allInstances
-
TBoldListHandlenamedblhAllBuildingsRootHandleโDataModule1.BoldSystemHandle1ExpressionโBuilding.allInstances
GUI Components (from Bold Controls palette):
TBoldGridfor persons โBoldHandle=blhAllPersonsTBoldGridfor buildings โBoldHandle=blhAllBuildingsTBoldNavigatorโBoldHandle=blhAllPersons
Actions (from Bold Actions palette):
TBoldActivateSystemActionโ Opens the databaseTBoldUpdateDBActionโ Saves changes to database- Add buttons linked to these actions
Step 8: Initialize the System
In your main form's OnCreate:
procedure TForm1.FormCreate(Sender: TObject);
begin
// Activate opens/creates the database and loads the model
BoldActivateSystemAction1.Execute;
end;
Step 9: Run It! โถ๏ธ
- Press F9 to run
- Click "Open System" to activate
- Use the navigator to add Person records
- The grid automatically displays them
- Click "Update DB" to save
That's it! You have a working Bold application. โ
Working with Objects in Code ๐ป
Bold generates clean, strongly-typed classes. Here's how to use them:
Creating Objects
var
Person: TPerson;
Building: TBuilding;
begin
// Create objects - Bold tracks them automatically
Person := TPerson.Create(BoldSystemHandle1.System);
Person.FirstName := 'John';
Person.LastName := 'Doe';
Person.Assets := 50000;
Building := TBuilding.Create(BoldSystemHandle1.System);
Building.Address := '123 Main Street';
Building.ZipCode := 12345;
// Create relationship
Person.OwnedBuildings.Add(Building);
end;
Querying with OCL
var
RichPeople: TBoldObjectList;
begin
// Find all persons with assets > 100000
RichPeople := BoldSystemHandle1.System.EvaluateExpressionAsNewElement(
'Person.allInstances->select(assets > 100000)'
) as TBoldObjectList;
// Use type-safe access
for var i := 0 to RichPeople.Count - 1 do
ShowMessage(TPerson(RichPeople[i]).FirstName);
end;
Saving to Database
// Save all changes
BoldSystemHandle1.UpdateDatabase;
// Or discard changes
BoldSystemHandle1.System.Discard;
Key Concepts ๐
| Concept | Description |
|---|---|
| BoldSystem | The runtime container for all your objects |
| Handles | Connect UI components to objects (TBoldListHandle, TBoldExpressionHandle) |
| OCL Expressions | Query language: Person.allInstances->select(age > 30) |
| Subscription | UI auto-updates when objects change |
| M_ properties | Direct access to Bold members: Person.M_FirstName.AsString |
Common OCL Expressions ๐
Person.allInstances -- All persons
Person.allInstances->size -- Count of persons
Person.allInstances->select(assets > 0) -- Filter
Person.allInstances->collect(lastName) -- Extract attribute
Person.allInstances->sortedBy(lastName) -- Sort
self.ownedBuildings->size -- Count related objects
self.firstName + ' ' + self.lastName -- Concatenation
Next Steps ๐ถ
- Explore the Examples: See
examples/Compound/Building/for a more complex sample (note: this is a legacy Delphi 7 project โ use it as a code reference, not as a compilable project) - Read the Tutorials: Check
Doc/Starting Bfd - Part 1, 2, 3.pdf - Learn OCL: See
Doc/ad970808_UML11_OCL.pdffor the OCL specification - Try Derived Attributes: Computed values that auto-update
- Add Constraints: Validate your model with OCL constraints
Troubleshooting ๐ง
"Bold.inc not found"
- Add
Source\Common\Includeto your project's search path
Components not showing in palette
- Verify the BPL is installed (Component โ Install Packages)
- Check that all dependent packages are loaded in menu Component/Install packages...
Database errors on first run
- Use
TBoldCreateDatabaseActionto create the schema first - Or call
BoldPersistenceHandleDB1.CreateDataBaseSchema
PostgreSQL: "libpq.dll not found" or connection fails
- Copy
libpq.dlland its dependencies to your executable folder (see Step 4) - The DLLs are in your PostgreSQL installation's
binfolder
Firebird: "fbclient.dll not found" or connection fails
- Copy
fbclient.dllto your executable folder (see Step 4) - The DLL is in your Firebird installation folder
MariaDB/MySQL: "libmysql.dll not found" or connection fails
- MariaDB Server does not include the client library - you need MariaDB Connector/C
- Download from https://mariadb.com/downloads/connectors/ (Connector/C, Windows 64-bit)
- Set VendorLib in your INI to point to
libmariadb.dll - For MySQL, point VendorLib to
libmysql.dllin your MySQL installation
Oracle: "oci.dll not found" or connection fails
- Download Oracle Instant Client from https://www.oracle.com/database/technologies/instant-client/downloads.html
- Extract to a folder (e.g.,
C:\oracle\instantclient_23_7) - Set VendorLib in your INI to point to
oci.dllin that folder - The Database parameter uses Easy Connect format:
//host:port/service_name
Oracle: ORA-01400 "cannot insert NULL" errors
- This can occur if your database schema was created with an older Bold version
- Use the "Reset Oracle Schema" option in the demo app to recreate tables
- Or manually drop all tables and let Bold recreate them
SQLite: Database file not created
- SQLite creates the database file automatically on first connection
- Check that the path in the INI file is writable
- The file will be created in the same folder as the executable if no path is specified
Resources ๐
- Git Embarcadero original repo: https://github.com/Embarcadero/BoldForDelphi
- Git active development: https://github.com/bero/BoldForDelphi/tree/develop
- Wiki: https://delphi.fandom.com/wiki/Bold_for_Delphi
- Discord: https://discord.gg/C6frzsn
- Blog: http://boldfordelphi.blogspot.com/
Bold for Delphi - Model-Driven Development for Delphi since 2004