
#WhatIsTMSXData
1. What is TMS XData?
TMS XData is a high-level framework developed by TMS Software that allows Delphi (and Lazarus/FPC) developers to build powerful, scalable REST/JSON web services with minimal code. It is part of the TMS Business Tools ecosystem and supports automatic ORM integration, Swagger/OpenAPI documentation, and seamless client/server communication.
XData significantly reduces the boilerplate needed for exposing REST APIs and provides out-of-the-box features like:
- Declarative service design with Delphi interfaces
- Built-in JWT token authentication
- Automatic database CRUD with Aurelius ORM
- Support for service contracts and OpenAPI docs
- Compatibility with RAD Web applications using TMS Web Core
#TMSXDataUseCases

2. Major Use Cases of TMS XData
TMS XData is used in various domains requiring RESTful communication and data-driven logic. Its primary use cases include:
🔄 2.1. Backend for Web & Mobile Apps
XData provides the backend logic for single-page web applications (SPA) built with TMS Web Core, React, Angular, or Flutter frontends. It handles database CRUD, business logic, and user authentication.
🛠️ 2.2. Microservices Development
Build microservices with minimal overhead, using XData to expose individual APIs that are scalable, stateless, and easily deployable.
🧾 2.3. Internal Tools & Admin Panels
Quickly create REST APIs that power internal dashboards, reporting tools, or administrative backends that consume and manage enterprise data.
🗄️ 2.4. Database-Driven Applications
When combined with TMS Aurelius, XData can auto-generate REST endpoints for entity models, making database-to-REST service creation seamless.
🔐 2.5. Secure RESTful APIs with Authentication
XData supports various authentication mechanisms including JWT (JSON Web Tokens), making it suitable for applications with secure login and role-based access controls.
#TMSXDataArchitecture
3. How TMS XData Works – Architecture Overview
TMS XData is designed with modularity, extensibility, and simplicity in mind. It abstracts REST API creation into a component-based architecture tightly integrated with Delphi’s object-oriented paradigm.
📐 Core Architectural Layers
✅ A. Server Application Layer
- Built using Delphi.
- Uses TXDataServerModule and TXDataService components.
- Defines endpoints using interfaces decorated with
[ServiceContract]and[HttpGet],[HttpPost], etc.
✅ B. HTTP REST Engine
- Leverages Sparkle, the HTTP engine by TMS, to receive and process HTTP requests.
- Can run as a standalone app, Windows service, or ISAPI DLL.
✅ C. Database Layer
- Uses TMS Aurelius ORM to connect with FireDAC, UniDAC, SQLite, PostgreSQL, MSSQL, and others.
- Automatic conversion of entities to REST services.
✅ D. Middleware Layer
- Handles authentication, CORS, logging, compression, and custom middleware through Sparkle units.
- JWT middleware can be enabled with just a few lines of code.
✅ E. Documentation Layer
- Automatically generates OpenAPI (Swagger) JSON specs.
- Easily integrated with Swagger UI for live documentation and testing.
#TMSXDataWorkflow
4. Basic Workflow of TMS XData
Here’s a typical flow from concept to production when working with TMS XData:
- Design Entities: Use TMS Aurelius to define data models.
- Create Service Interfaces: Define REST operations using interface-based services.
- Implement Services: Write your logic inside class implementations registered with XData.
- Configure Server: Drop
TXDataServerModuleon a form, link it with Sparkle, and configure endpoints. - Test APIs: Use Swagger UI or Postman to test your APIs locally or remotely.
- Secure & Deploy: Add authentication (JWT), configure deployment (e.g., Apache, IIS), and go live.
#GettingStartedWithTMSXData
5. Step-by-Step Getting Started Guide
Here’s how to build your first REST API with XData in Delphi:
✅ Step 1: Install TMS XData
- Purchase or download from tmssoftware.com.
- Install TMS Business Tools Bundle (includes Aurelius, Sparkle, and XData).
✅ Step 2: Create a New XData Server Project
- In Delphi, go to File > New > Other > TMS XData Server Project.
- Choose Sparkle Standalone Server or ISAPI DLL.
- Delphi creates a form with
TXDataServerModule,THttpSysDispatcher, and default Sparkle configuration.
✅ Step 3: Define a Service Interface
type
[ServiceContract]
IHelloService = interface(IInvokable)
['{12345678-ABCD-4321-DCBA-87654321ABCD}']
[HttpGet] function SayHello(Name: string): string;
end;
✅ Step 4: Implement the Interface
type
[ServiceImplementation]
THelloService = class(TInterfacedObject, IHelloService)
public
function SayHello(Name: string): string;
end;
function THelloService.SayHello(Name: string): string;
begin
Result := 'Hello, ' + Name + '!';
end;
✅ Step 5: Register and Run the Server
initialization
RegisterServiceType(THelloService);
Run the server. Your API is now accessible at:
GET http://localhost:2001/tms/xdata/IHelloService/SayHello?Name=John
✅ Step 6: Enable Swagger Documentation
- Drop
TXDataSwaggerModuleon the form. - Point your browser to: