https://github.com/s-damian/phoenix-crud-example
CRUD - Phoenix Framework / Elixir / MySQL / Tailwind
https://github.com/s-damian/phoenix-crud-example
crud elixir elixir-phoenix mariadb mysql phoenix phoenix-framework tailwindcss
Last synced: 9 months ago
JSON representation
CRUD - Phoenix Framework / Elixir / MySQL / Tailwind
- Host: GitHub
- URL: https://github.com/s-damian/phoenix-crud-example
- Owner: s-damian
- Created: 2023-01-14T19:13:12.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-28T13:52:36.000Z (over 3 years ago)
- Last Synced: 2025-04-04T10:11:12.281Z (about 1 year ago)
- Topics: crud, elixir, elixir-phoenix, mariadb, mysql, phoenix, phoenix-framework, tailwindcss
- Language: JavaScript
- Homepage:
- Size: 363 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Example of CRUD with Phoenix 1.7 / Elixir
This example is made by [Stephen Damian](https://github.com/s-damian)
## Requirements
* Elixir >= 1.14
* Erlang >= 24
## Introduction
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).
## Configuration - Phoenix App
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
```
## You can run the server, and you can run these demo URLs
### Run the server
```
mix phx.server
```
Here is an example of Virtual Host (Reverse Proxy) with Nginx: [Nginx Vhost for Phoenix](https://github.com/s-damian/phoenix-crud-example/blob/main/_nginx/vhost-example.conf)
### Run demo URLs
#### For example of an articles controller (for an HTML resource)
* http://127.0.0.1:4000/articles
* http://127.0.0.1:4000/articles/new
#### For example of a products controller (for LiveView)
* http://127.0.0.1:4000/products
* http://127.0.0.1:4000/products/new
And you can **Create** / **Read** (listing or show a single article) / **Update** / **Delete** articles.