This repository is a general-purpose Elixir project template designed to help you quickly start new projects. It includes essential configurations and Docker support.
- Basic Elixir setup with recommendations for commonly used dependencies.
- Docker support for running the application in an isolated environment.
- Dev Container for a fully configured, consistent development environment.
- Linting, documentation generation, and optional performance testing setup.
This project includes a set of tools to ensure code quality and consistency. These tools are configured to run automatically on save, giving you immediate feedback as you work.
- Code formatting with Elixir Formatter
It ensures any code follows a consistent style. The Elixir Formatter is set to run automatically on save, formatting your code to follow standard Elixir conventions.
The .formatter.exs file controls settings, and auto-formatting is enabled in .vscode/settings.json.
- Linting with Credo
It enforces best practices and code consistency by highlighting potential readability and maintainability issues. Credo runs automatically on save through ElixirLS, displaying warnings and suggestions directly in the editor. You can also run mix credo
in the terminal for a complete linting check.
- Type Checking and Error Reporting with Dialyzer
It analyzes code for type errors and potential bugs, offering an additional layer of safety. Dialyzer is integrated with ElixirLS, running in the background and reporting issues as you work. The initial setup may take a few minutes, as it builds a PLT (Persistent Lookup Table) with necessary type information.
- Docker (for running containers)
- Visual Studio Code
- Dev Containers extension
If using Visual Studio Code, elixir-kickoff provides a fully configured devcontainer environment. This setup ensures that all necessary tools (Elixir, Erlang, Hex, Rebar) are installed and available without any additional local setup.
- Open the project in VS Code.
- You should see a prompt: "Reopen in Container". Select it to open the project in the Dev Container. Alternatively, open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P) and search for
Remote-Containers: Reopen in Container
. - Once inside the container, install dependencies and run the application:
mix deps.get
mix run --no-halt
The Dev Container uses a pre-built Docker image for faster setup and consistent environments across all sessions. The image is hosted on GitHub Container Registry at ghcr.io/elixir-journey/elixir-kickoff:latest.
Extensions: The following VS Code extensions are automatically installed:
- Elixir Language Server (Elixir LS)
- Docker
- GitLens
- Spell Checker
- Prettier (for code formatting)
- Material Icon Theme
You can modify the .devcontainer/devcontainer.json file to add extensions or dependencies.
If you’re not using devcontainers, you must have Elixir and Erlang installed locally. After installation, follow the same setup steps as above to fetch dependencies and start the application.
The repository includes a Dockerfile that allows you to run the application in a container.
- Build the Docker image
docker build -t elixir-kickoff .
- Run the container
docker run elixir-kickoff
This project uses an .editorconfig file to ensure consistent coding standards across different editors and environments. The .editorconfig file helps maintain consistent formatting for:
- Indentation: Spaces with a width of 4.
- Line endings: LF (Line Feed) for cross-platform compatibility.
- Trimming trailing whitespace and final newline insertion for cleaner diffs.
If you’re using Visual Studio Code or another modern editor, the settings will be applied automatically if you have EditorConfig support. The VS Code Dev Container setup includes this support by default, so no extra setup is needed.
- Environment Variables: Use .env files to manage environment variables. Make sure they are listed in .gitignore to keep sensitive information secure.
- Linting and Formatting: Run Credo for linting and mix format to ensure code consistency. Contributing
Feel free to submit a pull request or open an issue if you have improvement suggestions.