Lumiere is a platform for community-controlled holiday lighting.
The API is the central source of what the lights should be, and includes a number of ways to change the lights:
- REST API
- JSON endpoint
- Twilio endpoint for texting colors as well as images to (includes image support)
- Websocket support (via socket.io)
REST API
/lights
: Current stack of lights that have been provided./lights
(POST): Update lights./lights/current
: Get the currently set lights./lights/twilio
(POST): Twilio test or image payload./colors
: Get current list of all colors (note that this will be large)
Websocket
- Utilizes socket.io.
- Event
lights:get
: Sends back current lights.
Configuration is managed in environment variables. These can managed in a .env
file.
NODE_ENV
: Standard environment variable,development
orproduction
PORT
: Port to run the application on. Defaults to3333
.PROXIES
: Used for the rate-limiter, specifies the number of internal proxies such as a load-balancer. Probably 0 or 1.TWILIO_ACCOUNT_SID
TWILIO_AUTH_TOKEN
TWILIO_PHONE_NUMBER
MAX_LIGHTS_STORE
: The maximum number of lights to keep (in memory); defaults to100
.
For local testing:
npm install twilio-cli -g
twilio login
twilio phone-numbers:update "PHONE_NUMBER" --sms-url="http://localhost:PORT/lights/twilio"
- Send message to phone number.
Or you can manually hit the endpoint with something like:
curl --data "Body=blue" -X POST http://localhost:PORT/lights/twilio
See lib/colors/index.js
for color sources.
Some scraping has been done with some real-quick jQuery, in-browser scraping, others require a bit more:
- Pokemon palettes: Run
node lib/colors/collect/pokemon.js
. Note that it will store files in.cache/
.
Deployed wherever a NodeJS app can be deployed with websocket support.
- Create new project in Heroku.
- Setup Heroku CLI and
heroku login
. - Add Heroku remote:
heroku git:remote -a HEROKU_APP_NAME
- Deploy changes:
git push heroku main
- Enable/scale with something like:
heroku ps:scale web=1