Open Banking via TrueLayer — Feature Complete
Open Banking via TrueLayer — Feature Complete
Release: v1.0.91
The TrueLayer Open Banking integration is fully implemented across the entire stack. Landlords can now connect their bank accounts directly to the platform, enabling automatic transaction import and reconciliation against their property finance records.
What This Means for Landlords
Instead of manually entering income and expense transactions, you can connect your bank account once and let the platform pull in transactions automatically. Those transactions are then available to be promoted into your property ledger, making quarterly Making Tax Digital (MTD) submissions faster and more accurate.
Architecture Overview
1. Database Tables
Three new tables underpin the integration:
| Table | Purpose |
|---|---|
bankConnections | Stores the OAuth connection and token data for each landlord's linked bank |
bankAccounts | Stores the bank accounts retrieved from TrueLayer after connection |
bankTransactions | Stores raw synced transactions, ready for review and promotion |
2. TrueLayer Client
src/lib/truelayer/client.ts handles all communication with the TrueLayer API:
- OAuth 2.0 authorisation and token exchange
- Fetching accounts linked to a connection
- Fetching transactions for a given account and date range
3. Credential Store
src/lib/truelayer/credential-store.ts manages the secure persistence of OAuth tokens, ensuring access and refresh tokens are stored and retrieved safely per landlord.
4. OAuth Callback
src/app/api/bank/callback/route.ts handles the redirect from TrueLayer after a landlord authorises the connection. It exchanges the authorisation code for tokens and persists them via the credential store.
5. tRPC Bank Router
src/lib/routers/bank.ts exposes bank-related server procedures to the frontend, including:
- Initiating a TrueLayer connection
- Listing connected accounts
- Listing synced transactions
- Promoting transactions to property finance records
6. Background Sync (Inngest)
Two Inngest functions run in the background:
bank-sync(src/inngest/functions/bank-sync.ts) — periodically fetches new transactions from TrueLayer for all active connections and writes them tobankTransactions.bank-promote-transactions(src/inngest/functions/bank-promote-transactions.ts) — promotes reviewed bank transactions into the landlord's property finance ledger for use in MTD submissions.
7. Dashboard UI
The bank management interface is available at /dashboard/bank/. From here, landlords can:
- Connect a new bank account via TrueLayer
- View linked accounts
- Review and promote synced transactions
Environment Variables
The following environment variables must be configured to enable TrueLayer Open Banking. See .env.example for the full list of TRUELAYER_* variables.
| Variable | Description |
|---|---|
TRUELAYER_CLIENT_ID | Your TrueLayer application client ID |
TRUELAYER_CLIENT_SECRET | Your TrueLayer application client secret |
TRUELAYER_REDIRECT_URI | The OAuth callback URL (e.g. https://yourdomain.com/api/bank/callback) |
Credentials are stored securely per landlord using the credential store. Tokens are never exposed to the client.