Become a member!

DMVCFramework — Delphi REST API, JSON-RPC & Web App Framework

🌐
This article is also available in other languages:
🇮🇹 Italiano  •  🇪🇸 Español  •  🇩🇪 Deutsch

The #1 most popular open-source Delphi framework on GitHub · Production-ready since 2010

TL;DR: DMVCFramework is the #1 Delphi framework for building REST APIs and web services. It’s free (Apache 2.0), production-ready since 2010, supports JWT, WebSocket, ORM, and works on Windows/Linux. Install from GitHub, create a controller with [MVCPath] attributes, and return objects that auto-serialize to JSON.

What is DMVCFramework?

DMVCFramework (DelphiMVCFramework) is the most popular open-source framework for building web APIs and web applications in Delphi. It enables you to create RESTful services (RMM Level 3), JSON-RPC services, server-side web pages, mobile backends, and microservices with ease.

Used in production since 2010, DMVCFramework powers some of the highest-traffic Delphi web APIs in the world. It’s the #1 Delphi project on GitHub by star rating, with a vibrant community of 5,000+ active developers.

DMVCFramework Logo

GitHub starsGitHub last commitLicense
⬇️ Download Latest Release ⭐ GitHub (1.3k+ stars)

Get Started: The Official Guide

DMVCFramework - The Official Guide, second edition, by Daniele Teti

The fastest way to learn DMVCFramework is the official guide, written by the person who maintains the framework. The second edition is written on dmvcframework-3.5.0-silicon: 30 chapters, more than 550 pages and 46 sample projects that compile, building one API from the project the wizard generates up to a server behind TLS.

It is out on Leanpub at 90%, minimum price 45 USD, and updates are free forever.

Available Editions

EditionLanguageFormatLink
2nd, 3.5.0-siliconEnglisheBookBuy on Leanpub
1st, 3.2.1-carbonEnglisheBookBuy on Leanpub
1st, 3.2.1-carbonEnglishHardcoverBuy on Lulu
1st, 3.2.1-carbonPortuguese (BR)eBookBuy on Leanpub
1st, 3.2.1-carbonSpanisheBookBuy on Leanpub

The second edition is English only for now, so the first edition stays the one to buy in Portuguese or Spanish, and the only one in print until the new one reaches Lulu.

Read a free sample of the second edition, or see the full table of contents.


Why Choose DMVCFramework?

BenefitDescription
Proven in ProductionUsed since 2010 in small, medium, and enterprise projects worldwide
Complete Feature SetREST, JSON-RPC, JWT, WebSocket, SSE, ORM - everything you need
Blazing FastOptimized for high performance under heavy workloads
Easy to LearnIntuitive API with 50+ samples to get you productive quickly
Active Community6,000+ developers in the Facebook group ready to help
Actively MaintainedRegular updates, semantic versioning, future-proof

What Developers Say

“DMVCFramework is a great framework. It’s very intuitive, fast, easy to use, actually there is nothing more to ask for.”

— Samir

“I’m still amazed by the DelphiMVCFramework code and documentation. Thank you very much and I am amazed by your quick feedback.”

— Benjamin Y., Director of SQLGate

“We started the process of migrating our systems to micro services and are loving the DMVCFramework.”

— E. Costa


What’s New in DMVCFramework 3.4.3-aluminium

The latest release brings major new features:

WebSocket Support

Full-duplex real-time communication with TMVCWebSocketServer and TMVCWebSocketClient. Build chat applications, live dashboards, and collaborative tools with channel-based messaging and groups.

Rate Limiting Middleware

Protect your APIs from abuse with built-in rate limiting - both in-memory for single servers and Redis-backed for distributed environments.

Repository Pattern

Clean architecture with IMVCRepository<T> and [MVCInject] for automatic dependency injection.

Expression Support in dotEnv

Dynamic expressions in .env configuration files with variable substitution and arithmetic.

See full What’s New for 3.4.3-aluminium →


Version History

VersionDateHighlights
3.4.3-aluminiumJan 2026WebSocket, Rate Limiting, Repository Pattern, Delphi 13
3.4.2-magnesiumFeb 2024Middleware Sessions, Database Sessions
3.4.1-sodiumJan 2024Sempare Templates, Delphi 12, foVersion
3.4.0-neonSep 2023Functional Actions, Named Queries, HTMX
3.3.0-fluorineApr 2023Delphi 11.3, Prometheus, Records in Swagger
3.2.3-radiumFeb 2022Built-in Profiler, JSONRPC TObject
3.2.2-nitrogenSep 2020Delphi 11, TMVCRESTClient, LRU Cache
3.2.1-carbonNov 2019Official Guide Reference, snake_case
3.2.0-boronJul 2019Delphi 10.4, Swagger, Nullable Types
3.1.0-lithiumMar 2019Enhanced Middleware
3.0.0-hydrogen2018MVCActiveRecord ORM, 3.x Architecture
2.x2015-2017Foundation Series

