/phoenix-demo-app

Phoenix demo app with authentication, admin/user scopes and a websocket chat

Primary LanguageElixirGNU General Public License v3.0GPL-3.0

DemoApp

To start this Phoenix application you have to:

  1. Create a database

PostgreSQL:

$ psql -U postgres
create role demo_app login password 'password';
create database demo_app owner demo_app encoding='UTF8' lc_collate='en_US.UTF-8' lc_ctype='en_US.UTF-8';
grant all on database demo_app to demo_app;
alter database demo_app owner to demo_app;
\q

Exercise: adapt this to MySQL. Hint: you need to change the driver in mix.exs and lib/demo_app/repo.ex Google for the driver.

  1. Install dependencies with mix do deps.get, compile

  2. Set the environment variables to access the database (check lib/demo_app/repo.ex)

    export DB_USER=demo_app export DB_PASSWORD=password export DB_HOST=localhost export DB_NAME=demo_app

  3. Run the migrations with mix ecto.migrate Repo

  4. Seed the database with mix run seed.exs

  5. Start Phoenix router with mix phoenix.start

  6. Visit localhost:4000

  7. Login as an admin with admin@example.com / password or login as a user with user@example.com / password.

  8. Follow the instructions inside the pages.

  9. Fork it and make it better!

Deploy on Heroku

I'm working on it. See goshacmd/heroku-buildpack-elixir#13