Loading...
Loading...
Use when creating a new Phoenix project, adding Phoenix to an umbrella, configuring assets with Bun, setting up devenv.nix for a Phoenix project, configuring Ecto with PostgreSQL Unix sockets, or adding end-to-end tests.
npx skill4agent add gsmlg-dev/code-agent elixir-phoenix# Standard project
mix phx.new my_app --database postgres
# Umbrella app
mix phx.new my_app --umbrella --database postgresmix.exs{:esbuild, ...}{:bun, "~> 1.4", runtime: Mix.env() == :dev},
{:tailwind, "~> 0.2", runtime: Mix.env() == :dev},config/config.exsconfig :esbuildconfig :bun,
version: "1.3.4",
my_app: [
args: ~w(build assets/js/app.js --outdir=priv/static/assets --external /fonts/* --external /images/*),
cd: Path.expand("../", __DIR__)
]
config :tailwind,
version: "4.1.11",
my_app: [
args: ~w(--input=assets/css/app.css --output=priv/static/assets/app.css),
cd: Path.expand("../", __DIR__)
]Path.expand("../apps/my_app", __DIR__)cd:config/dev.exswatchers: [
tailwind: {Tailwind, :install_and_run, [:my_app, ~w(--watch)]},
bun: {Bun, :install_and_run, [:my_app, ~w(--sourcemap=inline --watch)]}
]mix.exs"assets.deploy": [
"phx.digest.clean",
"tailwind my_app --minify",
"bun my_app --minify",
"phx.digest"
]NODE_PATHdeps/deps/import {Socket} from "phoenix"import "phoenix_html"node_modules/devenv.nixenv.NODE_PATH = "${config.git.root}/deps";export NODE_PATH="$(pwd)/deps"npm installdeps/<package>/priv/static/config/runtime.exsif System.get_env("MIX_BUN_PATH") do
config :bun, path: System.get_env("MIX_BUN_PATH")
end
if System.get_env("MIX_TAILWIND_PATH") do
config :tailwind, path: System.get_env("MIX_TAILWIND_PATH")
endpathlib.getExedevenv.yamldevenv.nixlib.getExeMIX_BUN_PATHMIX_TAILWIND_PATHlisten_addresses = ""DATABASE_URL?socket=PGHOSTpsqlconfig/dev.exsdb_config =
[
username: System.get_env("POSTGRES_USER", "my_app_dev"),
password: System.get_env("POSTGRES_PASSWORD", "my_app_dev"),
database: System.get_env("POSTGRES_DB", "my_app_dev"),
show_sensitive_data_on_connection_error: true,
pool_size: 10
]
|> then(fn config ->
case System.get_env("PGHOST") do
nil ->
config ++ [hostname: System.get_env("POSTGRES_HOST", "localhost"),
port: String.to_integer(System.get_env("POSTGRES_PORT", "5432"))]
pghost when is_binary(pghost) ->
if String.starts_with?(pghost, "/") do
config ++ [socket_dir: pghost]
else
config ++ [hostname: pghost,
port: String.to_integer(System.get_env("POSTGRES_PORT", "5432"))]
end
end
end)
config :my_app, MyApp.Repo, db_configPGHOSTconfig/runtime.exsif config_env() == :prod do
database_url =
System.get_env("DATABASE_URL") ||
raise "DATABASE_URL is not set"
config :my_app, MyApp.Repo,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE", "10"))
ende2e_test/test/test.e2emix.exsdefp aliases do
[
# ... existing aliases ...
"test.e2e": ["run --no-halt", "cmd mix test e2e_test/"]
]
ende2e_test/mix.exsmix testdef project do
[
# ...
test_paths: ["test"],
elixirc_paths: elixirc_paths(Mix.env()),
]
endmix test.e2eNever addto CI pipelines, pre-commit hooks, or any automated alias that runs as part of a normal build or test cycle.test.e2e
| Tool | Hex Package | Env Var | devenv Source |
|---|---|---|---|
| Bun | | | |
| Tailwind | | | |
| PostgreSQL | | | |