{"id":27118330,"url":"https://github.com/sadjow/phoenix-devenv-template","last_synced_at":"2026-05-07T08:37:08.927Z","repository":{"id":282595457,"uuid":"949061419","full_name":"sadjow/phoenix-devenv-template","owner":"sadjow","description":"Phoenix Framework template with devenv/Nix for reproducible development. Features automated dependency updates, CI/CD with GitHub Actions, and instant dev environment setup. Zero system-wide installations required (except Nix).","archived":false,"fork":false,"pushed_at":"2026-05-03T00:51:12.000Z","size":184,"stargazers_count":7,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-03T02:27:05.760Z","etag":null,"topics":["beam","development-environment","devenv","direnv","elixir","erlang","nix","nixpkgs","phoenix","phoenix-elixir","phoenix-framework","phoenix-liveview","reproducible-development"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sadjow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2025-03-15T15:33:33.000Z","updated_at":"2026-04-01T16:40:12.000Z","dependencies_parsed_at":"2026-03-31T21:00:34.329Z","dependency_job_id":null,"html_url":"https://github.com/sadjow/phoenix-devenv-template","commit_stats":null,"previous_names":["sadjow/elixir-devenv-template","sadjow/phoenix-devenv-template"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/sadjow/phoenix-devenv-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sadjow%2Fphoenix-devenv-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sadjow%2Fphoenix-devenv-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sadjow%2Fphoenix-devenv-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sadjow%2Fphoenix-devenv-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sadjow","download_url":"https://codeload.github.com/sadjow/phoenix-devenv-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sadjow%2Fphoenix-devenv-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32729887,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-07T02:14:30.463Z","status":"ssl_error","status_checked_at":"2026-05-07T02:14:29.405Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beam","development-environment","devenv","direnv","elixir","erlang","nix","nixpkgs","phoenix","phoenix-elixir","phoenix-framework","phoenix-liveview","reproducible-development"],"created_at":"2025-04-07T07:37:23.573Z","updated_at":"2026-05-07T08:37:08.915Z","avatar_url":"https://github.com/sadjow.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Phoenix Devenv Template\n\nA reference implementation and development environment for Phoenix Framework projects using [devenv](https://devenv.sh/) and Nix. This project demonstrates how to use devenv to create a reproducible development environment for Phoenix applications.\n\n## Features\n\n- Latest Phoenix Framework with LiveView support\n- Latest stable Elixir (currently 1.18.3) and Erlang/OTP (currently 27.3)\n- PostgreSQL database pre-configured\n- Node.js for asset compilation\n- Automatic environment activation with direnv (optional but recommended)\n- Zero system-wide installations required (except Nix itself)\n- Consistent developer experience across all platforms (macOS, Linux, WSL)\n- CI integration with GitHub Actions\n- Automated dependency updates with Dependabot\n- Automated weekly dependency updates via GitHub Actions\n- Auto-merge support for dependency PRs\n\n## CI/CD Setup\n\nThis template includes automated workflows:\n\n- **Update devenv** - Weekly updates for devenv lock file (useful for all projects)\n- **Update Phoenix template** - Keeps the template repository up-to-date with latest Phoenix (template repository only - remove this from your projects!)\n\nTo enable all features:\n\n**For new projects (using this template):**\n1. Run: `./scripts/setup-for-projects.sh`\n2. Follow the manual steps in the script output\n\n**For template repository maintainers only:**\n1. Run: `./scripts/setup-template-repo.sh`\n2. Follow the manual steps in the script output\n\nSee [docs/CI_SETUP.md](docs/CI_SETUP.md) for detailed instructions\n\n\n## Prerequisites\n\n- [Nix](https://nixos.org/download.html) package manager\n- [direnv](https://direnv.net/docs/installation.html) for automatic environment activation (optional but recommended)\n\n## Getting Started\n\n1. Click \"Use this template\" to create a new repository based on this template\n2. Clone your new repository\n3. Navigate to the project directory\n4. Run `direnv allow` to activate the environment (if using direnv), or run `devenv shell` manually\n\n```bash\n# After cloning your new repository:\ncd your-project-name\n\n# If using direnv (recommended):\ndirenv allow\n\n# Or manually enter the environment:\ndevenv shell\n```\n\n## Using the Phoenix Application\n\nThis repository includes a pre-generated Phoenix application as a reference.\n\nTo start the Phoenix server:\n\n- Run `mix setup` to install and setup dependencies\n- Start Phoenix endpoint with `mix phx.server` or inside IEx with `iex -S mix phx.server`\n\nNow you can visit [`localhost:4000`](http://localhost:4000) from your browser.\n\n## Creating a New Phoenix Project\n\nYou can use this template as a starting point for new Phoenix projects. If you want to create a completely new Phoenix application:\n\n### Standard Phoenix Application\n\n```bash\nmix phx.new app_name\n```\n\n### Phoenix API-only Application\n\n```bash\nmix phx.new app_name --no-html --no-assets\n```\n\n### Phoenix Application with LiveView\n\n```bash\nmix phx.new app_name --live\n```\n\n## PostgreSQL Configuration\n\nThe PostgreSQL database is pre-configured with the following settings:\n\n- Username: postgres\n- Password: postgres\n- Database: phoenix_dev (for development)\n- Database: phoenix_test (for testing)\n\nTo configure your Phoenix application to use these settings, update the `config/dev.exs` and `config/test.exs` files:\n\n```elixir\n# Configure your database\nconfig :your_app, YourApp.Repo,\n  username: \"postgres\",\n  password: \"postgres\",\n  hostname: \"localhost\",\n  database: \"phoenix_dev\",\n  stacktrace: true,\n  show_sensitive_data_on_connection_error: true,\n  pool_size: 10\n```\n\n## How It Works\n\nThis template uses:\n\n- `devenv.nix` - Defines the development environment with Elixir, Erlang, PostgreSQL, and Node.js\n- `devenv.yaml` - Configures devenv to use nixpkgs-unstable for the latest packages\n- `.envrc` - Configures direnv to use devenv (optional, but provides automatic activation)\n\nThis reference implementation includes all dependencies required for Phoenix development, including:\n\n- PostgreSQL database for data storage\n- Node.js for asset compilation\n- Phoenix CLI for generating new projects\n\n### Why nixpkgs-unstable?\n\nBy default, devenv uses `github:cachix/devenv-nixpkgs/rolling` as its nixpkgs source. However, this template intentionally uses `github:NixOS/nixpkgs/nixpkgs-unstable` for several reasons:\n\n1. **Latest Elixir versions:** The nixpkgs-unstable channel typically includes the most recent versions of Elixir and Erlang soon after they're released. For example, Elixir 1.18.3 was available in nixpkgs-unstable before it appeared in the default devenv nixpkgs.\n\n2. **Broader package selection:** Access to the complete set of packages in the main nixpkgs repository, which may be useful when adding dependencies to your project.\n\n3. **Community updates:** The main nixpkgs repository receives more frequent updates for language-specific packages from the broader Nix community.\n\nThis approach prioritizes having the latest language features over the potential stability benefits of the default channel. For most Elixir development, this trade-off is worthwhile as it provides access to the newest language capabilities.\n\n#### Alternative Approach\n\nIf you encounter issues with our direct method (replacing the nixpkgs source in devenv.yaml), you can follow the [official devenv approach](https://devenv.sh/common-patterns/#getting-a-recent-version-of-a-package-from-nixpkgs-unstable) for using packages from nixpkgs-unstable:\n\n1. Keep the default nixpkgs source and add nixpkgs-unstable as an additional input in `devenv.yaml`:\n\n   ```yaml\n   inputs:\n     nixpkgs:\n       url: github:cachix/devenv-nixpkgs/rolling\n     nixpkgs-unstable:\n       url: github:nixos/nixpkgs/nixpkgs-unstable\n   ```\n\n2. Use the unstable package in `devenv.nix`:\n\n   ```nix\n   { pkgs, inputs, ... }:\n   let\n     pkgs-unstable = import inputs.nixpkgs-unstable { system = pkgs.stdenv.system; };\n   in\n   {\n     languages.elixir = {\n       enable = true;\n       package = pkgs-unstable.beam.packages.erlang_27.elixir;\n     };\n     languages.erlang.enable = true;\n   }\n   ```\n\nThis method keeps the stability benefits of the default devenv nixpkgs for most packages while still allowing specific access to newer versions from unstable when needed.\n\nFor more information:\n\n- [Devenv documentation on using nixpkgs-unstable](https://devenv.sh/common-patterns/#getting-a-recent-version-of-a-package-from-nixpkgs-unstable)\n- [Discussion about package versioning in Nix](https://github.com/NixOS/nixpkgs/issues/93327)\n- [NixOS search for Elixir packages](https://search.nixos.org/packages?channel=unstable\u0026query=elixir)\n\n## CI Setup\n\nThis template includes GitHub Actions workflows for continuous integration:\n\n- **CI workflow**: Automatically tests that the development environment builds correctly on every push and pull request\n  - Tests on both Ubuntu and macOS to ensure cross-platform compatibility\n- **Dependency updates**: A scheduled workflow that automatically updates Nix dependencies and creates a pull request with the changes\n- **Phoenix updates**: A scheduled workflow that checks for new Phoenix versions and updates the reference implementation\n- **Dependabot**: Keeps GitHub Actions dependencies up-to-date with weekly checks\n\nThese workflows ensure that your development environment remains stable, well-formatted, and up-to-date with minimal manual intervention.\n\n## Customizing\n\n### Adding dependencies\n\nTo add additional packages to your environment, modify the `devenv.nix` file:\n\n```nix\n{ pkgs, ... }:\n\n{\n  packages = [\n    pkgs.pre-commit\n    pkgs.nodejs_20\n    pkgs.postgresql\n    # Add more packages here\n  ];\n\n  languages.elixir = {\n    enable = true;\n    package = pkgs.beam.packages.erlang_27.elixir_1_18 or pkgs.elixir;\n  };\n  languages.erlang.enable = true;\n\n  # Enable PostgreSQL service\n  services.postgres = {\n    enable = true;\n    package = pkgs.postgresql_16;\n    initialDatabases = [ { name = \"phoenix_devenv_dev\"; } ];\n    initialScript = \"CREATE ROLE postgres WITH LOGIN PASSWORD 'postgres' CREATEDB;\";\n  };\n\n  # Other configuration...\n}\n```\n\n### Using a specific Elixir version\n\nIf you need a specific version of Elixir, modify the package line in `devenv.nix`:\n\n```nix\nlanguages.elixir = {\n  enable = true;\n  package = pkgs.beam.packages.erlang_27.elixir_1_17;\n};\n```\n\n## Learn More About Phoenix\n\n- Official website: [https://www.phoenixframework.org/](https://www.phoenixframework.org/)\n- Guides: [https://hexdocs.pm/phoenix/overview.html](https://hexdocs.pm/phoenix/overview.html)\n- Docs: [https://hexdocs.pm/phoenix](https://hexdocs.pm/phoenix)\n- Forum: [https://elixirforum.com/c/phoenix-forum](https://elixirforum.com/c/phoenix-forum)\n- Source: [https://github.com/phoenixframework/phoenix](https://github.com/phoenixframework/phoenix)\n\n## Deploying Phoenix Applications\n\nThis template focuses on the development environment. For production deployments, consider:\n\n- [Fly.io](https://fly.io/docs/elixir/getting-started/) - Easy deployment for Phoenix apps\n- [Gigalixir](https://gigalixir.com/) - PaaS designed for Elixir\n- [Render](https://render.com/docs/deploy-phoenix) - Cloud hosting with PostgreSQL support\n- [Releases with Elixir](https://hexdocs.pm/phoenix/releases.html) - For custom deployment options\n\n## Contributing\n\nContributions are welcome! Feel free to open an issue or submit a pull request.\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsadjow%2Fphoenix-devenv-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsadjow%2Fphoenix-devenv-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsadjow%2Fphoenix-devenv-template/lists"}