This guide explains how to set up and use the Plaid integration for importing bank transactions and connecting financial accounts.
- Plaid Account: Sign up for a free developer account at Plaid Dashboard
- Database: Ensure your PostgreSQL database is running and accessible
- Log into your Plaid Dashboard
- Navigate to Team Settings > Keys
- Copy your
client_idandsandboxsecret key
Add the following to your .env file:
# Plaid Configuration
PLAID_CLIENT_ID="your_plaid_client_id_here"
PLAID_SECRET="your_plaid_secret_key_here"
PLAID_ENV="sandbox" # Use "sandbox" for developmentRun the database migration to create the new Plaid tables:
npx prisma db pushThis creates the following new tables:
plaid_items- Stores Plaid connection informationplaid_accounts- Maps Plaid accounts to local financial accounts
npm run dev- Navigate to Financial > Accounts
- Click "Connect Bank Account" button
- Search for your bank or select from popular options
- Follow the secure Plaid Link flow to authorize access
- Your accounts will be automatically imported
- After connecting accounts, use the "Import Transactions" button
- Choose your import period:
- Last 7 days
- Last 30 days
- Last 90 days
- Transactions are automatically categorized and ready for review
Keep your account balances up-to-date:
- Click "Import Transactions" dropdown
- Select "Sync Account Balances"
- All connected accounts will be updated with current balances
- Bank-level Security: Uses Plaid's 256-bit encryption
- Read-only Access: Only transaction and balance data is accessed
- No Credential Storage: Banking credentials are never stored in our system
- Token Management: Secure access tokens are encrypted and stored safely
The integration supports thousands of financial institutions including:
- Major Banks: Chase, Bank of America, Wells Fargo, Citi
- Credit Cards: Capital One, American Express, Discover
- Credit Unions: Navy Federal, PenFed, and local credit unions
- Online Banks: Ally, Marcus, and other digital-first banks
- Investment Accounts: Fidelity, Schwab, E*TRADE, and more
- "Failed to initialize bank connection": Check your Plaid credentials in
.env - "No Plaid accounts connected": Ensure you've successfully connected at least one account
- Database errors: Verify your database is running and migrations are applied
- Sandbox Mode: Use
PLAID_ENV="sandbox"for testing with fake data - Development Mode: Use
PLAID_ENV="development"for testing with real (limited) data - Production Mode: Use
PLAID_ENV="production"for live data (requires Plaid approval)
-
"Environment variable not found: PLAID_CLIENT_ID"
- Add Plaid credentials to your
.envfile
- Add Plaid credentials to your
-
"Failed to connect accounts"
- Check that your Plaid secret key matches your environment (sandbox/development/production)
-
"Transaction import failed"
- Ensure accounts are properly connected
- Check that Plaid items exist in the database
src/
├── actions/
│ └── plaid-actions.ts # Server actions for Plaid API calls
├── components/
│ └── financial/
│ ├── plaid-link-modal.tsx # Bank connection modal
│ └── transaction-import-button.tsx # Import controls
└── prisma/
└── schema.prisma # Database schema with Plaid models
- PlaidLinkModal: Handles bank account connection flow
- TransactionImportButton: Provides transaction import controls
- Plaid Actions: Server-side functions for API interactions
- Connection: User connects bank → Plaid Link → Access token stored
- Import: Fetch transactions → Map to local format → Store in database
- Sync: Update account balances → Refresh financial overview
After setup, you can:
- Connect Test Accounts: Use Plaid's sandbox credentials to test
- Import Sample Data: Try importing transactions from test accounts
- Customize Categories: Set up transaction categorization rules
- Enable Webhooks: Set up real-time transaction updates (advanced)
- Plaid Documentation: https://plaid.com/docs/
- API Reference: https://plaid.com/docs/api/
- Dashboard: https://dashboard.plaid.com/
Note: This integration uses Plaid's sandbox environment by default. For production use, you'll need to apply for production access through the Plaid Dashboard.