Undertone — Privacy-First Social Platform
A privacy-first, anonymous interest-based discussion platform built on a Single-Table DynamoDB schema, AWS Cognito JWT verification, AWS ECS Fargate serverless containers, real-time API Gateway WebSockets, Amazon Rekognition media moderation, and Amazon Polly voice synthesis.
Screenshots
Key Metrics
Single-Table DynamoDB & ECS Fargate
Amazon Cognito & Backend JWT Middleware
API Gateway WebSockets & Lambda
Amazon Rekognition & Amazon Polly Caching
React Native & Expo SDK 57
67+ Passing Pytest/Moto Test Cases
Overview
Undertone is a full-stack, cross-platform social discussion platform designed for user privacy and mental peace. The system features pseudonymous identity generation, interest-based communities (Circles), Nod/Pass voting, Resonance reputation metrics, direct-to-S3 media uploads, AI-powered Rekognition moderation, Amazon Polly speech narration, and real-time direct messaging via API Gateway WebSockets.
Problem
Mainstream social discussion networks often compromise privacy, introduce high database query latency with relational SQL joins, and incur significant server costs for real-time WebSocket messaging and media moderation at scale.
Solution
Architected a cloud-native single-table DynamoDB data model achieving single-digit millisecond latency across users, posts, comments, and votes. Secured user identities using Amazon Cognito JWT verification, containerized the Flask backend on AWS ECS Fargate, implemented serverless WebSockets via API Gateway and Lambda, and offloaded media moderation and voice narration to Amazon Rekognition and Amazon Polly.
Architecture
Cross-platform monorepo architecture. Next.js 15 web client and Expo React Native mobile apps connect to a Flask REST API running on AWS ECS Fargate containers. Authentication is backed by Amazon Cognito User Pools with cryptographic JWT signature verification at the WSGI middleware boundary. Primary persistence relies on a single DynamoDB table. Direct messaging uses Amazon API Gateway WebSockets backed by an AWS Lambda connection handler. Uploaded media bypasses backend servers via presigned S3 URLs and is automatically scanned by Amazon Rekognition, while Amazon Polly voice tracks are cached as MP3s in S3 (audio/<post_id>.mp3).
Challenges
- Designing a comprehensive Single-Table DynamoDB schema (PK/SK patterns & GSIs) covering pseudonymous profiles, Circles, threaded comment trees, Nod/Pass votes, and DMs.
- Eliminating millisecond timestamp collisions on concurrent comments by refactoring DynamoDB Sort Keys (SK) with high-precision timestamps.
- Implementing serverless WebSockets using API Gateway and AWS Lambda while maintaining a polling fallback client for maximum reliability.
- Cryptographically validating Cognito JWT signatures and expiration claims within custom Python WSGI middleware.
- Building a comprehensive offline AWS test suite using moto covering 67+ test scenarios across DynamoDB, S3, Cognito, Polly, and Rekognition.
Lessons Learned
- Advanced Single-Table NoSQL database design principles with Amazon DynamoDB.
- Cryptographic JWT verification and role-based access control inside Python WSGI backend middleware.
- Serverless real-time WebSocket connection handling with Amazon API Gateway and AWS Lambda.
- Container orchestration and serverless execution with Amazon ECS Fargate and ECR.
- Offline AWS cloud unit testing using Pytest and Moto.
- Cross-platform state management and Safe Area handling across Next.js 15 and Expo SDK 57.
Future Improvements
- Applying Cognito JWT verification middleware across all 19 remaining REST endpoints.
- Containerized Redis deployment on ECS for sliding-window API rate limiting and token bucket throttling.
- Real-time automated post text content moderation using Amazon Comprehend.
- Dynamic private Circle invitation workflows and direct screen sharing in DMs.