A production-ready Elixir starter template with Phoenix Framework, ready for deployment. Perfect for building scalable web applications and APIs.
- Elixir 1.15+ (Install via asdf or official installer)
- PostgreSQL 14+
- Node.js 18+ (for assets)
- Git
# 1. Clone the repository
git clone https://github.com/Solomonkassa/elixir-starter-kit.git
cd elixir-starter-kit
# 2. Setup environment
cp .env.example .env
# Edit .env with your database credentials
# 3. Setup dependencies
mix setup
# 4. Start the application
mix phx.serverVisit http://localhost:4000 to see your application running.
- Phoenix 1.7 with LiveView
- Clean Domain-Driven Design (DDD) structure
- Context-based business logic organization
- API-first design with REST & GraphQL support
- Built-in authentication (User, Admin)
- OAuth2 support (Google, GitHub)
- Role-based authorization (RBAC)
- SSL/TLS ready
- CSRF, XSS, CORS protection
- Live reload with Phoenix
- Interactive IEx shell with helpers
- Code formatting (mix format)
- Static analysis (Credo, Dialyzer)
- Git hooks for quality checks
- PostgreSQL with Ecto
- Database seeding
- Migrations with rollback support
- Query optimization (Ecto.Query)
- Soft deletes with
deleted_at
- Unit tests (ExUnit)
- Integration tests
- Property-based testing (StreamData)
- Test coverage (ExCoveralls)
- CI/CD ready
elixir-starter-kit/
βββ lib/
β βββ starter/ # Application core
β β βββ accounts/ # User/Account management
β β βββ blog/ # Blog module example
β β βββ core/ # Shared utilities
β β βββ web/ # Web interface (controllers, views)
β β βββ controllers/ # REST controllers
β β βββ live/ # LiveView components
β β βββ views/ # View modules
β βββ starter_web.ex # Web endpoint
βββ test/ # Test suite
βββ assets/ # Frontend assets (JS, CSS)
βββ priv/repo/ # Database migrations
βββ config/ # Configuration
# Start development server
mix phx.server
# Run tests
mix test
mix test.watch # Watch mode
# Code quality
mix format # Format code
mix credo # Static analysis
mix dialyzer # Type checking
# Database
mix ecto.setup # Create, migrate, seed
mix ecto.migrate
mix ecto.rollback
mix ecto.reset # Reset database
# Dependencies
mix deps.get # Get dependencies
mix deps.update # Update dependencies
# Production
mix release # Create release
MIX_ENV=prod mix phx.server # Production modeGET /api/v1/posts # List posts
POST /api/v1/posts # Create post
GET /api/v1/posts/:id # Get post
PUT /api/v1/posts/:id # Update post
DELETE /api/v1/posts/:id # Delete post
POST /api/v1/auth/register # Register user
POST /api/v1/auth/login # Login
POST /api/v1/auth/logout # Logout
GET /api/v1/auth/me # Current user
POST /api/graphql # GraphQL endpoint
GET /api/graphiql # GraphQL playground
-- Users table
CREATE TABLE users (
id UUID PRIMARY KEY,
email VARCHAR(255) UNIQUE NOT NULL,
name VARCHAR(255),
role VARCHAR(50) DEFAULT 'user',
inserted_at TIMESTAMP,
updated_at TIMESTAMP
);
-- Posts table (example)
CREATE TABLE posts (
id UUID PRIMARY KEY,
title VARCHAR(500) NOT NULL,
content TEXT,
user_id UUID REFERENCES users(id),
published_at TIMESTAMP,
inserted_at TIMESTAMP,
updated_at TIMESTAMP
);# Build and run with Docker Compose
docker-compose up --build
# Or with Docker
docker build -t elixir-starter .
docker run -p 4000:4000 elixir-starter# Install Fly CLI
fly auth login
# Deploy
fly launch
fly deploy# Create Heroku app
heroku create your-app-name
# Add buildpacks
heroku buildpacks:add https://github.com/HashNuke/heroku-buildpack-elixir
heroku buildpacks:add https://github.com/gjaldon/heroku-buildpack-phoenix-static
# Deploy
git push heroku main# Install Gigalixir CLI
pip install gigalixir --user
# Create app
gigalixir create
# Set config
gigalixir config:set POOL_SIZE=2
# Deploy
git push gigalixir main- Prometheus metrics endpoint (
/metrics) - Health checks (
/health) - Request logging
- Error tracking
- Sentry for error reporting
- AppSignal for performance monitoring
- Logflare for log management
- Datadog for APM
# Required
DATABASE_URL=postgresql://user:pass@localhost:5432/db_name
SECRET_KEY_BASE=your-secret-key-base
# Optional
PORT=4000
HOSTNAME=localhost
POOL_SIZE=10
SENTRY_DSN=your-sentry-dsnEdit config/runtime.exs for production settings:
config :starter, StarterWeb.Endpoint,
url: [host: System.get_env("HOSTNAME"), port: 443],
http: [port: {:system, "PORT"}],
secret_key_base: System.get_env("SECRET_KEY_BASE")- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow the Elixir Style Guide
- Write tests for new features
- Update documentation
- Use conventional commits
MIT License - see LICENSE file for details.
- Phoenix Framework team
- Elixir community
- All contributors and users
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: support@example.com
Happy coding with Elixir! π
# Setup
mix setup
# Development
mix phx.server
mix test
# Code Quality
mix format
mix credo
# Database
mix ecto.migrate
mix ecto.reset
# Production
mix release
mix phx.server --env prod