惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

M
MIT News - Artificial intelligence
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
Last Week in AI
Last Week in AI
S
SegmentFault 最新的问题
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
人人都是产品经理
人人都是产品经理
WordPress大学
WordPress大学
The Cloudflare Blog
IT之家
IT之家
雷峰网
雷峰网
小众软件
小众软件
博客园 - 叶小钗
博客园 - 聂微东
爱范儿
爱范儿
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
博客园 - 【当耐特】
V
V2EX
博客园_首页
T
Tailwind CSS Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Building a Serverless Life Visualization App with Next.js...
Randika Madhushan Perera · 2026-06-01 · via DEV Community

How we built yourdeath.date - a memento mori tool that renders your life as a grid of weeks - on a fully serverless AWS stack

Introduction


Most apps are built to keep you engaged as long as possible. We built one designed to remind you that your time is finite.

yourdeath.date visualizes your entire life from birth to projected death as a grid of small squares. Each square is one week. Filled squares are weeks already spent. The rest are blank.

The app also lets users log "good deeds" onto specific weeks, pin life milestones to the grid, share their grid publicly, and connect with a community of people thinking about how they spend their time.

This article covers the technical architecture behind it. The AWS services, the serverless design decisions, the DynamoDB single-table schema, the auth flow, and the frontend rendering approach.

What is this Application?


Frontend -> Next.js 14 (App Router), React 18, TypeScript, Tailwind CSS
Backend -> AWS Lambda (Node.js 22.x), API Gateway REST
Database -> DynamoDB (single-table design, 3 GSIs)
Auth -> Amazon Cognito (User Pool + Identity Pool)
Email -> Amazon SES + Secrets Manager
Storage Amazon -> S3
Scheduling -> Amazon EventBridge
IaC -> AWS SAM (Serverless Application Model)
Hosting -> AWS Amplify (frontend), API Gateway (backend)

High Level Architecture


High Level Architecture - AWS

Application FLow


User Onboarding Flow

  1. User visits yourdeath.date
  2. Clicks "See your life →"
  3. Redirected to /auth (Cognito hosted UI or email/password)
  4. OAuth callback → /auth/callback
  5. Amplify exchanges code for tokens (access + id + refresh)
  6. POST /auth/sync → Lambda syncs Cognito identity to DynamoDB
  7. Redirect to /onboarding → user enters DOB + life expectancy
  8. PUT /user/profile → stores profile in DynamoDB
  9. Redirect to /dashboard → LifeGrid renders with real data

Deed Logging Flow

  1. User opens community page
  2. Frontend reads current week index: Math.floor(msAlive / msPerWeek)
  3. User fills deed form (description, category, helpedWho, isPublic)
  4. POST /deeds → Lambda validates, stores in DynamoDB
    • PK: USER#{userId} SK: DEED#{weekIndex:6-padded}#{deedId}
    • GSI1PK: COMMUNITY#PUBLIC (if public) or USER#{userId}#PRIVATE
  5. Dashboard: GET /deeds/me returns {weekIndex → count} map
  6. LifeGrid highlights that week column green

Weekly Email Flow

EventBridge cron(0 6 ? * MON *) → WeeklyEmailFunction
→ ScanCommand: FilterExpression = emailOptIn = true
→ For each user:
→ Fetch weeks lived, weeks remaining
→ Generate HMAC token: sha256(userId:email, secret)
→ Build HTML email with unsubscribe link
→ SES SendEmail (10-message batches, 100ms throttle)

AWS Services Connectivity Flow

AWS Services Connectivity Flow

Interesting Engineering Decisions


  1. Single-Table DynamoDB vs Multi-Table

We choose single table design to minimize cold-start latency (one connection pool) and reduce operational overhead. The trade-off is query complexity, GSI3 exists purely to solve the deed-by-ID lookup problem that arises from putting deeds under USER#{id} as primary key.

  1. HMAC Unsubscribe Tokens

Rather than storing one-time tokens in DynamoDB, the unsubscribe system uses a stateless HMAC approach:

token = base64url( HMAC-SHA256( "{userId}:{email}", secret ) )

Validation is a single HMAC re-computation + constant-time comparison. No database lookup required. The secret lives in Secrets Manager and is fetched once per Lambda cold start.

Conclusion


The stack — Next.js on Amplify, API Gateway, Lambda, DynamoDB, Cognito — is a proven serverless pattern that scales to thousands of concurrent users with near-zero operational overhead. The interesting parts were the DynamoDB single-table schema design (especially GSI3 for deed lookup), the theme-aware LifeGrid renderer, and keeping analytics collection genuinely privacy-respecting.

The full codebase lives at yourdeath.date. If you have questions about any of the architecture decisions, drop them in the comments.


Built with AWS SAM · Next.js 14 · DynamoDB · Cognito · TypeScript