๐ Expense Book
A serverless, full-stack expense tracker built entirely on AWS โ no servers to manage, no infrastructure to maintain. Add expenses, track spending by category, and view monthly reports, all backed by a pay-per-use backend.
๐ Live Demo: https://roshni-expense-book.netlify.app
๐ก Why I built this
I wanted to understand serverless architecture from the ground up โ not just read about Lambda and API Gateway, but actually wire them together, break things, read the CloudWatch logs, and fix them. This project is the result: a working expense tracker where every part of the stack โ database, backend, API layer, and frontend โ was built and debugged by hand.
โ๏ธ Architecture
โโโโโโโโโโโโโโโ HTTPS โโโโโโโโโโโโโโโโ Invoke โโโโโโโโโโโโโโโ Read/Write โโโโโโโโโโโโโโโโ โ Frontend โ โโโโโโโโโโโโโโถ โ API Gateway โ โโโโโโโโโโโโโโถ โ Lambda โ โโโโโโโโโโโโโโโโโโถ โ DynamoDB โ โ (HTML/CSS/JS)โ โ (REST API) โ โ (Python) โ โ (NoSQL) โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ Netlify Roshni stage 4 functions, Partition key: userId IAM execution role Sort key: expenseId
Request flow: the browser calls a REST endpoint โ API Gateway (with Lambda proxy integration) forwards the raw event to the matching Lambda function โ the function reads/writes DynamoDB using an IAM role scoped for that access โ the response is serialized back through API Gateway to the browser, with CORS headers so the request isn't blocked cross-origin.
๐งฐ Tech stack
Layer Technology Frontend HTML5, CSS3, vanilla JavaScript (
fetch API) API layer Amazon API Gateway (REST API, Lambda proxy integration) Compute AWS Lambda (Python 3.x) Database Amazon DynamoDB Access control IAM roles & policies Hosting Netlify (frontend) Version control Git & GitHub๐ API Endpoints
Method Endpoint Description
POST /expenses Add a new expense GET /expenses?userId={id} Get all expenses for a user DELETE /expenses/{expenseId}?userId={id} Delete a specific expense GET /report?userId={id} Get total spend + category-wise breakdownโจ Features
Add expenses with amount, category, description, and date
View all expenses in a clean, ledger-style list
Delete individual entries
Auto-generated monthly report with category-wise totals
Fully responsive UI, no frameworks โ just HTML/CSS/JS talking directly to the API
๐ What I actually debugged (not just followed)
Building this surfaced real, non-obvious serverless issues that I worked through one by one:
Lambda proxy integration โ without it enabled in API Gateway,
event['queryStringParameters'] came back empty even though Postman showed the request going through fine.IAM least-privilege โ Lambda's default execution role only allows writing logs. Every DynamoDB call needed an explicit permission grant, which surfaced as
AccessDeniedException in CloudWatch until fixed.Decimal serialization โ DynamoDB returns numeric values as Python
Decimal, which json.dumps() can't serialize by default. Fixed with a custom default= handler.CORS (two-part fix) โ a browser blocks cross-origin calls entirely different from how Postman behaves. Fixing it required both a
Access-Control-Allow-Origin header in every Lambda response and enabling CORS at the API Gateway resource level for the preflight OPTIONS request to succeed.Case sensitivity โ a path parameter named
{Id} in API Gateway silently mismatched event['pathParameters']['id'] in Python, producing a KeyError that only made sense after reading the CloudWatch traceback.๐ Project structure
expenses-book/ โโโ index.html # Frontend (self-contained) โโโ backend/ โ โโโ addExpense/lambda_function.py โ โโโ getExpense/lambda_function.py โ โโโ deleteExpense/lambda_function.py โ โโโ getMonthlyReport/lambda_function.py โโโ README.md
๐ Running it yourself
The frontend is a single static file โ no build step required.
1 like ยท 7 views ยท Aug 26, 2026
Developed a serverless expense tracker using AWS services and deployed on Netlify.