Key Features

Web API Development

  • RESTful APIs - Full RMM Level 3 compliance with proper HTTP verbs and status codes
  • JSON-RPC 2.0 - Automatic object remoting for RPC-style APIs
  • OpenAPI Support - Automatic API documentation generation
  • Automatic Routing - Attribute-based URL mapping with parameter binding

Authentication & Security

  • JWT Authentication - Industry-standard JSON Web Tokens
  • HTTP Basic Authentication - Simple username/password auth
  • Custom Authentication - Flexible framework for any auth scheme
  • CORS Support - Cross-origin resource sharing configuration

Real-Time Communication

  • WebSocket Support - Full-duplex communication channels
  • Server-Sent Events (SSE) - Push notifications to clients
  • Messaging Extensions - Built-in pub/sub patterns

Data & Persistence

  • MVCActiveRecord - Powerful ORM for database operations
  • JSON Serialization - Automatic object-to-JSON mapping
  • Custom Serializers - Full control over data transformation

Deployment Flexibility

  • Windows Console Application
  • Windows Service
  • Linux Console/Daemon
  • Apache Module (mod_proxy)
  • IIS (ISAPI DLL)
  • Load-balanced environments

Developer Experience

  • IDE Wizard - Project templates for quick start
  • 50+ Samples - Learn every feature with working examples
  • Middleware System - Easy request/response hooks
  • Controller Inheritance - DRY principle for common logic
  • Integrated REST Client - Test and consume APIs easily

Quick Start: Hello World

Get started with DMVCFramework in minutes. Here’s a simple “Hello World” controller:

uses
  MVCFramework, MVCFramework.Commons;

type
  [MVCPath('/api')]  // Base path for all actions in this controller
  TMyController = class(TMVCController)
  public
    [MVCPath('/hello')]           // Route: GET /api/hello
    [MVCHTTPMethods([httpGET])]   // Allowed HTTP method
    function GetHello: String;

    [MVCPath('/hello/($Name)')]   // Route: GET /api/hello/{Name}
    [MVCHTTPMethods([httpGET])]   // ($Name) captures the URL segment
    function GetHelloName(const Name: String): String;
  end;

implementation

function TMyController.GetHello: String;
begin
  Result := 'Hello, World!';  // Automatically serialized to JSON
end;

function TMyController.GetHelloName(const Name: String): String;
begin
  Result := 'Hello, ' + Name + '!';  // Name is automatically extracted from URL
end;

That’s it! Call GET /api/hello and you get "Hello, World!". Call GET /api/hello/John and you get "Hello, John!".

DMVCFramework automatically serializes your return values to JSON - strings, objects, arrays, records, datasets - everything just works.


Advanced Example: REST API with Database

For real-world applications, DMVCFramework supports MVCActiveRecord ORM and the Repository pattern with dependency injection:

uses
  MVCFramework, MVCFramework.Commons, MVCFramework.ActiveRecord,
  MVCFramework.Repository, System.Generics.Collections;

type
  // Entity class mapped to database table
  [MVCTable('customers')]
  TCustomer = class(TMVCActiveRecord)
  private
    [MVCTableField('id', [foPrimaryKey, foAutoGenerated])]  // Auto-increment PK
    FID: NullableInt32;
    [MVCTableField('name')]    // Maps to 'name' column
    FName: string;
    [MVCTableField('email')]   // Maps to 'email' column
    FEmail: string;
  public
    property ID: NullableInt32 read FID write FID;
    property Name: string read FName write FName;
    property Email: string read FEmail write FEmail;
  end;

  [MVCPath('/api/customers')]
  TCustomerController = class(TMVCController)
  protected
    fRepository: IMVCRepository<TCustomer>;  // Repository interface
  public
    [MVCInject]  // Dependency injection - repository is automatically provided
    constructor Create(Repository: IMVCRepository<TCustomer>); reintroduce;

    [MVCPath]                     // Route: GET /api/customers
    [MVCHTTPMethods([httpGET])]
    function GetAllCustomers: IMVCResponse;

    [MVCPath('/($ID)')]           // Route: GET /api/customers/{ID}
    [MVCHTTPMethods([httpGET])]
    function GetCustomerByID(const ID: Integer): IMVCResponse;

    [MVCPath]                     // Route: POST /api/customers
    [MVCHTTPMethods([httpPOST])]  // [MVCFromBody] deserializes JSON body to TCustomer
    function CreateCustomer([MVCFromBody] const Customer: TCustomer): IMVCResponse;

    [MVCPath('/($ID)')]           // Route: DELETE /api/customers/{ID}
    [MVCHTTPMethods([httpDELETE])]
    function DeleteCustomerByID(const ID: Integer): IMVCResponse;
  end;

