Current section
Files
Jump to
Current section
Files
mix.exs
# SPDX-FileCopyrightText: © 2026 BaseLabs Holdings LLC
#
# SPDX-License-Identifier: MIT
defmodule Replicant.MixProject do
use Mix.Project
@version "3.0.0"
@source_url "https://github.com/baselabs/replicant"
def project do
[
app: :replicant,
version: @version,
elixir: "~> 1.20.3",
start_permanent: Mix.env() == :prod,
elixirc_paths: elixirc_paths(Mix.env()),
consolidate_protocols: Mix.env() != :test,
deps: deps(),
package: package(),
docs: docs(),
aliases: aliases(),
name: "Replicant",
description:
"Framework-agnostic Elixir CDC consumer for Postgres logical replication (pgoutput) " <>
"with zero-loss delivery to a pluggable sink — exactly-once for transactional " <>
"sinks, at-least-once (duplicate-bounded) for non-transactional sinks.",
source_url: @source_url,
homepage_url: @source_url,
dialyzer: [
plt_add_apps: [:mix, :ex_unit, :decimal, :jason, :postgrex],
plt_core_path: "priv/plts",
plt_local_path: "priv/plts"
]
]
end
def cli do
[preferred_envs: [credo: :test, dialyzer: :test]]
end
def application do
[
extra_applications: [:logger],
mod: {Replicant.Application, []}
]
end
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
defp deps do
[
# Runtime (Plan 1 consumes decimal + jason via casting; telemetry via the helper)
{:decimal, "~> 3.1"},
{:jason, "~> 1.4"},
{:telemetry, "~> 1.0"},
# ReplicationConnection substrate. Postgrex 0.23 is the floor for clearing
# password/SSL options after connect and handling async messages during
# replication startup. Its decimal requirement accepts our 3.x dependency.
{:postgrex, "~> 0.23"},
# Security floor: EEF-CVE-2026-133555 (GHSA-gmmq-fw75-wq46) affects every
# db_connection below 2.10.3. Postgrex alone admits 2.10.2, and the checkpoint
# store matches DBConnection errors directly, so a consumer must not be able
# to keep a vulnerable release.
{:db_connection, ">= 2.10.3 and < 3.0.0-0"},
# Dev/Test
{:ex_doc, "~> 0.31", only: [:dev, :test], runtime: false},
{:ex_check, "== 0.17.1", only: [:dev, :test], runtime: false},
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
{:sobelow, "== 0.19.0", only: [:dev, :test], runtime: false},
{:mix_audit, "~> 2.1", only: [:dev, :test], runtime: false}
]
end
defp package do
[
maintainers: ["rjpalermo"],
files:
~w(lib documentation docs/adr .formatter.exs mix.exs README.md LICENSE LICENSES/MIT.txt CHANGELOG.md NOTICE NOTICE.license usage-rules.md CONTRIBUTING.md examples/README.md examples/replication_pipeline/README.md),
licenses: ["MIT"],
links: %{
"GitHub" => @source_url,
"Changelog" => "#{@source_url}/blob/main/CHANGELOG.md",
"Documentation" => "https://hexdocs.pm/replicant"
}
]
end
defp docs do
[
main: "readme",
# Infra tags qualified Hex releases after registry read-back.
source_ref: "baselabs_replicant-v#{@version}",
source_url: @source_url,
# No EPUB: it embeds the build time unless SOURCE_DATE_EPOCH is set.
# Qualification retains HTML and Markdown for byte comparison at read-back.
formatters: ["html", "markdown"],
# Four extras share the README.md basename. Give the three nested
# extras explicit filenames so Home keeps the default readme ID.
extras: [
{"README.md", title: "Home"},
"documentation/tutorials/getting_started.livemd",
"documentation/topics/about/compatibility.md",
"documentation/topics/about/decoders.md",
"documentation/topics/delivery/invariants.md",
"documentation/topics/delivery/snapshot-coverage.md",
"documentation/how-to/reference-deployment.md",
"documentation/how-to/recover.md",
"documentation/how-to/upgrade.md",
"usage-rules.md",
{"docs/adr/README.md", filename: "adr-index"},
"docs/adr/0001-logical-decoding-messages-delivery-guarantees.md",
"docs/adr/0002-multi-publication-per-pipeline.md",
"docs/adr/0003-value-free-error-boundary.md",
"docs/adr/0004-commit-lsn-transaction-watermark.md",
"docs/adr/0005-spill-is-ephemeral-scratch.md",
"docs/adr/0006-fail-closed-supervision.md",
"docs/adr/0007-actual-replication-session-identity.md",
"docs/adr/0008-casting-lenient-value-preserving-fallback.md",
"docs/adr/0009-pglogical-wal2json-decoders.md",
"docs/adr/0010-postgresql-server-support.md",
{"examples/README.md", filename: "examples"},
{"examples/replication_pipeline/README.md", filename: "reference-pipeline-source"},
"CHANGELOG.md",
"CONTRIBUTING.md",
"LICENSE",
"NOTICE"
],
groups_for_extras: [
"Architecture decisions": [
"docs/adr/README.md",
"docs/adr/0001-logical-decoding-messages-delivery-guarantees.md",
"docs/adr/0002-multi-publication-per-pipeline.md",
"docs/adr/0003-value-free-error-boundary.md",
"docs/adr/0004-commit-lsn-transaction-watermark.md",
"docs/adr/0005-spill-is-ephemeral-scratch.md",
"docs/adr/0006-fail-closed-supervision.md",
"docs/adr/0007-actual-replication-session-identity.md",
"docs/adr/0008-casting-lenient-value-preserving-fallback.md",
"docs/adr/0009-pglogical-wal2json-decoders.md",
"docs/adr/0010-postgresql-server-support.md"
],
Tutorials: ~r"^documentation/tutorials/",
"Topics: sources and compatibility": ~r"^documentation/topics/about/",
"Topics: delivery": ~r"^documentation/topics/delivery/",
"How-to": ~r"^documentation/how-to/",
Reference: ["usage-rules.md"],
Project: [
"CHANGELOG.md",
"CONTRIBUTING.md",
"LICENSE",
"NOTICE",
"examples/README.md",
"examples/replication_pipeline/README.md"
]
],
groups_for_modules: [
"Core API": [Replicant, Replicant.Sink, Replicant.Config],
"Data structures": [
Replicant.Transaction,
Replicant.Change,
Replicant.SchemaChange,
Replicant.Error,
Replicant.SnapshotProgress,
Replicant.SessionIdentity
],
Observability: [Replicant.Telemetry],
Runtime: [
Replicant.Pipeline,
Replicant.Supervisor,
Replicant.Connection,
Replicant.AssemblerServer,
Replicant.Assembler,
Replicant.CheckpointStore
],
Snapshots: [
Replicant.Snapshotter,
Replicant.Snapshotter.Incremental,
Replicant.SnapshotWindow
],
"Disk spill": [Replicant.Spill, Replicant.Spill.Reader, Replicant.Spill.Error],
Decoders: [
Replicant.Decoder,
Replicant.Decoder.Plugin,
Replicant.Decoder.PgOutput,
Replicant.Decoder.Pglogical,
Replicant.Decoder.Messages,
Replicant.Decoder.OidDatabase
],
"Casting and SQL": [
Replicant.Casting.Types,
Replicant.Casting.ArrayParser,
Replicant.Identifier,
Replicant.QueryBuilder
]
]
]
end
defp aliases do
[
audit: ["deps.unlock --check-unused", "hex.audit", "deps.audit"]
]
end
end