This example is made by Stephen Damian
- Elixir >= 1.14
- Erlang >= 24
This is an example of CRUD with: Phoenix Framework / MySQL / Tailwind CSS
In this example, there is :
- An example of an articles controller (for an HTML resource).
- An example of a products controller (for LiveView).
Clone github repository:
git clone git@github.com:s-damian/phoenix-crud-example.git
In terminal, position yourself in the phoenix-crud-example
directory:
cd /your_path/phoenix-crud-example
In config/dev.exs
, configure your database credentials. (For security reasons: in a production context, you must use environment variables. You should never put database credentials directly in the versioned code).
Install dependencies:
mix deps.get
Create the database (MySQL / MariaDB):
mix ecto.create
Run migrations:
mix ecto.migrate
mix phx.server
Here is an example of Virtual Host (Reverse Proxy) with Nginx: Nginx Vhost for Phoenix
And you can Create / Read (listing or show a single article) / Update / Delete articles.