implementation

constructor TCustomerController.Create(Repository: IMVCRepository<TCustomer>);
begin
  inherited Create;
  fRepository := Repository;  // Store injected repository
end;

function TCustomerController.GetAllCustomers: IMVCResponse;
begin
  Result := OKResponse(fRepository.GetAll);  // Returns HTTP 200 with JSON array
end;

function TCustomerController.GetCustomerByID(const ID: Integer): IMVCResponse;
begin
  Result := OKResponse(fRepository.GetByPK(ID));  // Returns HTTP 200 with JSON object
end;

function TCustomerController.CreateCustomer(const Customer: TCustomer): IMVCResponse;
begin
  fRepository.Store(Customer);  // Insert or update based on PK
  Result := CreatedResponse('/api/customers/' + Customer.ID.Value.ToString);  // HTTP 201
end;

function TCustomerController.DeleteCustomerByID(const ID: Integer): IMVCResponse;
var
  lCustomer: TCustomer;
begin
  lCustomer := fRepository.GetByPK(ID);  // Load entity by primary key
  fRepository.Delete(lCustomer);          // Delete from database
  Result := OKResponse;                   // Returns HTTP 200
end;

Key benefits:

  • Functional actions: Return IMVCResponse using helpers like OKResponse(), CreatedResponse()
  • Dependency injection: [MVCInject] on constructor for automatic repository injection
  • MVCActiveRecord: ORM with table mapping via attributes
  • Repository pattern: IMVCRepository<T> for clean, testable data access
  • Auto-serialization: Objects, records, lists, datasets are automatically serialized

Learn by Example: 100+ Sample Projects

The best way to learn DMVCFramework is by exploring working code. The project includes over 100 sample projects covering every feature and use case. Each sample is self-contained and ready to compile.

Find the sample that matches what you need to build, open it in Delphi, and start experimenting!

📦 All samples: github.com/danieleteti/delphimvcframework/tree/master/samples


“I want to create my first DMVCFramework project”

SampleDescription
basicdemo_serverMinimal server setup - start here
functional_actions_showcaseModern functional actions pattern
console_sampleSimple console application

“I want to build a REST API”

SampleDescription
simple_api_using_mvcactiverecordREST API with ORM
simple_api_using_repository_with_injectionRepository pattern + dependency injection
simple_api_using_datasetsReturn TDataSet as JSON
routingURL parameters, path segments, query strings
validatorsBuilt-in and custom input validators
file_uploadHandle multipart/form-data uploads

“I want to add authentication and security”

SampleDescription
jsonwebtokenJSON Web Token basics
jsonwebtoken_roleauthRole-based authorization with JWT
middleware_jwtwithcookiehttponlySecure HTTP-only cookie for JWT
middleware_basicauthenticationHTTP Basic authentication
custom_authImplement your own auth handler
middleware_corsCross-Origin Resource Sharing
middleware_ratelimit_memoryThrottle requests (in-memory)
middleware_ratelimit_redisThrottle requests (Redis-backed)

“I want real-time communication”

SampleDescription
websocket_primerWebSocket introduction
websocket_chatMulti-user chat application
websocket_groupsChannel-based messaging
websocket_javascript_client_sampleBrowser client example
serversenteventsServer-Sent Events (push notifications)

“I want to render HTML pages”

SampleDescription
serversideviews_templateproHTML with TemplatePro engine
serversideviews_mustacheHTML with Mustache engine
htmxDynamic HTML with HTMX
htmx_website_with_templateproFull website with HTMX + TemplatePro
htmx_website_with_webstencilsRAD Studio WebStencils integration

“I want to work with databases”

SampleDescription
activerecord_showcaseComplete ORM demo
activerecord_restful_crudRESTful API with ActiveRecord
master_detailsParent-child relationships
repository_showcaseIMVCRepository usage
adoMicrosoft ADO example

