<HC />
Back to Projects
Cloud & Serverless ArchitectureArchived Learning Project

Ledger — Smart Expense Tracker

An AWS-native expense tracking platform with Amazon Cognito authentication, API Gateway JWT authorization, Lambda-hosted Flask business logic via aws-wsgi, per-user partitioned DynamoDB storage, and CloudWatch reporting.

AWS LambdaAmazon CognitoAWS API GatewayAWS DynamoDBAWS CloudWatchAWS S3AWS IAMPythonFlaskaws-wsgiboto3HTML5CSS3JavaScript

Screenshots

Ledger — Smart Expense Tracker — Signup & Login Interface
Signup & Login Interface
Ledger — Smart Expense Tracker — Expense Dashboard
Expense Dashboard

Key Metrics

Serverless Lambda & WSGI Adaptation

Amazon Cognito & JWT Authorizer

Per-User PK (user_id) & SK (expense_id)

Custom CloudWatch Metrics & Dashboards

Amazon S3 Static Website

Automated Idempotent boto3 Workflow

Overview

Ledger is an AWS-native smart expense tracking system featuring user authentication through Amazon Cognito, JWT-protected API Gateway routes, serverless Flask execution in AWS Lambda using aws-wsgi, per-user isolated DynamoDB storage, and operational telemetry dashboarding in Amazon CloudWatch.

Problem

Traditional expense management applications depend on continuously running web servers and complex database access rules, making user data isolation, API security, and operational reporting difficult to maintain without high cloud overhead.

Solution

Engineered a cloud-native serverless architecture leveraging Amazon Cognito for identity and API Gateway JWT authorizers to reject unauthorized traffic. The system routes business logic to a Flask Lambda handler via aws-wsgi, partitions expense data in DynamoDB under a user_id composite key, and publishes custom business and operational metrics to an automated CloudWatch dashboard.

Architecture

Serverless microservice architecture deployed via boto3. A static frontend hosted on Amazon S3 interacts with Amazon Cognito for signup, verification, and login token issuance. Protected API requests pass through API Gateway HTTP API with a Cognito JWT Authorizer. Valid calls execute an AWS Lambda runtime running a Flask application adapted via aws-wsgi. Data is persisted in DynamoDB using a composite primary key (PK: user_id, SK: expense_id), while custom metrics (TotalSpending, ExpensesAdded, category breakdowns) stream to CloudWatch.

Challenges

  • Adapting WSGI-based Flask web framework requests to AWS Lambda event structures using aws-wsgi while maintaining local dev server parity.
  • Configuring API Gateway HTTP API JWT authorizers with Amazon Cognito User Pools for stateless route protection.
  • Enforcing strict tenant isolation by modeling DynamoDB composite keys (user_id + expense_id) and validating tokens in backend routes.
  • Creating a single idempotent boto3 provisioning script (deploy.py) that deploys resources, packages dependencies, and injects live API endpoints into frontend assets.
  • Building CloudWatch observability metrics (SmartExpenseTracker namespace) combining business analytics with operational Lambda telemetry.

Lessons Learned

  • Serverless authentication lifecycle management using Amazon Cognito User Pools.
  • API protection using API Gateway JWT authorizers and stateless bearer tokens.
  • Partitioned NoSQL data modeling patterns for multi-tenant data isolation in DynamoDB.
  • WSGI application adaptation for AWS Lambda execution with aws-wsgi.
  • Infrastructure-as-code automation and frontend configuration injection with Python boto3.
  • Operational and business metrics reporting using Amazon CloudWatch dashboards and Logs Insights.

Future Improvements

  • Migrating static S3 frontend hosting behind Amazon CloudFront CDN with HTTPS certificate enforcement.
  • DynamoDB Global Secondary Index (GSI) optimization for historical spending trend analysis.
  • Automated export of monthly expense summaries to CSV format stored in Amazon S3.
  • Introducing multi-currency support and real-time exchange rate conversion API integrations.