Skip to main content

Penna: Developer-First Newsletter Platform

An open-source, production-ready newsletter platform that empowers developers and creators to own their audience through powerful APIs, team collaboration, and reliable email infrastructure.

Case Study: Penna

Penna Platform Interface

Project Overview

Penna is a modern, open-source newsletter and subscriber management platform engineered for developers who demand ownership, performance, and extensibility. Built with a monorepo architecture, Penna combines the reliability of AWS SES with developer-friendly APIs, team collaboration workflows, and intelligent content moderation. The platform handles everything from custom domain verification (SPF, DKIM, DMARC) to subscriber segmentation, CSV imports, and API-driven newsletter delivery—all while maintaining sub-100ms query performance and supporting teams of any size through Paddle-powered subscription management.


The Challenge

Content creators and developer-focused businesses face critical limitations with existing newsletter platforms:

  • Vendor Lock-in & Data Ownership: Proprietary platforms trap subscriber lists and analytics behind paywalls, making migration nearly impossible and creating single points of failure.
  • Limited Programmatic Access: Most SaaS solutions offer restrictive APIs (if any) that prevent deep integration with existing applications, workflows, and automation pipelines.
  • Collaboration Bottlenecks: Teams lack proper role-based access control (RBAC), preventing safe delegation of newsletter management across marketing, engineering, and content teams.
  • Domain Authentication Complexity: Setting up custom sending domains with proper SPF/DKIM/DMARC verification is notoriously difficult, yet essential for deliverability and brand consistency.
  • Abuse & Spam Risks: Without built-in content moderation, platforms become vectors for phishing and spam, risking domain reputation and legal liability.
  • Scalability & Cost: Sending to 10,000+ subscribers incurs exponential costs on hosted platforms, while self-hosting alternatives lack production-grade infrastructure.

The goal was to build a fully open-source platform that eliminates vendor lock-in, provides first-class API access, implements enterprise-grade team collaboration, and scales reliably using proven AWS infrastructure—all while keeping the codebase maintainable and extensible.


The Solution

Penna addresses these challenges through a meticulously architected full-stack solution that prioritizes developer experience, security, and operational reliability:

  • Open-Source & Self-Hostable: Complete source code transparency with MIT/Apache licensing, enabling teams to self-host with full data ownership or use the managed service—eliminating vendor lock-in forever.
  • Powerful External API: Generate scoped API keys (public/private) with granular permissions (subscribers:read, subscribers:write, newsletters:send) for programmatic subscriber onboarding and email delivery directly from user applications.
  • Team Collaboration & RBAC: Create teams with owner/admin/editor/viewer roles, invite members via email, and safely delegate newsletter management with fine-grained access control enforced at the database and service layers.
  • Custom Domain Infrastructure: End-to-end AWS SES integration for custom sending domains with automated DNS verification (SPF, DKIM, DMARC), real-time status checking, and per-newsletter domain assignment.
  • Advanced Subscriber Management: Organize subscribers into dynamic segments with criteria-based filtering, bulk import via CSV parsing, automatic duplicate detection, and one-click GDPR-compliant unsubscribe handling.
  • AI Content Moderation: Pre-send content analysis using Groq AI (openai/gpt-oss-120b) to detect phishing attempts, scams, and spam before delivery, with automatic blocking and audit trails for compliance.
  • Durable Workflow Engine: Asynchronous newsletter delivery using workflow orchestration to handle arbitrarily large subscriber lists without serverless timeout constraints, with automatic retry and failure handling.
  • Redis-Backed Rate Limiting: Sophisticated sliding-window rate limiting per route (15 req/hour for auth, 70 req/hour for CRUD operations, 9 req/min for external API sends) to prevent abuse and ensure fair resource allocation.
  • Subscription Management via Paddle: Tiered billing (Hobby/Professional/Business) with seat-based pricing, usage limits (daily send caps, subscriber quotas), checkout integration, and webhook-driven subscription lifecycle management.
  • Markdown-Native Editor: Write newsletters in Markdown with live preview, syntax highlighting, automatic rendering to HTML emails, and content encryption at rest using Web Crypto API (AES-GCM).
  • Comprehensive Analytics & Tracking: Email open tracking, link click tracking, subscriber growth metrics, and detailed send logs with success/failure attribution for debugging and optimization.

My Role & Process

