Twilio Barista is an application that allows you to solve the problem of long queues at barista stands at events. Attendees can order their coffee via various Twilio-powered channels, baristas get all orders on a website that can be loaded via a tablet and once an order is done the attendee will be notified via the system to come and pick it up. No more queueing and efficient coffee
If you want to learn more about how this has been built, check out the following blog posts:
- Serving Coffee with Twilio Programmable SMS and React
- Building an Intelligent Coffee Order System with Twilio Autopilot
Different versions of this system have been used at events such as:
You can find previous versions or implementations in other languages here:
"Lite" with React
More information on how it works is in the documentation.
- Receive orders using Twilio Messaging
- Store orders and real-time synchronization them between back-end and front-end using Twilio Sync
- Easy dynamic application configuration using Twilio Sync
- Dynamic phone number acquisition/configuration using the Twilio REST API
- Sending bulk notifications to different user segments on different channels using Twilio Notify
- Permission management based on Twilio Sync
- Top PWA support thanks to Preact CLI based front-end
- Easy way to reset the application from the admin interface
- Query for location in the queue as well as canceling the order as a user
The current Twilio Channels are:
0. Know your Twilio Account SID
Retrieve your Twilio Account SID from the Twilio Console.
1. Generate a Twilio API Key and Secret
2. Create a Messaging Service
Create a Messaging Service in the Twilio Console and store the SID.
3. Create a Notify Service
Create a Notify Service in the Twilio Console and choose your created Messaging Service as a Messaging Service. Make sure to store the SID.
4. Create a Sync Service
Create a Sync Service in the Twilio Console, check the "ACL Enabled" enabled box, and store the SID.
Deploy via Heroku
Simply click the button below, add the respective configuration values.
Go afterwards in the
/admin section and click the Setup button. This will configure everything for you and you are ready to add phone numbers for the service.
1. Clone project and install dependencies
git clone email@example.com:twilio-labs/twilio-barista.git cd twilio-barista npm install
2. Configure environment variables
The following environment variables are necessary for Twilio Barista:
PHONE_NUMBER_HASHING_SECRET- This will be used to generate internal identities based on the phone number
LOGINS- Semi-colon separated list based on the following schema:
username,password,role. Available roles are:
barista- Enables you to see all orders but nothing else
admin- Can see and write all data
PORT- Optional. By default it will run on port
a) For development
.env.example file into a
.env file. And set the respective values in the file.
b) For production
Set the environment variables based on your operating system or hosting provider.
3. Initially build your front-end
After you cloned the project and installed the dependencies, you have to do an intial build of the front-end. Run the following command to do so:
npm run build
4. Start up server
a) Automatic detection of environment
NODE_ENV is set to
production the server will automatically start in production mode else it will load the
.env file for the variables using node-env-run.
b) Explicit development mode
npm run start:dev
c) Explicit production mode
npm run start:prod
d) Start in watch mode for automatic reloading of front-end or back-end
npm run dev
5. Setup application
Navigate to your deployment on an externally available URL. If you are hosting for testing on your localhost you should use ngrok to create a tunnel.
Authenticate with an admin user, go into the Admin section and under Other click the Setup button. This will configure the rest.
6. Acquire phone numbers
Choose in the Admin section under Other a country that you want a phone number from and click acquire. It will purchase the number, configure it and you can see it in the Configuration section of your Admin part under
7. You are ready for some
You are all set. People can start sending in messages to those numbers and you will receive them in the order section of your interface.
The project is split up into three sections on the top level. The
client directory contains all front-end related code and has been bootstrapped with the Preact CLI. The
server directory contains anything backend related and is powered by Express. The
shared folder contains any code that is being used by both parts of the project.
There is also a
client-dist directory that contains the latest stable build of the front-end with the
production flag enabled.
You can find more information in the documentation of the project.
Code of Conduct
Please be aware that this project has a Code of Conduct. The tldr; is to just be excellent to each other
You are more than welcome to contribute to this project. The tests for this project are still missing so please properly test your changes manually in the mean time.
Building front-end changes
To build changes for the front-end you can run the following command:
npm run build:preact
Running the server in dev mode
If you are developing and you want to incrementally build the changes for development purposes you can start of the back-end and front-end with:
npm run dev
Special Thanks To
A special thanks to all the awesome folks in the open source community and their great projects and especially the folks working on the following projects:
- many more
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
MIT © Dominik Kundel