Architecture
This chapter describes the high-level architecture of TCA_API and how a request flows through the system.
Request flow
HTTP Request
↓
TcaApiMiddleware (PSR-15 entry point)
↓
RequestDispatcher (path parsing, access control, handler dispatch)
↓
OperationHandlers (GetCollectionHandler, GetItemHandler, CreateHandler, …)
↓
DataRepository (QueryBuilder reads) ↔ DataWriteService (DataHandler writes)
↓
ResourceSerializer (DB row → Hydra JSON-LD)
↓
HydraResponseBuilder (JSON-LD response assembly)
Copied!
Key components
- TcaApiMiddleware
- PSR-15 middleware that intercepts requests matching the configured API prefix.
Checks if the API is enabled for the current site, adds CORS headers if
configured, and delegates to
Request.Dispatcher - RequestDispatcher
- Parses the URL path to determine the resource and operation. Enforces the
operation whitelist, checks access control via
Access, dispatchesController Before, and routes to the matching operation handler viaOperation Event Handler.Registry - Operation Handlers
-
Implement
Operation. Built-in handlers:Handler Interface Get— list operationCollection Handler Get— show operationItem Handler Create— POST operationHandler Update— PUT/PATCH operationsHandler Delete— DELETE operationHandler Get— userinfo operationUser Info Handler
- DataRepository
- Read-only data access via TYPO3
Query. Supports filter strategies, sorting, pagination, and PID constraints.Builder - DataWriteService
- Wraps TYPO3's
Datafor create, update, and delete operations. Ensures data integrity and respects TCA rules.Handler - ResourceSerializer
- Converts raw database rows to Hydra JSON-LD arrays. Handles column visibility, sparse fieldsets, relation embedding, file processing, and virtual properties.
- HydraResponseBuilder
- Assembles the final JSON-LD response structure including
@context,@type,hydra:(for collections),member hydra:(pagination), andview violations(for validation errors). - ApiRegistry
- Static registry that stores all resource configurations. Populated
automatically by
Apiat boot time.Definition Loader - HandlerRegistry
- Static registry for operation handlers with priority-based dispatch.
- AccessController
- Evaluates
Accessenum values and callable voters against the current request context.Role