“I want to use JSON-RPC”

SampleDescription
jsonrpcJSON-RPC 2.0 server implementation

“I want to customize request/response handling”

SampleDescription
middlewareCreate your own middleware
middleware_compressionGZIP/Deflate responses
middleware_etagHTTP caching with ETags
middleware_staticfilesServe static content
middleware_analyticsRequest logging/tracking
middleware_activerecordPer-request DB connection
action_filtersBefore/after action hooks
custom_exception_handlingCustom error responses
rendersCustom JSON serializers

“I want to deploy to production”

SampleDescription
windows_serviceRun as Windows service
apache_moduleDeploy behind Apache
isapiDeploy on IIS
ssl_serverHTTPS configuration
tls13Modern TLS 1.3 setup

“I want to document my API”

SampleDescription
swagger_primerOpenAPI documentation basics
swagger_uiInteractive API explorer
swagger_doc_extendedAdvanced documentation features

“I want advanced features”

SampleDescription
mvcasyncAsynchronous actions
outputcachewithredisRedis-backed response cache
prometheusPrometheus monitoring integration
services_injectionDependency injection
dotenv_showcaseEnvironment configuration with .env files
sqids_showcaseShort unique IDs (Sqids)


DMVCFramework integrates seamlessly with other open source projects by the same author:

ProjectDescriptionUse with DMVCFramework
LoggerProAsync logging framework with 20+ appendersAdd structured logging to your APIs with file, database, Redis, or ElasticSearch appenders
TemplateProPowerful template engine with Jinja-like syntaxServer-side HTML rendering with serversideviews_templatepro sample
DelphiRedisClientComplete Redis clientCaching, session storage, rate limiting, and real-time features
DelphiGuardRAII memory managementAutomatic resource cleanup in controllers and middleware
Delphi Fake Data UtilsTest data generatorGenerate realistic data for API testing and demos
Expression EvaluatorRuntime formula parserDynamic business rules and calculated fields in your APIs

Delphi Version Compatibility

Delphi VersionWindowsLinux
Delphi 13 Florence✅✅
Delphi 12 Athens✅✅
Delphi 11 Alexandria✅✅
Delphi 10.4 Sydney✅✅
Delphi 10.3 Rio✅✅
Delphi 10.2 Tokyo✅✅
Delphi 10.1 Berlin✅-
Delphi 10 Seattle✅-

Support the Project

🎁 Become a Patron Supporter

DMVCFramework is free and open-source, but maintaining and improving it requires significant effort. By becoming a Patron, you:

  • Access Premium Content - Exclusive tutorials, advanced examples, and early previews
  • Direct Developer Access - Priority support and direct communication with the development team
  • Shape the Future - Influence the roadmap and feature priorities
  • Support Open Source - Help keep DMVCFramework free for everyone

Join on Patreon →


Professional Services

Need enterprise-grade support? bit Time Professionals, the company behind DMVCFramework, offers:

  • Training Courses - On-site or remote training for your team
  • Consulting - Architecture review, performance optimization, best practices
  • Custom Development - Feature development, integration, migration

📧 Contact: dmvcframework@bittime.it | 🌐 bittimeprofessionals.it


Community & Resources

ResourceLink
📦 GitHub Repositorygithub.com/danieleteti/delphimvcframework
📕 Official Guide (Book)The official guide, 2nd edition
👥 Facebook Group (5,000+ members)facebook.com/groups/delphimvcframework
🎁 Patreon (Premium Content)patreon.com/delphimvcframework
📖 Free Sample ChapterRead on Leanpub

FAQ: Frequently Asked Questions

What is DMVCFramework?

DMVCFramework (DelphiMVCFramework) is an open-source framework for building web APIs, RESTful services, and web applications in Delphi. It’s the most popular Delphi web framework, used in production since 2010, and is the #1 Delphi project on GitHub by star count.

What is the best framework for REST API in Delphi?

DMVCFramework is the most popular and feature-complete framework for building REST APIs in Delphi. It supports RESTful APIs (RMM Level 3), JSON-RPC, WebSocket, Server-Sent Events, JWT authentication, and includes a powerful ORM called MVCActiveRecord.

How do I create a REST API in Delphi?

Use DMVCFramework: create a controller class inheriting from TMVCController, add [MVCPath] and [MVCHTTPMethods] attributes to define routes, and return data directly from your methods (functional actions). The framework automatically serializes objects, arrays, and records to JSON. See the 100+ included samples for examples.

