This is an example application that shows how to use Cowboy 1.1 in conjunction with React and Redux to create data driven Single Page Applications.
This project has been developed using the following technologies:
This repository contains the source code of a Todo list web application that pretends to serve as a mid size example to learn how to build modern SPAs with Elixir (not Phoenix) and React. In this project you will find how to implement important features and services such as:
- Anonymous authentication (encoding and signing user with JWT)
- RESTful JSON API (Cowboy REST handlers)
- Serve static files (Cowboy static handler)
- Authorization (decoding and verifying JWT)
- Data modeling and persistency (Ecto + PostgreSQL)
- Component based SPA (React)
- Application state management (Redux)
- Async operations handling (Redux Saga)
Demo available here.
To start this application locally:
- Make sure you have installed Elixir, Erlang, Node, Yarn and PostgreSQL
- Install the Mix dependencies:
$ mix deps.get
- Create and migrate the development database:
$ mix ecto.setup
- Start the application with all its dependencies:
$ iex -S mix
- Install the Node packages
$ cd client/ && yarn install
- Start the web development server:
$ yarn start
To build the JavaScript application for production:
- In the client directory, run
$ yarn build
To generate a release for production:
- Execute the mix release task with the MIX_ENV variable set to production:
MIX_ENV=prod mix release --env=prod