Skip to content

feat: Bank Sync Connector Architecture ($500 bounty)#1172

Open
jeromeyhq wants to merge 1 commit into
rohitdash08:mainfrom
jeromeyhq:main
Open

feat: Bank Sync Connector Architecture ($500 bounty)#1172
jeromeyhq wants to merge 1 commit into
rohitdash08:mainfrom
jeromeyhq:main

Conversation

@jeromeyhq
Copy link
Copy Markdown

Bank Sync Connector Architecture

Pluggable architecture for bank integrations as specified in #75.

What this delivers

  • Connector Interface — Abstract BankConnector base class with connect(), disconnect(), import_transactions(), and refresh() methods
  • Import & Refresh Support — Bulk import with date range + incremental refresh since last sync
  • Mock Connector Included — Realistic test data across 3 accounts (checking, savings, credit) with 5 spending categories + income

Files added

File Purpose
app/services/connectors/base.py Abstract BankConnector interface + TransactionRecord, AccountInfo, SyncResult dataclasses
app/services/connectors/mock_connector.py Full mock implementation with deterministic transaction generation
app/services/connectors/registry.py Pluggable registry with register_connector(), get_connector(), list_connectors()
app/routes/bank_sync.py REST API: /api/bank-sync/{connectors,accounts,import,refresh,health}
tests/test_connectors.py Full test suite (pytest)

API Endpoints

GET  /api/bank-sync/connectors   — List available connectors
GET  /api/bank-sync/accounts     — List bank accounts for a provider
POST /api/bank-sync/import       — Bulk import transactions
POST /api/bank-sync/refresh      — Incremental refresh
GET  /api/bank-sync/health       — Health check

Usage example

# List connectors
curl http://localhost:5000/api/bank-sync/connectors

# Import transactions
curl -X POST http://localhost:5000/api/bank-sync/import \
  -H "Content-Type: application/json" \
  -d '{"provider": "mock", "account_id": "mock-checking-001"}'

# Refresh
curl -X POST http://localhost:5000/api/bank-sync/refresh \
  -H "Content-Type: application/json" \
  -d '{"provider": "mock", "account_id": "mock-checking-001"}'

Design notes

  • Python 3.9 compatible (no 3.10+ type syntax)
  • Easy to add new connectors: just inherit from BankConnector and use @register_connector
  • Mock connector generates deterministic data (same date range = same transactions)
  • Transaction records normalize to FinMind's existing expense import format

All 5 Python files compile cleanly. Tests included.

Pluggable architecture for bank integrations with:

- Abstract BankConnector base class (interface)
  - connect() / disconnect() lifecycle
  - import_transactions() for bulk import
  - refresh() for incremental sync
  - get_accounts() and health_check()

- Mock connector with realistic test data
  - 3 accounts (checking, savings, credit)
  - 5 categories: groceries, dining, transport, shopping, bills + income
  - Deterministic transaction generation (same seed = same data)
  - ~90 days of realistic transaction history

- Connector registry for pluggable discovery
  - register_connector() decorator
  - get_connector() / list_connectors() API
  - Auto-registration of built-in connectors

- REST API routes:
  - GET  /api/bank-sync/connectors   — List available connectors
  - GET  /api/bank-sync/accounts      — List bank accounts
  - POST /api/bank-sync/import        — Bulk import transactions
  - POST /api/bank-sync/refresh       — Incremental refresh
  - GET  /api/bank-sync/health        — Health check

- Full test suite (pytest) covering base, mock, registry

Python 3.9 compatible (no 3.10+ type syntax).
@jeromeyhq jeromeyhq requested a review from rohitdash08 as a code owner June 2, 2026 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant