Thank you for your interest in contributing to PhoenixKit! This guide will help you set up a development environment and understand our contribution process.
To contribute to PhoenixKit, you'll need to set up a local development environment:
-
Fork the Repository: Fork PhoenixKit on GitHub to your account
- Important: Uncheck "Copy the
mainbranch only" to get all branches includingdev
- Important: Uncheck "Copy the
-
Clone Your Fork:
git clone git@github.com:yourusername/phoenix_kit.git- Create a Development Phoenix App: Set up a Phoenix application for testing your PhoenixKit changes: Make sure you have latest Elixir Phoenix Framework.
mix archive.install hex phx_newThen create a new Phoenix app adjacent to your phoenix_kit directory.
mix phx.new your_app_name # Choose any name for your development app
cd your_app_name- Configure Local Dependency: Update your development app's
mix.exsto use your local PhoenixKit:
defp deps do
[
{:phoenix_kit, path: "../phoenix_kit"},
{:igniter, "~> 0.7"}, # Required for phoenix_kit.install task
# ... other Phoenix dependencies
]
end- Install Dependencies:
mix deps.get
mix ecto.create- Run PhoenixKit Installation:
mix phoenix_kit.install- Configure Tailwind CSS: Update your
assets/css/app.cssto point to your local PhoenixKit git clone. Find the@sourcedirectives section and replace the phoenix_kit deps path:
@import "tailwindcss" source(none);
@source "../css";
@source "../js";
@source "../../lib/your_app_web";
/* Replace the auto-generated deps path with your local path */
@source "../../../phoenix_kit"; /* was: @source "../../deps/phoenix_kit"; */This replaces the default deps folder path with your local phoenix_kit development folder, ensuring Tailwind processes your local changes.
- Rebuild and deploy assets:
mix assets.build
mix assets.deploy- Start Your Development Server:
mix phx.serverYou can now visit http://localhost:4000 to see your development app running with PhoenixKit, and you can visit PhoenixKit powered pages:
- http://localhost:4000{prefix}/users/register (first registered user will become admin and a product owner)
- http://localhost:4000{prefix}/users/log-in (you should be able to login)
- http://localhost:4000{prefix}/admin (and access phoenix_kit admin panel)
Keep in mind, that any changes you make to files in the phoenix_kit directory will require manually running mix deps.compile phoenix_kit --force and refreshing your browser to see the changes, so let's configure live reloading for a better development experience.
- Configure Live Reloading: To enable automatic hot reloading that detects changes and recompiles automatically, configure Phoenix's built-in systems:
Note: The following configuration is added to your Phoenix development project (not in the phoenix_kit directory).
10.1. Configure your Endpoint:
Edit your config/dev.exs file, and find your Endpoint configuration, which starts something like this:
config :your_app, YourAppWeb.Endpoint,
And inside of Endpoint configuration, just before watchers list, add these 2 lines (and don't forget to change :your_app)
reloadable_apps: [:your_app, :phoenix_kit],
reload_lib_dirs: ["lib", "../phoenix_kit/lib"],10.2. Configure Phoenix LiveReloader to watch the phoenix_kit library:
Just below Endpoint configuration, in your config/dev.exs file add:
config :phoenix_live_reload, :dirs, ["", "../phoenix_kit"]Find live_reload configuration and add extra line to patterns list:
~r"../phoenix_kit/lib/.*\.(ex|heex)$"So, live_reload configration should look like this:
# Watch static and templates for browser reloading.
config :pk_test, PkTestWeb.Endpoint,
live_reload: [
web_console_logger: true,
patterns: [
~r"priv/static/(?!uploads/).*(js|css|png|jpeg|jpg|gif|svg)$",
~r"priv/gettext/.*(po)$",
~r"lib/pk_test_web/(?:controllers|live|components|router)/?.*\.(ex|heex)$",
~r"../phoenix_kit/lib/.*\.(ex|heex)$"
]
]10.3. Restart your Phoenix app:
Ctrl+C couple of times to break out from running app and start your app again:
# In your development project directory
mix phx.serverHow it works:
- When you edit phoenix_kit files, Phoenix.LiveReloader detects changes and triggers browser refresh
- During the refresh request, Phoenix.CodeReloader automatically recompiles changed files
- You see updated code immediately without manual recompilation
PhoenixKit uses GitHub Actions for automated testing and quality checks. Every push and pull request triggers the CI pipeline.
The following checks must pass before your PR can be merged:
-
Code Formatting
mix format --check-formatted
Ensures code follows Elixir formatting standards.
-
Static Analysis (Credo)
mix credo --strict
Checks for code quality, consistency, and potential issues.
-
Type Checking (Dialyzer)
mix dialyzer
Performs static type analysis to catch type errors.
-
Test Suite
mix testRuns all tests with PostgreSQL database. Tests must pass without errors.
-
Compilation Warnings
mix compile --warnings-as-errors
Ensures code compiles without warnings.
-
Dependency Audit
mix deps.unlock --check-unused
Verifies no unused dependencies.
Before pushing your changes, run these commands locally to catch issues early:
# Format code
mix format
# Run quality checks
mix credo --strict
# Run tests (if database is configured)
mix test
# Compile with warnings as errors
mix compile --force --warnings-as-errors
# Or run all quality checks at once
mix quality- Triggers: Runs on push to
main,dev, andclaude/**branches, and on all pull requests - Parallel Execution: Different checks run in parallel for faster feedback
- Caching: Dependencies and PLT files are cached to speed up subsequent runs
- Coverage: Test coverage is automatically reported to Codecov
- In Pull Requests: CI status appears at the bottom of your PR
- GitHub Actions Tab: View detailed logs at https://github.com/BeamLabEU/phoenix_kit/actions
- Status Badges: Check README.md for current build status
If CI fails on your PR:
- Check the logs: Click "Details" next to the failed check
- Reproduce locally: Run the failing command on your machine
- Fix and push: Commit the fix and push - CI will re-run automatically
- Ask for help: If stuck, comment on your PR for assistance
Once you have your development environment set up with live reloading, follow these steps to contribute:
- Switch to dev branch:
git checkout dev-
Make your changes in the
phoenix_kitdirectory - you'll see them live in your browser, if live reloading setup was done correctly. -
Commit and push your changes:
git add file_you_changed
git commit
git push dev- Create Pull Request:
- After pushing, you'll see a banner on GitHub indicating that your branch is ahead of the main repository
- Click "Contribute" and then "Open a pull request"
- GitHub will show the differences between your fork and the main repository
- Click "Create pull request"
- Enter a title and description of your changes
- Ensure the base branch is set to
BeamLabEU/phoenix_kit:dev(not main) - Click "Create pull request" to submit