- Env (.env)
- DATABASE_URL
- DIRECT_URL
- NEXT_PUBLIC_SUPABASE_URL
- NEXT_PUBLIC_SUPABASE_ANON_KEY
- SUPABASE_SERVICE_ROLE_KEY
- GROQ_API_KEY
- Install
pnpm install- DB migrate + seed
pnpm prisma migrate reset --skip-seed
pnpm seed- Run
pnpm dev- Tests
pnpm test
# watch mode
pnpm test:watchTests can also be run in a Docker container:
docker compose build
pnpm run test:docker- Lint & Format
pnpm lint
pnpm format:fix- API Documentation
View docs: http://localhost:3000/api-doc (dev only)
Add docs to new routes:
/**
* @swagger
* /api/your-route:
* get:
* summary: Brief description
* tags: [YourTag]
* security:
* - BearerAuth: []
* responses:
* 200:
* description: Success response
*/
export async function GET(request: Request) {
// your code
}Seeded logins (for local testing):
- manager@example.com / Password123!
- ava@example.com / Password123!
- liam@example.com / Password123!
- Google Maps API Key Setup
To use the ATM locator feature, you need to set up a Google Maps API key:
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the following APIs:
- Maps JavaScript API
- Places API
- Geocoding API
- Go to "Credentials" and create an API key
- Restrict the API key:
- Under "Application restrictions", select "HTTP referrers" and add your domain(s)
- Under "API restrictions", select "Restrict key" and choose the APIs you enabled
- Add the API key to your
.env.localfile:NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=your_api_key_here
Important: The API key is used for both server-side API calls and client-side map rendering. Make sure to restrict the API key by domain and specific APIs for security.
- Groq API Key Setup
To use the check deposit feature, you need to set up a Groq API key:
- Go to Groq Console
- Sign up or log in to your account
- Navigate to "API Keys" section
- Create a new API key
- Add the API key to your
.envor.env.localfile:GROQ_API_KEY=your_groq_api_key_here
The Groq API key is used server-side only for processing check images using the Vision API.
- Supabase Storage Setup
To use the check deposit feature, you need to create a storage bucket in Supabase:
Option 1: Using the setup script (Recommended)
pnpm tsx scripts/setup-storage.tsOption 2: Manual setup via Supabase Dashboard
- Go to your Supabase Dashboard
- Navigate to Storage
- Click "Create bucket"
- Name it
checks - Make it public (for now, or configure RLS policies if you want private access)
- Set allowed MIME types:
image/jpeg,image/jpg,image/png,image/webp - Set file size limit:
4194304(4MB)
Optional: Set up RLS Policies If you want to restrict access so users can only access their own check images:
-
Go to Storage > Policies for the
checksbucket -
Add policies for authenticated users to upload/read files in their own folder (
{auth.uid()}/*) -
API Key Transactions
The API supports making credit (deposit) and debit (withdrawal) transactions using API keys. These endpoints use the access_token query parameter for authentication (no JWT required).
Deposit (Credit) Transaction:
curl -X POST "http://localhost:3000/api/api-keys/transactions?access_token=YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"transaction_type": "credit",
"amount": 100.50
}'Withdrawal (Debit) Transaction:
curl -X POST "http://localhost:3000/api/api-keys/transactions?access_token=YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"transaction_type": "debit",
"amount": 50.00
}'Notes:
- Replace
YOUR_API_KEY_HEREwith your actual API key (format:cs_160...) - Amounts are in dollars with up to 2 decimal places (e.g.,
100.50for $100.50, or100for $100.00) - The API key must be generated via
/api/api-keys/generateendpoint (requires JWT) - Transactions are idempotent - duplicate requests with the same idempotency key will return the original transaction