Project Sentinel is an asynchronous web service responsible for managing user accounts, processing real-time financial transactions, and providing live query updates to client dashboards [1, 6]. It is designed to ensure transactional integrity and high availability.
This service follows a modern data flow based on local-first synchronization patterns [6]:
- Database (Postgres): Primary data store, utilizing logical replication [7, 8].
- Sync Engine (Electric): Handles the read-path synchronization from Postgres to clients via HTTP [6].
- Client DB (TanStack DB): Embedded client database used for live queries and transactional optimistic mutations [6].
This separation ensures that mutations are instant (optimistic write on the client) and later reconciled via the Electric stream, dropping the optimistic state when the final change arrives from the backend [9].
These instructions are for setting up the environment locally for a human contributor [5].
- Node.js (for
pnpm) - Docker Compose (for local Postgres setup)
- Python 3.11+ (for FastAPI backend components)
-
Clone the Repository:
git clone my-finance-app -
Install Dependencies:
- Install server dependencies:
pnpm install[10, 11]. - Install Python backend dependencies (see
requirements.txt):pip install -r requirements.txt[12].
- Install server dependencies:
-
Database Setup (using Docker Compose): Run the standard stack defined in
docker-compose.yamlto spin up Postgres and the Electric backend [7]:docker compose up -dRun migrations:pnpm migrate[11] -
Start the Dev Server:
- Start the client application:
pnpm dev[10, 11]. - Start the FastAPI/Python backend:
uvicorn app.main:app --reload[12].
- Start the client application:
All code changes must pass the full test suite before merging.
- Run all tests:
pnpm test[10]. - Run specific package tests (Monorepo setup):
pnpm turbo run test --filter <project_name>[13]. - Code Formatting: We enforce PEP8 standards (for Python) and use the Black formatter [12].
We use conventional commits. Please follow these guidelines:
- PR Title Format:
[<component_name>] <Short description of change>[13, 14]. - Pre-Commit Check: Always run
pnpm lintandpnpm testbefore committing [13, 14]. - Testing: Add or update tests for any new or modified code [13].