Technical

Backend Architecture

Updated 1/19/2026
1 min read

Backend Architecture

Postcard's backend is built on Cloudflare Workers, providing a globally distributed, low-latency API.

Core Technologies

  • Cloudflare Workers: Serverless execution environment.
  • D1 Database: Cloudflare's native SQL database (SQLite based).
  • Cloudflare Images: Optimized storage and delivery for user avatars and post photos.
  • Cloudflare Stream: Specialized handling for video content.
  • Gemini AI: Automated moderation and content analysis.

Key Services

1. Media Sync Service

Handles the "eventual consistency" of media uploads. When a user uploads a photo, it's initially tracked in a pending state. This service ensures that if an upload fails or is abandoned, the DB and storage stay in sync.

2. Batch Moderation Service

To optimize costs and performance, moderation is performed in daily batches.

  • createDailyBatch: Aggregates new posts.
  • processBatchResults: Analyzes content using Gemini and flags potential violations.

3. Authentication

The API supports dual authentication:

  • Auth0: Used by the mobile app for user identity.
  • Cloudflare Access: Used by the Admin Panel for secure internal management.