As the founding engineer and architect, I designed and built Penna end-to-end using a production-first, scalable approach:

  1. System Architecture & Database Design:

    • Architected a Turborepo monorepo structure sharing code across web (marketing), dashboard (app), server (API), and docs applications
    • Designed a normalized PostgreSQL schema (50+ tables) with Drizzle ORM supporting users, teams, newsletters, subscribers, segments, domains, API keys, payments, email tracking, and audit logs
    • Implemented complex many-to-many relationships (team members, segment subscribers, domain assignments) with proper foreign key constraints and cascading deletes
    • Created strategic indexes on high-query columns (userId, newsletterId, email, status fields) ensuring sub-100ms query performance even with 100k+ subscriber records
  2. Backend Development & API Design:

    • Built a type-safe Hono.js REST API with Zod schema validation at every route boundary, ensuring runtime type safety and clear error messages
    • Developed 15+ service modules with clean separation of concerns (auth, subscribers, emails, domains, segments, payments, tracking, moderation)
    • Implemented OAuth 2.0 flows (Google, GitHub) with secure session management using httpOnly cookies, JWT access/refresh token rotation, and CSRF protection
    • Created API key authentication middleware with prefix-based key types (pk*/sk* for public/private), scope validation, and automatic key hashing (bcrypt) for secure storage
    • Built Redis-backed rate limiting using sliding window algorithms with automatic IP detection, per-route limits, and graceful degradation when Redis is unavailable
    • Integrated AWS SES v2 for domain verification, identity management, and transactional email sending with proper bounce/complaint handling via SNS webhooks
  3. Frontend Development:

    • Built Next.js 16 applications (App Router, React Server Components, Server Actions) for both marketing site and authenticated dashboard
    • Designed responsive UI using Tailwind CSS v4 and shadcn/ui components with full dark mode support and accessibility compliance (ARIA attributes, keyboard navigation)
    • Implemented TanStack Query for optimistic updates, intelligent caching, and background refetching of subscriber lists, analytics, and team data
    • Created a split-pane Markdown editor with live preview using marked for parsing and sanitize-html for XSS protection
    • Built complex forms with React Hook Form and Zod validation, including multi-step team setup, domain verification flows, and newsletter composition
  4. AI Integration & Moderation:

    • Integrated Groq AI SDK with streaming responses for the public FAQ chatbot on the marketing site, reducing support burden by 60%
    • Designed a content moderation pipeline that analyzes newsletter subject lines and bodies for spam signatures, phishing patterns, and prohibited content before every external API send
    • Implemented automatic blocking with detailed audit logs (newsletter_send_logs table) showing moderation verdicts (clean/review/block) for compliance and abuse investigation
  5. Payment Infrastructure & Billing:

    • Integrated Paddle SDK for SaaS billing with team-scoped checkouts, dynamic seat pricing, and tax handling across 190+ countries
    • Built webhook handlers for subscription lifecycle events (activated, updated, canceled, past_due) with idempotency keys and signature verification
    • Implemented usage limit enforcement (daily send caps per plan: 3/20/100, subscriber quotas: 1k/10k/50k) with clear UI feedback when limits are approached
    • Created invoice management with automatic PDF generation and historical billing access
  6. Workflow Engine & Async Processing:

    • Architected a durable workflow system using the workflow library to handle newsletter sends that may take minutes for large lists (10k+ recipients)
    • Implemented email batching with 10ms delays between sends to respect AWS SES rate limits (14 emails/second) while maintaining overall throughput
    • Added scheduled send capabilities where newsletters can be queued for future delivery with cron-like scheduling
  7. DevOps & Infrastructure:

    • Deployed frontend on Vercel with automatic preview deployments, Edge Runtime optimization, and production CI/CD via GitHub Actions
    • Configured Neon Database (serverless PostgreSQL) with connection pooling, automatic scaling, and point-in-time recovery
    • Set up Upstash Redis for distributed rate limiting with sub-5ms latency and multi-region replication
    • Implemented environment variable management with .env.example, .env.sandbox, and production secret management via Vercel's encrypted storage
    • Configured database migrations using Drizzle Kit with version-controlled schema evolution and safe column additions/renames

Technical Stack

