Source: /Users/lucasaugusto/Documents/sources/Bastion-main/
The Bastion instance implements the PAD (Platform Augmenting DATA) and POD (Procedural Operating Device) architecture. PADs define the data structures and schemas that power each entity, while PODs define the operational workflows and procedures that act on that data. Together, they form a “Lighthouse” — a self-contained, illuminated unit that can be deployed independently and guide other instances.
Data schemas, entity definitions, validation rules, and relationship mappings. The PAD defines WHAT data exists and HOW it is structured. Every entity in the Bastion model has a corresponding PAD definition.
Workflow definitions, business rules, state machines, and process automation. The POD defines WHAT happens to data and WHEN. Every action in the Bastion system is governed by a POD procedure.
The Bastion payment system uses a Chronological Fill Algorithm — a FIFO-based payment queue that ensures fair, deterministic settlement of obligations.
Invoice Created
A new invoice or commitment generates a payment obligation with a deadline.
Queue Entry
The payment enters the chronological queue, ordered by creation timestamp (FIFO).
Fund Check
When funds arrive, the system checks the queue from oldest to newest.
Partial Fill
If funds are insufficient for full payment, partial allocation is applied and the remainder stays in queue.
Complete Fill
When sufficient funds are available, the oldest obligation is fully satisfied and removed from queue.
Cascade
Remaining funds cascade to the next obligation in the queue. Process repeats until funds are exhausted.
React 18
Frontend UI library
FrontendVite
Build tool and dev server
Frontendshadcn/ui
50+ UI components (Card, Table, Dialog, etc.)
FrontendNestJS
Backend API framework
BackendGraphQL
API query language and schema
BackendPrisma
ORM for database access
BackendSupabase
Auth, realtime, and storage
InfrastructurePostgreSQL
Primary relational database
Infrastructure45+ shadcn/ui components + custom components
Frontend (React)
API (NestJS/GraphQL)
ORM (Prisma)
Database (PostgreSQL)
Services