Skip to content

Null-logic-0/sendit

Repository files navigation

Sendit

A real-time Chat web application built with Elixir and the Phoenix LiveView framework, featuring user authentication, email delivery via Brevo, and a production-ready Docker + Fly.io deployment pipeline.


Overview

Sendit is a Phoenix 1.8 LiveView application that provides a modern, reactive user experience without writing custom JavaScript. It ships with:

  • Full authentication — registration, login, session management, and email confirmation powered by phx.gen.auth
  • Transactional email — sent via the Brevo API
  • Real-time UI — LiveView streams for efficient, low-latency DOM updates
  • Tailwind CSS v4 — utility-first styling with no tailwind.config.js required
  • PostgreSQL — backed by Ecto for safe, schema-driven database access
  • Docker & Fly.io — production-grade containerization and one-command deploys

Demo

0518.mp4

Tech Stack

Layer Technology
Language Elixir ~> 1.15
Web Framework Phoenix 1.8.5
Frontend Phoenix LiveView 1.1, Tailwind CSS v4, esbuild
Database PostgreSQL (via Ecto + Postgrex)
Email Brevo API, gen_smtp, Swoosh
HTTP Client Req
Auth bcrypt_elixir, phx.gen.auth
Server Bandit
Container Docker (Debian Trixie slim)
Hosting Fly.io

Prerequisites

  • Elixir >= 1.15Install guide
  • Erlang/OTP >= 26
  • Node.js >= 18 (for asset bundling)
  • PostgreSQL >= 14
  • A Brevo account and API key for email delivery

Getting Started

1. Clone the repository

git clone https://github.com/Null-logic-0/sendit.git
cd sendit

2. Install dependencies and set up the database

mix setup

This single command will:

  • Fetch all Elixir and Node.js dependencies
  • Create and migrate the PostgreSQL database
  • Seed initial data
  • Install and build frontend assets (Tailwind + esbuild)

3. Start the development server

mix phx.server

Or start inside an interactive IEx session:

iex -S mix phx.server

The application will be available at http://localhost:4000.


Configuration

Environment-specific configuration lives in the config/ directory:

File Purpose
config/config.exs Shared compile-time configuration
config/dev.exs Development settings
config/test.exs Test settings
config/runtime.exs Runtime/production environment variables

For production, set the following environment variables:

DATABASE_URL=ecto://user:password@host/sendit
SECRET_KEY_BASE=<64-character secret>
PHX_HOST=yourdomain.com
BREVO_API_KEY=re_xxxxxxxxxxxx

Generate a secret key with:

mix phx.gen.secret

Running Tests

mix test

To run only previously failing tests:

mix test --failed

To run a specific test file:

mix test test/sendit_web/live/some_live_test.exs

Before committing, run the full pre-commit suite (compile, format, unused deps check, and tests):

mix precommit

Deployment

Docker

Build the production image:

docker build -t sendit .

Run the container:

docker run -e DATABASE_URL=... -e SECRET_KEY_BASE=... -e PHX_HOST=... -p 4000:4000 sendit

Fly.io

The repository includes a fly.toml configuration. Deploy with:

fly deploy

Set secrets on Fly.io:

fly secrets set SECRET_KEY_BASE=$(mix phx.gen.secret)
fly secrets set DATABASE_URL=ecto://...
fly secrets set BREVO_API_KEY=re_...

Project Structure

sendit/
├── assets/            # Frontend assets (JS, CSS)
├── config/            # Application configuration
├── lib/
│   ├── sendit/        # Core business logic and contexts
│   └── sendit_web/    # Web layer (LiveViews, controllers, components, router)
├── priv/
│   ├── repo/          # Database migrations and seeds
│   └── static/        # Compiled static assets
├── test/              # ExUnit test suite
├── rel/               # Release configuration
├── Dockerfile         # Multi-stage production Docker build
├── fly.toml           # Fly.io deployment configuration
├── mix.exs            # Project definition and dependencies

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature-name
  3. Make your changes and run mix precommit to ensure everything passes
  4. Commit your changes: git commit -m "feat: describe your change"
  5. Push to your fork: git push origin feature/your-feature-name
  6. Open a Pull Request

Code Style

  • Elixir code is formatted with mix format — enforced by the pre-commit alias
  • Tailwind CSS classes are used for all styling; @apply is not used
  • LiveView streams are preferred over plain list assigns for collections

License

This project is licensed under the MIT License.