Keila

Self-hosted newsletter platform with a visual block editor, Liquid personalization, and flexible email delivery — a privacy-respecting Mailchimp alternative you run on your own infrastructure.

2.2Kstars
154forks
GNU AGPLv3
Elixir

Keila is an open source email newsletter platform built for individuals and teams who want full control over their subscriber data and sending infrastructure. Built with Elixir and Phoenix LiveView, it delivers a modern, browser-based authoring experience with real-time previews, a drag-and-drop block editor, and Markdown or MJML support for developers who want fine-grained control over email design.

Sender flexibility is a core strength: Keila supports plain SMTP for small deployments, and integrates natively with AWS SES, SendGrid, Mailgun, and Postmark for high-volume sending. Contacts can be imported via CSV, collected through customizable sign-up forms with bot protection and double opt-in, and organized into precise segments using a MongoDB-style query language accessible through either a visual editor or the API.

Privacy and transparency are built into the product rather than bolted on. Analytics tracking can be fully disabled, opt-in links can be protected against automated click fraud, and all subscriber data stays on your own PostgreSQL database. The Liquid templating engine lets you personalize every email with contact-specific data — tags, custom fields, or anything collected through forms.

Keila is deployed as a single Docker container backed by PostgreSQL and a configured SMTP or transactional email provider. It ships as open source under the AGPLv3 license, with a hosted cloud option at app.keila.io for teams that prefer not to manage infrastructure.

What You Get

  • Visual Block Editor - A drag-and-drop WYSIWYG editor for composing email campaigns using reusable content blocks, with real-time preview and mobile/desktop view switching, no coding required.
  • Markdown & MJML Authoring - Write newsletters in Markdown for simplicity or MJML for fully responsive semantic HTML emails, with syntax highlighting via a built-in CodeMirror editor and server-side compilation.
  • Liquid Template Engine - Personalize every email using Shopify’s Liquid syntax to dynamically insert contact fields, tags, custom data, and campaign metadata directly in email bodies and subjects.
  • Contact Import & Custom Fields - Import contacts via CSV (including Excel and LibreOffice exports), define custom contact data fields, and collect structured data through embedded sign-up forms.
  • Visual Segment Editor - Build targeted audience segments using a no-code visual query builder or a MongoDB-style filter DSL, filtering by email behavior, custom fields, tags, or subscription status.
  • Multi-Provider Email Sending - Send via your own SMTP server or connect to AWS SES, SendGrid, Mailgun, or Postmark — switching providers requires only a config change, no code changes.
  • Double Opt-In & Bot Protection - Enforce double opt-in verification for new subscribers with customizable confirmation emails, and protect unsubscribe and opt-in links from automated click fraud.
  • Campaign Archive & Public Links - Publish sent campaigns as public web archives with shareable URLs, allowing non-subscribers to read past issues in the browser.
  • RESTful API - Manage contacts, campaigns, senders, and forms programmatically via a fully documented OpenAPI-spec API, with Bearer token authentication scoped to individual projects.

Common Use Cases

  • Running a developer-focused newsletter - A developer self-hosts Keila on a VPS, connects it to AWS SES for reliable delivery, and uses MJML templates to produce pixel-perfect HTML emails with custom branding without paying Mailchimp’s per-contact fees.
  • Privacy-compliant nonprofit communications - A European nonprofit hosts Keila on their own infrastructure to send donor updates and event announcements, disabling all tracking to ensure full GDPR compliance with zero data leaving their jurisdiction.
  • Automated product update emails - A SaaS company uses Keila’s API to trigger campaigns when product milestones are reached, personalizing content with Liquid templates that pull in user-specific data collected through custom form fields.
  • Multi-project agency newsletter management - A digital agency uses Keila’s project scoping to manage separate subscriber lists and campaigns for multiple clients from a single instance, with per-project API keys for client integrations.
  • Welcome email automation for new signups - A community platform embeds Keila’s sign-up forms on their website and configures welcome emails to fire automatically when new contacts confirm their subscription via double opt-in.

Under The Hood

