A production-ready Elixir project template with best practices baked in.
- Quality tooling: Credo with strict checks, ExCoveralls for test coverage
- CI/CD ready: GitHub Actions workflow with formatting, linting, tests, and coverage
- 100% test coverage: Configured with strict coverage requirements
- Modern Elixir: Set up for Elixir 1.17+ and OTP 27
- Nix support: Includes flake.nix for reproducible development environments
# Clone template
git clone ~/dev/projects/_templates/elixir my_project
cd my_project
# Replace placeholders
./setup.sh my_app MyApp "My App Description"
# Or manually replace:
# - {{app_name}} → your_app (snake_case)
# - {{module_name}} → YourApp (PascalCase)
# - {{description}} → Your project description.credo.exs- Production-grade linting rules.formatter.exs- Code formatting (120 char line length)coveralls.json- 100% test coverage requirement.gitignore- Standard Elixir + Nix ignores
.github/workflows/ci.yml- Complete CI pipeline- Format checking
- Credo linting (strict mode)
- Compilation with warnings-as-errors
- Test execution
- Coverage reporting
├── .github/workflows/
│ └── ci.yml
├── config/
│ ├── config.exs
│ └── test.exs
├── lib/
│ └── {{app_name}}.ex
├── test/
│ ├── {{app_name}}_test.exs
│ └── test_helper.exs
├── .credo.exs
├── .formatter.exs
├── .gitignore
├── coveralls.json
├── mix.exs
└── flake.nix
The setup.sh script automates placeholder replacement:
./setup.sh <app_name> <ModuleName> "Description"Example:
./setup.sh my_api MyApi "A REST API service"If you prefer manual setup:
- Replace
{{app_name}}with your app name (snake_case) - Replace
{{module_name}}with your module name (PascalCase) - Replace
{{description}}with your project description - Update dependencies in
mix.exsas needed - Remove template README and create your own
Files to update:
mix.exslib/{{app_name}}.ex(rename file)test/{{app_name}}_test.exs(rename file)config/config.exs(if using app-specific config)
# Get dependencies
mix deps.get
# Run tests
mix test
# Run linting
mix credo --strict
# Check formatting
mix format --check-formatted
# Run coverage
mix coverallsThe template includes a GitHub Actions workflow that runs on push and PR:
- Format checking
- Credo linting (strict mode)
- Compilation with warnings-as-errors
- Tests
- Coverage reporting
Edit coveralls.json:
{
"coverage_options": {
"minimum_coverage": 90 // Change from 100
}
}Edit .credo.exs to enable/disable specific checks in the enabled or disabled lists.
Common additions:
# Web framework
{:plug_cowboy, "~> 2.7"},
# Database
{:ecto_sql, "~> 3.12"},
{:postgrex, ">= 0.0.0"},
# JSON
{:jason, "~> 1.4"}This template is provided as-is for use in your projects.