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,developmentorproductionPORT: 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_SIDTWILIO_AUTH_TOKENTWILIO_PHONE_NUMBERMAX_LIGHTS_STORE: The maximum number of lights to keep (in memory); defaults to100.
Run server with:
npm startSome helpful commands for testing:
- Change lights:
curl -X POST -H "Content-Type: application/json" -d '{"source": "local-test", "input": "blue"}' http://localhost:PORT/lights
For local testing:
npm install twilio-cli -gtwilio logintwilio 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
To run tests:
npm testSee 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/. - Pantone colors: Run
node lib/colors/collect/pantone.js
Deployed wherever a NodeJS app can be deployed with websocket support.
- Create new project in Heroku.
- Setup Heroku CLI
- Not suggested, but can use
npx
- Not suggested, but can use
npx heroku login.- Add Heroku remote:
npx heroku git:remote -a HEROKU_APP_NAME - Deploy changes:
git push heroku main - Enable/scale with something like:
npx heroku ps:scale web=1