Skip to content
Sheet 01 · Platform

The A-POST-OL platform

A C++ server and a business-logic platform in PostgreSQL. Sign-in and permissions, the API, business processes, events, integrations, files, messages, reports and background jobs work out of the box – a project describes only its own domain.

From one server to a cluster. Ready for Kubernetes.

2017since this year the platform has run in real projectsproject history
20+modules in the platform layerspecification, part 0, cl. 7.2
400+REST API routes out of the boxspecification, part II, annex A
507K RPSon plain HTTP requests – 90% of nginx's speedopen benchmark
112K RPSwhen every request goes to the databaseopen benchmark
Sheet 02 · Overview

A C++ server, all logic in PostgreSQL

A request enters through the server and reaches the database in a single call – where the data, the permissions and the business logic live. In the other direction the database itself hands work to background services: outbound requests, email, files, reports.

Clients
browsermobile apppartners and integrationsdevices and stations
HTTPS · WebSocket
nginxTLS · domains · rate limiting
HTTP · WebSocket
Level 1A-POST-OLC++20 · libapostol · one epoll event loop per process
Accept requests · worker processes × N
REST APIAppServer
Sign-in, OAuth 2.0, tokensAuthServer
WebSocket: calls and subscriptionsWebSocketAPI
Webhooks straight into SQLPGHTTP
Files under the object's permissionsFileServer
API v2 gatewayGatewayAPI
Modules in any languagebehind the gateway · go-platform
Run in the background · one leader instance
Outbound HTTP requestsPGFetch
Files and S3PGFile
Email, push, SMSMessageServer
Scheduled jobsTaskScheduler
out to: payment systems, email, S3, partner APIs
daemon.* · one call per requestNOTIFY · the database hands out work
Level 2db-platformPostgreSQL · PL/pgSQL · 29 modules
Entry to the database

The only door: session, context, route

daemon · api · session · current · gateway
Access

Users, groups, sessions, OAuth 2.0, permissions

admin · oauth2
Objects

Classes, lifecycle, files, addresses, languages

entity · workflow · file · kladr · locale
Events

Subscriptions, a trace of every action, notifications, codes

observer · notification · notice · comment · verification
Delivery

Task queues, outbound calls, exchange between nodes

notify · http · mq · replication
Reports

Report tree, forms, generation

report · reports
Core

Kernel, settings, journal, error catalogue, resources

kernel · registry · log · error · exception · resource
Level 3Your project

In the same database: the classes, states, methods, routes, events and permissions of your domain. The project extends the platform and does not change it.

configuration in SQLown services in C++own modules in Go
Fig. 1. Solid line – the path of a request, dashed – work the database hands out.
Sheet 03 · Scale

From one server to Kubernetes

Sessions, queues and routes live in PostgreSQL, so server instances are interchangeable. The same images run on one machine, on several servers and in Kubernetes – and the project's code does not change.

  1. IOne serverThe server, the database and everything else – in containers on one machine.
  2. IIEvery coreAs many worker processes as cores; background services – one each.
  3. IIIDatabase clusterPostgreSQL on separate servers, with automatic failover.
  4. IVSeveral serversInstances on different machines behind a load balancer, one database for all.
  5. VKubernetesInstances in pods; the orchestrator starts and updates them one at a time.
What makes it possible
One leader instance

A background service runs in one instance; the others wait in reserve and take over by themselves if the leader is gone. PostgreSQL elects the leader – no external coordinator is needed.

libapostol · leader lock
Each task – to exactly one executor

An outbound request, an email, a report or a job goes to one live instance and is closed by its confirmation. A late confirmation is rejected together with its result.

db-platform · notify
Any instance is a full gateway

API v2 modules connect to any instance; the routing table is shared and kept in the database.

GatewayAPI
Stopping without losses

A process finishes what it has started before it exits, and a crashed one restarts by itself. Instances are updated one at a time – the system does not stop.

libapostol · process model
Sheet 04 · Out of the box

Everything server-side is already there

Twelve subsystems shared by every project on the platform. A project gets them on day one and does not write them again.

Sign-in and sessions

OAuth 2.0 and JWT; sign-in by password, by code and through external providers. Sessions are kept in the database and closed on the server.

Permissions in three dimensions

On the class, the method and the object. Grants and denials for users and groups, visibility by department.

Object model

Documents and reference data in a class tree: owner, state history, links, files, addresses, texts in several languages.

Behaviour as data

States, transitions, events, routes and settings are rows in tables. They change on a running system, with no rebuild.

REST API

400+ routes out of the box; a project's route is added as a row. One request – one transaction, batches included. Alongside it, API v2 for modules in any language.

Real time

Calls and subscriptions over WebSocket. A subscriber receives only what has passed its filter and its permissions.

Integrations

Webhooks are received straight into SQL. The database queues outbound HTTP calls and a service runs them in the background, with polling as a safety net.

Messages

Email, push and SMS; notifications to users and confirmation codes for email and phone.

Files

Object files, accessible under the object's own permissions; stored on disk or in S3.

Reports

A report tree, parameter forms, generation in the background and a finished document.

Background jobs

Schedules and SQL jobs with a history of runs.

Journal and audit

The event journal, the API journal and a trace of every executed method. Errors come from a catalogue: a code and a text in the user's language.

Sheet 05 · Request path

One action – one transaction

Every request takes the same path. The object, its state, its history, the journal and the money change together – or not at all.

  1. 01nginxTLS, domain, rate limiting
  2. 02ServerChecks the token's signature and makes one call to the database
  3. One transaction
    1. 03SessionWho, on whose behalf, in which department, in which language, on which operating day
    2. 04RouteThe path is found in the routing table
    3. 05PermissionsOnly the objects the caller may see and change
    4. 06ActionA new state, events along the class tree, the journal, notifications to subscribers
  4. 07ResponseJSON. A refusal is a response too: a code and a text in the user's language
The way back – the database starts the work
  1. 01CommitThe transaction has recorded a task; after the commit the database wakes the service
  2. 02ServiceExactly one executor takes the task
  3. 03Outside worldA payment system, email, S3, a partner's API
  4. 04ResultThe answer comes back to the database as a call and changes the object's state
Sheet 06 · Behaviour as data

Processes are described, not programmed

Classes, states, methods, transitions, events and permissions are rows in the platform's tables. A business process changes on a running system, with no rebuild and no stop.

CreatedcreatedOpenedenabledCloseddisabledDeleteddeletedopencloseopenclosedeleterestoreCreatedcreatedOpenedenabledCloseddisabledDeleteddeletedopencloseopenclosedeletedeleterestore
Fig. 2. The default automaton: four types of state; delete works from any of them. A project adds its own – say, “Awaiting payment” or “Charging” – and its own actions, also as rows.
Permissions in three dimensions
01ClassCreate, see, change and delete objects of this kind
02MethodRun an action in a given state and see it in the interface
03ObjectSee, change and delete a specific object

Grants and denials are set for users and groups. Visibility is further limited by the department and by the area the session works in.

Sheet 07 · Projects

Running on the platform

Apostol CSMSEV charging
Ship Safety ERPMaritime
CopyFrogAI
DEBT-MasterUtilities
Apostol ARBFintech
Campus CORSGeodesy
Talking To AIAI
Apostol CRMOpen template

Discuss your project

Tell me about your task – I reply within a day. A free 30-minute call and a written estimate of timeline and budget.