
Weekend Showcase Challenge: Persistent Stopwatch
The Serverless Persistent Stopwatch is a web-based timekeeping application designed to solve the common frustration of ephemeral browser data. Traditional web timers lose all recorded information the moment a user accidentally refreshes the page or closes the tab.
The Serverless Persistent Stopwatch is a web-based timekeeping application designed to solve the common frustration of ephemeral browser data. Traditional web timers lose all recorded information the moment a user accidentally refreshes the page or closes the tab. This project resolves that issue by permanently recording lap times to a scalable cloud database, ensuring that saved data persists across different sessions and reloads. The user interface is intentionally approachable, featuring a clean, centralized card design with a soft radial gradient background and the Nunito font.
Under the hood, the timing mechanism runs entirely within the browser using standard JavaScript. When a user initiates the timer, a
setInterval function continuously calculates the elapsed time based on the initial start timestamp, updating the display every 100 milliseconds. When the user clicks the "Save Lap" button, the frontend constructs a JSON payload containing the elapsed milliseconds and dispatches it via an HTTP POST request to the backend /laps endpoint. When the application first loads, it automatically executes a GET request to fetch and render any previously saved laps, and users can cleanly wipe the history via a DELETE request.Building this application required navigating several architectural and developmental decisions. I started by developing the frontend, establishing the mathematical logic to convert raw milliseconds into a readable
MM:SS.T format. The primary challenge was integrating this client-side interface with a secure backend. I needed to ensure the frontend could dynamically locate the API without hardcoding sensitive or environment-specific URLs directly into the HTML markup. To overcome this, I decoupled the API configuration by reading the endpoint from a window.API_BASE_URL variable housed in a separate config.js file. This file is programmatically overwritten with the correct URL string during the automated deployment stage. On the backend, I authored a Python handler that routes incoming requests based on the specific HTTP method. I built explicit error handling into the POST method to catch TypeError or ValueError instances if the incoming payload fails to provide the required elapsed milliseconds. For the database design, I opted for a simplified schema utilizing a fixed partition key ( "laps" ) and a composite sort key combining the current timestamp with a UUID fragment to guarantee uniqueness for every saved lap.The underlying architecture relies entirely on managed AWS services to achieve a fully serverless environment that requires no traditional server provisioning. Amazon S3 can be utilized to reliably host the static HTML, CSS, and JavaScript files, delivering the frontend application to end users. For the networking and routing layer, Amazon API Gateway is deployed as a highly scalable HTTP API. This gateway handles complex Cross-Origin Resource Sharing (CORS) policies—explicitly allowing GET, POST, DELETE, and OPTIONS HTTP methods—and routes all incoming web traffic directly to the backend function. The core computational logic is executed by an AWS Lambda function running a lightweight Python 3.12 runtime. Finally, the persistent data tier is powered by Amazon DynamoDB, configured as a NoSQL database operating on a flexible pay-per-request billing model to optimize costs during idle periods.
Project Screenshot:

Across the summer, my understanding of cloud engineering matured significantly, transitioning from writing isolated scripts to architecting distributed cloud systems. A major focal point was mastering Identity and Access Management (IAM). I learned how to create strict, least-privilege execution roles, explicitly defining policies that granted my Lambda function only the exact permissions needed—such as
PutItem , DeleteItem , Query , and BatchWriteItem —to interact with the specific DynamoDB table ARN. Furthermore, I heavily utilized the AWS Command Line Interface (CLI) to script the deployment infrastructure, allowing for rapid, repeatable provisioning of tables, functions, and API routes. Finally, I learned the crucial operational habit of infrastructure teardown; I mastered the corresponding cleanup commands to systematically delete the API, Lambda function, DynamoDB table, and IAM roles to prevent unintended runaway costs.Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article