Architecture Keila follows a strict two-layer architecture separating a domain layer from a web layer, with the domain organized into bounded contexts — accounts, auth, contacts, mailings, templates, tracking, files, and projects — each exposing a clean public API through a dedicated context module. Background email delivery is handled by Oban job queues backed by the same PostgreSQL database, with separate workers for campaign rendering, delivery, scheduled sends, and message pruning. Sender adapters are injected via application environment configuration, making it straightforward to swap delivery providers without touching business logic. The most architecturally interesting decision is the conditional compilation pattern: proprietary Keila Cloud features live in an extra/ directory that is only compiled when the WITH_EXTRA build flag is set, enabling a clean open-core model without runtime feature flags or branching.

Tech Stack The backend runs on Elixir 1.18 and Erlang OTP 27 with the Bandit HTTP server, Phoenix 1.7, and Phoenix LiveView 1.1 for real-time server-rendered UIs with minimal JavaScript. PostgreSQL is the sole database, accessed via Ecto with Oban using the same connection pool for background jobs. Email rendering chains the Solid library for Liquid personalization, Earmark for Markdown, and the mjml NIF for MJML compilation into a single builder pipeline. The frontend uses TypeScript with ProseMirror for the block editor and CodeMirror for the MJML editor, bundled via esbuild alongside Tailwind CSS. API documentation is auto-generated from OpenApiSpex route annotations. The project uses dprint for consistent TypeScript and JSON formatting, and GitHub Actions for CI.

Code Quality The test suite is comprehensive, spanning unit tests for every domain context module and integration tests that exercise the full Phoenix stack. Tests use a factory-based pattern with structured setup helpers, Oban.Testing assertions for job queue behavior, and DataCase for transactional database isolation. All domain functions use Elixir pattern matching, guard clauses, and with chains for explicit error propagation — exceptions are surfaced rather than swallowed. Context modules carry extensive @doc annotations, and the OpenApiSpex integration auto-generates backend API documentation from route definitions. Naming conventions follow Phoenix idioms consistently, and the contact query module includes inline examples in its module doc that double as documentation tests.

What Makes It Unique The contact segmentation system implements a MongoDB-style filter DSL directly on top of Ecto queries, allowing non-technical users to operate the visual segment editor while developers access the same filtering logic through the API or raw query syntax — a single coherent abstraction serving both audiences. The email rendering pipeline is notable for composing three distinct authoring modes (block editor, Markdown, MJML) through a single builder module that handles Liquid interpolation, CSS inlining, signature injection, tracking pixel insertion, and unsubscribe link generation in a unified pass. The build-time open-core separation keeps the AGPLv3 codebase fully auditable while allowing proprietary cloud billing and shared sender features to compile in only when explicitly enabled.

Self-Hosting

Keila is licensed under the GNU Affero General Public License version 3 (AGPLv3). This is a strong copyleft license that allows commercial use and modification, but with an important caveat: if you run a modified version of Keila as a network service (which self-hosting is), you must make the source code of your modified version available to users of that service. For the vast majority of self-hosters — teams running Keila internally for their own newsletters — this requirement has no practical impact. However, teams planning to build a commercial email service on top of a modified Keila would need to open-source their changes. Note that the extra/ directory is explicitly carved out from the AGPLv3 license and is provided for informational purposes only; you cannot use, redistribute, or build upon that proprietary code.

Running Keila yourself requires a Linux server with Docker, a PostgreSQL database, and a configured email delivery provider. The official Docker Compose setup covers the basics, and the application manages its own database migrations on startup. For production use, you are responsible for PostgreSQL backups, uptime monitoring, TLS termination (typically via a reverse proxy like nginx or Caddy), and keeping up with Keila releases as they include both features and security fixes. The project ships releases frequently — roughly monthly — so staying current requires an ongoing operational commitment. Horizontal scaling is possible but not documented out of the box; Oban’s PostgreSQL-backed queue handles multi-node deployments if you configure shared database access correctly.

Keila Cloud at app.keila.io is the hosted alternative, with pricing that removes the infrastructure burden entirely. The cloud tier adds managed upgrades, built-in deliverability infrastructure, shared SES senders, and direct support from the maintainer. Self-hosters give up these conveniences but gain complete data sovereignty, no per-contact pricing, and the ability to send through their own verified domain reputation. For teams with existing DevOps capacity and strong data privacy requirements, self-hosting is a straightforward choice; for smaller teams without dedicated infrastructure ownership, the cloud tier is worth the cost.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack

No spam. Unsubscribe anytime.

Join 750+ subscribers
No spam. Unsubscribe anytime.

Search