dmvcframeworktheofficialguideexamples
Companion code for "DelphiMVCFramework - The Official Guide, Second Edition" by Daniele Teti. One folder per chapter, verified against DMVCFramework 3.5.0-silicon. First edition examples are at the first-edition tag.
- Active · last change 8-23-2026
- ★ 14 on GitHub
README
DelphiMVCFramework - The Official Guide: example projects
The companion code for DelphiMVCFramework - The Official Guide, Second Edition, by Daniele Teti. One folder per chapter. The book explains what these projects do and why they are built this way; this repository is the code itself, ready to compile.
Looking for the first edition? Its examples are frozen at the
first-editiontag. They are not maintained and several of them no longer compile against DMVCFramework 3.5.0.
Requirements
- Delphi 10.2 Tokyo or later. Everything here is built and verified on Delphi 13 Florence, Win32.
- DelphiMVCFramework 3.5.0-silicon or later.
- PostgreSQL, for the chapters that use the Municipal Library database.
Some chapters need extra libraries:
| Needed for | What |
|---|---|
| HTTPS (ch. 23) and asymmetric JWT (ch. 12) | TaurusTLS, plus the OpenSSL 3 runtime (libcrypto-3.dll, libssl-3.dll) next to the executable |
| OpenID Connect (ch. 13) | an OpenID provider; the project is verified against Keycloak |
Building
Add the framework to the library path, or pass it to msbuild:
msbuild <Project>.dproj /t:Build /p:Config=Debug /p:Platform=Win32 ^
/p:DMVC="C:\DEV\dmvcframework\sources;C:\DEV\dmvcframework\lib\loggerpro;C:\DEV\dmvcframework\lib\dmustache;C:\DEV\dmvcframework\lib\swagdoc"loggerpro, dmustache and swagdoc are vendored inside the framework, so
there is nothing extra to fetch for them. Append
C:\DLib\indy_extras\TaurusTLS\Source to that list for the TLS chapters. build_examples.bat builds everything at once.
Database
Chapters 6 onwards share one PostgreSQL database, municipal_library.
createdb municipal_library
psql -d municipal_library -f CODE_CHAPTER_06/create_schema_postgresql.sql
psql -d municipal_library -f CODE_CHAPTER_06/seed_data.sqlConnection settings come from dotEnv and default to localhost, user
postgres. Override them with a .env file next to the executable, not
next to the project file: the bootstrap resolves it from the application path.
Ports
Each server listens on its own port so several can run at once. Override with
dmvc.server.port in .env.
| Folder | Project | Port |
|---|---|---|
| CODE_CHAPTER_01 | GettingStarted | 8080 |
| CODE_CHAPTER_02 | Ch02RoutingDemo | 8082 |
| CODE_CHAPTER_03 | Ch03FunctionalActionsDemo | 8083 |
| CODE_CHAPTER_04 | Ch04RenderDemo | 8084 |
| CODE_CHAPTER_05 | Ch05ValidationDemo | 8085 |
| CODE_CHAPTER_06 | schema and seed only | |
| CODE_CHAPTER_08 | Ch08DatasetsDemo | 8088 |
| CODE_CHAPTER_09 | Ch09ActiveRecordDemo | 8089 |
| CODE_CHAPTER_10 | Ch10LibraryAPI | 8090 |
| CODE_CHAPTER_11 | Ch11ActiveRecordDepth | 8091 |
| CODE_CHAPTER_12 | Ch12AuthDemo | 8101 |
| CODE_CHAPTER_13 | Ch13OIDCDemo | 8112 |
| CODE_CHAPTER_14 | Ch14MiddlewareDemo | 8102 |
| CODE_CHAPTER_15 | Ch15LibraryAuth | 8103 |
| CODE_CHAPTER_16 | Ch16JsonRpcClient | 8104 |
| CODE_CHAPTER_17 | Ch17SwaggerDemo | 8105 |
| CODE_CHAPTER_18 | TemplateProSite | 8916 |
| CODE_CHAPTER_19 | HtmxTodo | 8917 |
| CODE_CHAPTER_20 | WebSocket server and client | 8918 |
| CODE_CHAPTER_21 | InjectionDemo | 8019 |
| CODE_CHAPTER_22 | RepositoryDemo | 8020 |
| CODE_CHAPTER_23 | one project per server engine | |
| CODE_CHAPTER_24 | LoggingDemo | 8122 |
| CODE_CHAPTER_25 | DeployDemo | 8123 |
| CODE_CHAPTER_26 | Hidden Gems samples | |
| CODE_CHAPTER_27 | RESTful client demo and tests | |
| CODE_CHAPTER_28 | Tips and Tricks samples | |
| CODE_CHAPTER_29 | Ch29MinimalAPI | 8027 |
Chapter 7 has no project of its own: it designs the API that chapters 8 and 10 implement.
Licence
Apache-2.0. See LICENSE. Use this code in your own projects freely.
The book
DelphiMVCFramework - The Official Guide, Second Edition, by Daniele Teti. The framework itself lives at https://github.com/danieleteti/delphimvcframeworkk