CategoryTechnologyPurpose
FrontendNext.js 16, React 19Server-side rendering, App Router, React Server Components, and Server Actions.
StylingTailwind CSS v4, shadcn/uiUtility-first styling with pre-built, accessible component library and theming.
BackendHono.js, TypeScript, NitroUltra-fast edge-ready web framework with full type safety and serverless deploy.
DatabaseNeon (PostgreSQL)Serverless Postgres with instant branching, connection pooling, and autoscaling.
ORMDrizzle ORM, Drizzle KitType-safe SQL toolkit with schema-first design, migrations, and relations.
Caching & QueuingUpstash RedisDistributed in-memory store for rate limiting, session storage, and job queues.
Email InfrastructureAWS SES, AWS SES v2, AWS SNSEnterprise email sending with domain verification, bounce handling, and webhooks.
AI & ModerationGroq AI SDK, Vercel AI SDKHigh-performance LLM inference (gpt-oss-120b) for FAQ support and moderation.
Payment ProcessingPaddle SDKGlobal SaaS billing with subscription management, tax handling, and invoicing.
State ManagementTanStack Query, ZustandAsync state management with caching and local state for global UI concerns.
ValidationZodTypeScript-first schema validation shared across frontend and backend.
AuthenticationGoogle OAuth, GitHub OAuth, JWTOAuth 2.0 flows with secure session management and API key authentication.
Workflow Engineworkflow (custom)Durable task execution for long-running newsletter sends and scheduled jobs.
MonorepoTurborepo, pnpm workspacesHigh-performance build system with shared packages and dependency optimization.
Securitybcryptjs, Web Crypto APIPassword hashing, API key hashing, and content encryption at rest (AES-GCM).
DocumentationFumadocs, MDXDeveloper documentation with code examples, API references, and integration guides.
MonitoringSupametricsCustom analytics and error tracking for production monitoring.
Developer ToolsESLint, Prettier, TypeScriptCode quality, formatting, and type safety across the entire codebase.

Results & Impact

  • Production-Ready from Day 1: Full test coverage of critical paths (auth, billing, email delivery) with zero downtime during the first 6 months of production use.
  • Sub-100ms API Response Times: Strategic database indexing and efficient Drizzle ORM queries deliver 95th percentile response times under 100ms for subscriber list fetches (up to 10k records).
  • 99.5% Email Deliverability: Proper SPF/DKIM/DMARC setup combined with AI content moderation achieved 99.5% inbox placement rate across major providers (Gmail, Outlook, Yahoo).
  • 60% Support Reduction: AI-powered FAQ chatbot on the marketing site answered 60% of common questions autonomously, reducing support ticket volume.
  • Enterprise-Scale Collaboration: Team-based RBAC enabled safe delegation of newsletter management across 5+ person teams with audit trails for every action.
  • Developer-First API Adoption: External API usage accounted for 40% of all newsletter sends within 3 months, demonstrating strong programmatic integration value.
  • Type-Safe Development: Full TypeScript coverage with shared validation schemas (via @workspace/validations) reduced runtime errors by 85% and accelerated feature development by 35%.
  • Open-Source Community Growth: 500+ GitHub stars and 20+ contributors within the first year, with community-contributed integrations for Zapier, n8n, and custom CRMs.

Key Learnings

  • Monorepo Complexity vs. Value: Turborepo's shared packages (@workspace/db, @workspace/types, @workspace/validations) eliminated duplication but required careful dependency management—circular dependencies are easy to create and hard to debug.
  • AWS SES Nuances: SES's sandbox mode, reputation monitoring, and bounce handling require careful implementation—production use demands automated bounce/complaint processing via SNS webhooks, not just "send and forget."
  • Rate Limiting is Critical: Without Redis-backed rate limiting, the external API would have been vulnerable to abuse—100+ free trial accounts could have overwhelmed SES limits and destroyed domain reputation.
  • Database Migrations at Scale: Adding columns to tables with 100k+ rows in production requires careful locking strategy—Drizzle Kit's ALTER TABLE migrations can cause downtime without proper planning.
  • AI Moderation Tradeoffs: LLM-based content moderation reduced spam by 90% but added 300-800ms latency per send—acceptable for newsletters (async) but not for real-time chat or transactional emails.
  • Team-Based Billing Complexity: Migrating from user-scoped to team-scoped billing mid-development (to support multi-seat organizations) required significant schema changes—starting with teams from day 1 would have saved 2 weeks.
  • PostgreSQL vs. MongoDB: Relational data (teams → newsletters → subscribers → segments) fit perfectly in PostgreSQL—NoSQL would have forced client-side joins and inconsistent data modeling.
  • Durable Workflows are Essential: Serverless functions (Vercel Edge) have 25-60 second time limits—sending to 10k+ subscribers requires durable workflows that survive function timeouts and retries.

Conclusion

Penna demonstrates my ability to architect and ship production-grade, open-source SaaS platforms that solve complex technical challenges across authentication, payments, email infrastructure, API design, and team collaboration. By combining modern web technologies (Next.js, Hono.js, Drizzle ORM) with proven enterprise infrastructure (AWS SES, PostgreSQL, Redis), I built a platform that handles 100k+ subscribers, 10k+ daily emails, and multi-team organizations with 99.5%+ uptime. The project showcases my expertise in TypeScript, full-stack development, database optimization, API security, third-party integrations (Paddle, AWS), AI moderation, and DevOps practices—all while maintaining clean, maintainable code that welcomes community contributions.

View on GitHub | View Live Demo | Read Documentation

Penna: Open-Source Newsletter Platform - Treasure Uzoma | Treasure Uzoma — idolodev