Elixir-journey / elixir-kickoff

Starter template for building robust Elixir projects with essential tooling, containerized environments, and code documentation for fast and consistent development.
MIT License
0 stars 0 forks source link
devexperience elixir-lang template-project

Elixir kickoff

Build Status Code Style License

This repository is a general-purpose Elixir project template designed to help you quickly start new projects. It includes essential configurations and Docker support.

Features

Getting Started

Development Setup

Auto-Formatting, Linting, and Error Reporting

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.

  1. 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.

  1. 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.

  1. 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.

Development with devcontainers

Requirements

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.

  1. Open the project in VS Code.
  2. 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.
  3. Once inside the container, install dependencies and run the application:
mix deps.get
mix run --no-halt

Customization and Configuration

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:

You can modify the .devcontainer/devcontainer.json file to add extensions or dependencies.

Running without devcontainers

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.

Using Docker

The repository includes a Dockerfile that allows you to run the application in a container.

  1. Build the Docker image
docker build -t elixir-kickoff .
  1. Run the container
docker run elixir-kickoff

Code style & editor configuration

This project uses an .editorconfig file to ensure consistent coding standards across different editors and environments. The .editorconfig file helps maintain consistent formatting for:

How It Works

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.

Development Notes

Contributing

Feel free to submit a pull request or open an issue if you have improvement suggestions.