Architecture & Internals
This section details the internal design of the Backend, intended for developers who need to extend the functionality or understand the data flow.
Tech Stack
- Runtime: Node.js (v18+)
- Framework: NestJS (TypeScript)
- Database: PostgreSQL 14+
- ORM: TypeORM
- Hedera Integration: @hashgraph/sdk
- Documentation: Swagger (OpenAPI 3.0)
- Logging: Winston
- Testing: Jest
Modular Design
The application follows a Domain-Driven Design (DDD) approach via NestJS Modules:
| Module | Description |
|---|---|
| TransactionModule | Core Logic. Handles the creation, storage, signature collection, and submission of Multi-sig transactions. |
| EventModule | Listens to Smart Contract events emitted on the Hedera Network and syncs them to the local DB. |
| ProxyModule | Forwards read-only requests to Mirror Nodes, adding a layer of caching or security (optional). |
| NetworkModule | Manages the connection context (Testnet/Mainnet) and Client initialization. |
Multi-Signature Flow
The backend coordinates the asynchronous collection of signatures for multisig transactions.
Transactions not executed within 3 minutes of their startDate are automatically marked as EXPIRED. This is a Hedera network constraint — transactions have a maximum validity window of 3 minutes.
Database Schema
The persistence layer uses a relational model to track the state of operations.
Key Entities
- Transaction: Stores the raw bytes (
transactionMessage) of the Hedera Transaction. - Signature: Stores the cryptographic signature, public key, and relation to the Tx.
Event Listener System
The backend includes a polling mechanism to catch events:
- FactoryObserver: Watches for new Stablecoins deployed.
- TokenObserver: Watches for
CashIn,Burn, andTransferevents.