~/projects/circles

Circles

Private photo sharing and real-time chat for close friends

# Role: Solo Developer & Designer # Duration: 4 months # Year: 2024
Next.js NextAuth v5 Prisma PostgreSQL Pusher Redis Cloudinary Zod
Circles main screenshot
~/rationale

Mainstream social platforms optimize for engagement through algorithmic feeds and advertisements, creating environments where sharing personal moments feels performative rather than intimate. Users seeking to share photos and communicate with close friends lack a dedicated space free from algorithmic interference.

Building a real-time social application required handling complex state synchronization across multiple users, implementing instant messaging with typing indicators and read receipts, and managing media uploads efficiently. The system needed to scale while maintaining the intimate, ad-free experience.

Circles provides a focused social space combining photo albums with real-time group chat. Pusher powers instant messaging with dual-channel architecture for conversation-specific and user-wide notifications. A three-layer caching system (Redis, in-memory, Prisma Accelerate) reduces API calls by 90%, while optimistic updates ensure zero perceived latency.

~/highlights

Real-Time Messaging Architecture

Dual-channel · optimistic updates
01

Implemented dual-channel Pusher architecture where each user has a personal notification channel plus dedicated channels for each conversation. Messages appear instantly via optimistic updates with status states (sending → sent → failed) and automatic retry capability.

Three-Layer Caching System

90% API reduction · 3-layer cache
02

Built a caching architecture combining Redis for shared data, in-memory TTL cache for hot data, and Prisma Accelerate for query optimization. Batch loading patterns check follow status, circle membership, and album likes in single queries, reducing API calls by 90%.

Complex Data Model

17 tables · 40+ indexes
03

Designed a 17-table PostgreSQL schema with 40+ indexes supporting self-referential relationships (follows), polymorphic notifications (activities), and dual-ownership patterns (albums). Cursor-based pagination handles infinite scroll efficiently.

Media Pipeline

Batch uploads · auto-optimization
04

Integrated Cloudinary for image uploads with automatic optimization, client-side cropping using canvas APIs, and batch upload support with per-photo status tracking. Album covers support multiple aspect ratios (1:1, 2:3, 16:9) with integrated cropping workflow.