A subscription and micro-charge detection application that helps users identify and manage small, recurring, or forgettable expenses that accumulate over time.
This is a monorepo containing three packages:
silent-spend-tracker/
βββ packages/
β βββ shared/ # Shared TypeScript types and schemas
β βββ backend/ # Express.js API server
β βββ frontend/ # React web application
βββ .env.example # Environment variables template
βββ package.json # Root package configuration
- Node.js 20+ and npm
- AWS Account with CLI configured
- AWS CDK CLI for infrastructure deployment (includes Lambda)
- Amazon RDS PostgreSQL (deployed via CDK) - Setup Guide
- Plaid account (for financial institution integration)
- Stripe account (for payment processing)
For detailed setup instructions, see the Setup Guide.
-
Install dependencies:
npm install
-
Set up environment variables:
# Windows .\scripts\setup.ps1 # Linux/Mac ./scripts/setup.sh
-
Deploy AWS Infrastructure (CDK):
npm run cdk:install cd infrastructure/cdk cdk bootstrap aws://YOUR_ACCOUNT_ID/eu-central-1 npm run deploy:devThis creates RDS database, Lambda API, API Gateway, S3 bucket, and CloudFront distribution. See CDK Quick Start for details.
-
Run migrations:
npm run migrate:up
-
Start development servers:
# Backend (local development) npm run dev:backend # Frontend (local development) npm run dev:frontend
-
Access your application:
- API: Use the API Gateway URL from CDK output
- Frontend: Use the CloudFront URL from CDK output
- Local: http://localhost:3000 (frontend), http://localhost:3001 (backend)
- π Setup Guide - Complete setup instructions
- π CDK Quick Start - Deploy infrastructure in 5 minutes
- ποΈ AWS RDS Setup - Detailed RDS configuration
- π’ Deployment Guide - Serverless production deployment
- π GitHub Actions Setup - CI/CD with OIDC authentication
- π Quick Reference - Common commands and tips
- π§ AWS OIDC Setup - GitHub OIDC provider configuration
Serverless Express.js API deployed as AWS Lambda with API Gateway via CDK:
- Runtime: Node.js 20 on AWS Lambda
- API Gateway: RESTful API with CORS support
- Database: PostgreSQL with connection pooling (Amazon RDS)
- Encryption: AES-256-GCM for sensitive data
- Authentication: JWT-based authentication
- Integrations: Plaid API (financial data), Stripe API (payments)
- Migrations: node-pg-migrate for database schema management
- Deployment: AWS CDK (bundled automatically)
Key directories:
src/config/: Configuration files (database, encryption, Plaid, Stripe)src/middleware/: Authentication and rate limitingsrc/utils/: Error handling utilitiessrc/lambda.ts: Lambda handler using serverless-httpmigrations/: Database migration files
Static React application hosted on S3 with CloudFront CDN:
- Hosting: AWS S3 static website hosting
- CDN: AWS CloudFront for global distribution
- Build Tool: Vite
- Routing: React Router (SPA routing via CloudFront)
- State Management: Zustand
- UI: Custom components with Lucide icons
- Testing: Vitest + React Testing Library
- Deployment: Automated via GitHub Actions
AWS CDK manages all infrastructure in a single stack:
- Amazon RDS PostgreSQL: Managed database with automated backups
- AWS Lambda: Serverless API runtime with automatic bundling
- API Gateway: RESTful API endpoint with CORS
- S3 Bucket: Frontend hosting with proper bucket policies
- CloudFront Distribution: Global CDN with HTTPS and SPA support
- AWS Secrets Manager: Database credentials management
- Security Groups: Network access control for RDS and Lambda
- IAM Roles: Proper permissions for Lambda execution
TypeScript types and Zod schemas shared between frontend and backend:
- Data models (Transaction, RecurringCharge, MoneyLeak, User)
- API request/response types
- Runtime validation schemas
- All sensitive data encrypted at rest using AES-256-GCM
- Per-user encryption keys derived from master key + user ID
- Plaid access tokens stored encrypted in database
- Master encryption key managed via AWS KMS
- TLS 1.3 enforced for all API communications
- Helmet.js for security headers
- CORS configured for frontend origin only
- JWT-based authentication
- Bcrypt password hashing
- Rate limiting on API endpoints
The database includes the following tables:
users: User accounts with tier and subscription informationplaid_accounts: Connected financial institution accountstransactions: Financial transactions from Plaidrecurring_charges: Detected recurring subscription chargesmoney_leaks: Aggregated money leaks (recurring + micro-charges)
See packages/backend/migrations/001_initial_schema.sql for the complete schema.
Run tests for all packages:
npm testRun tests for a specific package:
npm test --workspace=@silent-spend/backend
npm test --workspace=@silent-spend/frontendCreate a new migration:
npm run migrate:create -- migration_nameRun pending migrations:
npm run migrate:upRollback last migration:
npm run migrate:downThe project includes complete CI/CD workflows using GitHub OIDC authentication:
# Set up GitHub secrets (one time)
.\scripts\setup-github-secrets.ps1 # Windows
./scripts/setup-github-secrets.sh # Linux/MacAutomated Deployments:
- Development: Push to
developbranch β Deploy to dev environment - Production: Push to
mainbranch β Deploy to production environment
What gets deployed:
- Infrastructure (CDK): RDS database, Lambda function, API Gateway, S3 bucket, CloudFront distribution
- Frontend: React app built and deployed to S3, CloudFront cache invalidated
See GitHub Actions Setup Guide for detailed configuration.
Deploy Everything (Infrastructure + API + Frontend):
cd infrastructure/cdk
npm run deploy:prod # or deploy:devDeploy Frontend Only:
cd packages/frontend
npm run build
aws s3 sync dist/ s3://your-bucket-name --delete
aws cloudfront create-invalidation --distribution-id YOUR_ID --paths "/*"Update Lambda Function Code:
# Redeploy CDK stack to update Lambda
cd infrastructure/cdk
npm run deploy:prod- Uses Plaid Sandbox environment
- Uses Stripe test mode
- Local development server or deployed Lambda
- S3 + CloudFront for frontend testing
- Detailed error messages enabled
- Requires production Plaid credentials
- Requires production Stripe credentials
- AWS Lambda + API Gateway for serverless scaling
- S3 + CloudFront for global frontend distribution
- Database SSL enabled
- Error details hidden from API responses
- AWS KMS for encryption key management
API endpoints will be documented as they are implemented. The main endpoint groups are:
/api/auth: Authentication and user management/api/plaid: Plaid Link integration and account connection/api/insights: Money leak insights and pattern detection/api/billing: Stripe subscription management/api/accounts: Connected account management
API Base URL: Provided by API Gateway after Lambda deployment
- Development:
https://api-id.execute-api.eu-central-1.amazonaws.com/Prod/ - Production:
https://api-id.execute-api.eu-central-1.amazonaws.com/Prod/
Proprietary - All rights reserved
For questions or issues, please contact the development team.