Elixir + Phoenix LiveView + PostgreSQL
Real-time reactive web architecture for Elixir 1.20, Phoenix 1.8+, LiveView HTML-over-WebSockets, OTP supervision trees, and Ecto.
- Formats
- 4 files
- AGENTS.md
- 42 lines
- CLAUDE.md
- 17 lines
- Languages
- Elixir
- Updated
- Oct 2026
- Used by
- 2 projects
Writes .claude/skills/phoenix-liveview-postgres/SKILL.md
$ curl -s --create-dirs -o .claude/skills/phoenix-liveview-postgres/SKILL.md https://stackitfast.com/rules/phoenix-liveview-postgres/SKILL.mdRule files
Works with Cursor · Claude Code · Windsurf · AGY
Architecture notes
Architecture Overview
Standardized production guidelines for Elixir, Phoenix LiveView, and PostgreSQL.
Key Advantages
- Zero JavaScript Overhead: LiveView computes differential DOM diffs on the server and pushes minimal binary payloads over WebSockets.
- BEAM Fault Tolerance: Erlang’s battle-tested actor model isolates failure so individual user crashes never take down the system.
- Instant Real-Time Sync: Built-in Phoenix PubSub coordinates live updates across millions of concurrent users with negligible CPU footprint.
Frequently asked questions
Does this AGENTS.md work with Cursor, Claude Code, and Windsurf?
Yes — AGENTS.md is the open, cross-tool standard read by Cursor, Claude Code, Windsurf, and 30+ other agents. A dedicated .mdc file is also included for Cursor's native .cursor/rules format.
Why check connected?(socket) inside mount/3?
Phoenix LiveView calls mount/3 twice: once during the initial static HTTP render (disconnected, for fast first paint and SEO), and again after the WebSocket connection is established. Subscribing to PubSub topics or starting expensive processes during the disconnected pass wastes work that gets thrown away, so that setup should only happen once connected?(socket) is true.
Why use Ecto.Multi instead of a plain database transaction?
Ecto.Multi composes a sequence of named operations — inserts, updates, function calls — into a single atomic transaction with clear, inspectable steps and per-step error attribution. A raw Repo.transaction/1 with imperative code inside makes it much harder to tell which specific operation failed when a multi-step mutation rolls back.
Used in production
Explore all stacksElectricSQL
Postgres logical replication and shape-based HTTP sync live in a dedicated Elixir OTP service so any TypeScript, React, or Elixir client can subscribe to partial replicas without each client re-implementing replication.
Plausible Analytics
Pairing the BEAM virtual machine with ClickHouse allows Plausible to ingest high-volume telemetry surges reliably with minimal RAM and fast analytical queries.