How do I return JSON from a Delphi REST API?

With DMVCFramework, simply return an object, record, or TObjectList<T> from your controller method. The framework automatically serializes it to JSON. For more control, use OKResponse(data) or CreatedResponse(location) helpers.

Does DMVCFramework support JWT authentication?

Yes, DMVCFramework has built-in JWT (JSON Web Token) support for stateless authentication. It supports token generation, validation, role-based authorization, and secure HTTP-only cookies. See the jsonwebtoken and jsonwebtoken_roleauth samples.

Can I use DMVCFramework on Linux?

Yes, DMVCFramework fully supports Linux deployment starting from Delphi 10.2 Tokyo. You can deploy as a console application or daemon, with full support for all features including WebSocket and SSL/TLS.

Is DMVCFramework free?

Yes, DMVCFramework is free and open-source under the Apache 2.0 license. You can use it in commercial projects without restrictions or attribution requirements.

How do I get support for DMVCFramework?

Multiple support options are available: join the Facebook group (5,000+ members), explore the 100+ samples included in the project, read the official guide book, or become a Patron for priority support and exclusive content.

Does DMVCFramework support WebSocket?

Yes, DMVCFramework includes full WebSocket support for real-time bidirectional communication. Features include channel-based messaging, groups, and JavaScript client examples. It also supports Server-Sent Events (SSE) for server-to-client push notifications.

What is MVCActiveRecord?

MVCActiveRecord is DMVCFramework’s built-in ORM (Object-Relational Mapper) that simplifies database operations. It uses attributes for table/column mapping, supports CRUD operations, relationships, and RQL (Resource Query Language) for flexible querying.

How do I deploy DMVCFramework to production?

DMVCFramework supports multiple deployment options: Windows console application, Windows Service, Linux daemon, Apache module (mod_proxy), IIS (ISAPI DLL), and load-balanced environments. See the deployment samples for each scenario.

Does DMVCFramework support OpenAPI/Swagger?

Yes, DMVCFramework can automatically generate OpenAPI (Swagger) documentation for your APIs. Use the swagger_primer and swagger_ui samples to add interactive API documentation to your project.

How do I handle file uploads in DMVCFramework?

Use the Context.Request object to access uploaded files. The file_upload sample demonstrates handling multipart/form-data requests with single or multiple file uploads.

Can I use DMVCFramework with FireDAC?

Yes, DMVCFramework works with any database access layer including FireDAC, ADO, and others. MVCActiveRecord uses FireDAC by default, but you can use any connection you prefer.

How do I implement CORS in DMVCFramework?

Use the built-in CORS middleware. Add TMVCCORSMiddleware to your server configuration to enable cross-origin requests. See the middleware_cors sample for configuration options.

What Delphi versions does DMVCFramework support?

DMVCFramework supports Delphi 10 Seattle through Delphi 13 Florence, including full Linux support from Delphi 10.2 Tokyo onwards.

How do I handle errors and exceptions in DMVCFramework?

DMVCFramework automatically converts exceptions to appropriate HTTP error responses with JSON bodies. For custom error handling, use raise EMVCException.Create() with specific HTTP status codes, or implement custom exception handlers.

Does DMVCFramework support dependency injection?

Yes, DMVCFramework has built-in dependency injection. Use the [MVCInject] attribute on constructors or method parameters to automatically inject services and repositories. See the services_injection sample.


DMVCFramework - The #1 Delphi framework for Web API
Free. Open-source. Production-ready since 2010.

⭐ Star on GitHub 📖 Get the Official Guide
Key facts

DMVCFramework (DelphiMVCFramework) is the most popular open-source framework for building REST APIs and web applications in Delphi/Object Pascal.

  • License: Apache 2.0 (free for commercial use)
  • Production use: Since 2010
  • GitHub: #1 Delphi project by stars (1,300+)
  • Features: REST API (RMM Level 3), JSON-RPC 2.0, JWT auth, WebSocket, SSE, MVCActiveRecord ORM, dependency injection
  • Platforms: Windows (console, service, IIS, Apache), Linux (console, daemon)
  • Delphi versions: 10 Seattle through 13 Florence
  • Documentation: Official guide book available in English, Portuguese, Spanish
  • Community: 6,000+ developers in Facebook group
  • Author: Daniele Teti (bit Time Professionals)
  • Use cases: REST APIs, microservices, mobile backends, real-time apps, web applications

Comments