Skip to content

Latest commit

 

History

History
74 lines (51 loc) · 1.8 KB

README.md

File metadata and controls

74 lines (51 loc) · 1.8 KB

Elixir dApp Template

A dApp clean architecture template that has role-based access control (RBAC) and use case auditing.

Setup

First, install the asdf version manager. Then, add the asdf erlang and asdf elixir plugins.

See .tool-versions for version details.

Once the above are installed, run the following command.

asdf install

Run a PostgreSQL database container (assumes docker is installed).

docker run --rm --name my-postgres -p 5432:5432 -e POSTGRES_PASSWORD=password1 -e POSTGRES_USER=postgres -d postgres

Get deps, create the db, run migrations, and seed the database with sample data.

mix setup

Drop into an interactive shell + start the application.

iex -S mix

Invite / Signup Flow

Get Roles (admin)

curl -s -XGET  -H "x-address: tp18vd8fpwxzck93qlwghaj6arh4p7c5n89x8kska" http://localhost:8888/dapp/v1/roles | jq

Copy the role_id for "User" for creating invite.

Create Invite (admin)

curl -s -XPOST \
  -H "x-address: tp18vd8fpwxzck93qlwghaj6arh4p7c5n89x8kska" \
  -H "content-type: application/json" \
  -d '{"email": "[email protected]", "role_id": FIXME}' \
  http://localhost:8888/dapp/v1/invites | jq

Copy invite_code from response for signup.

Signup

curl -s -XPOST \
  -H "x-address: tp18vd8fpwxzck93qlwghaj6arh4p7c5n89x8kskj" \
  -H "content-type: application/json" \
  -d '{"name": "Jane Doe", "email": "[email protected]", "invite_code": "FIXME"}' \
  http://localhost:8888/dapp/v1/signup | jq

Get Profile

curl -s -XGET  -H "x-address: tp18vd8fpwxzck93qlwghaj6arh4p7c5n89x8kskj" http://localhost:8888/dapp/v1/users/profile | jq