A demo of an Internet-of-Things application, where both the frontend and backend are written in Elm.
The server, to be installed on a Raspberry Pi, controls a SparkFun RGB Rotary Encoder.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a Raspberry Pi.
- Node.js (latest version)
- Yarn (as a dependency manager, rather than NPM)
- Clone this project to a folder on your local machine, e.g.
~/elm-server-raspi
- Inside the folder, do
yarn install --ignore-optional
to install necessary dependencies (except for those specific to Raspberry Pi). - Update the server's Websocket url in
/webpack/client.dev.js
. - To run the client locally with
webpack-dev-server
, doyarn ui:start
. The client will be available atlocalhost:2000
. - To build a live compressed version of the client, do
yarn ui:build
. The built client can be found indist/ui
. - To compile the Elm server to JavaScript, do
yarn api:build
. The build server can be found indist/api/elm-server.js
.
- The scripts in
package.json
assumes that the Raspberry Pi is available in the same network atpi@raspi
. - Do
yarn ui:deploy
to build the client and deploy it in/var/www/html
on the Raspberry Pi. - Do
yarn api:deploy
to build the Elm server intoelm-server.js
and deploy to the Raspberry Pi. - On the Raspberry Pi, run
sudo node elm-server.js
(sudo
is required) to start the server.
This project is licensed under the MIT License - see the LICENSE file for details
- elm-collage - Elm vector graphics library
- elm-web-server - An API with Node.js-bindings for Elm WebSocket/HTTP-servers
- elm-webpack-loader - Webpack loader for the Elm language