Templates for the Jovo Framework ⭐️
Documentation - CLI - Contributing - Twitter
This sample project uses MySQL databases (via the Jovo framework's jovo-db-mysql
integration) for storing both user data and - probably more interestingly - highscores. Highscores are a neat way to create indirect interactions between user, and can potentially increase retention of a voice game.
This sample project uses an AWS RDS MySQL database, but it doesn't matter where your MySQL instance is actually hosted.
In case you want to do it with RDS, here's a quick guide to get you started with a free usage tier instance:
- Log into the AWS Management Console and navigate to AWS RDS Home.
- Click the orange button "Create Database"
- In the "Select engine" dialog, select "MySQL", enable the checkbox "Only enable options eligible for RDS Free Usage Tier" on the bottom, and click on the orange button "Next"
- In the "Specify DB details", skip down to "Settings" and assign your DB instance an identifier (e.g.
mydemodbinstance
), master username and password - In the "Configure advanced settings" dialog, select the "Virtual Private Cloud (VPC)" option "Create new VPC", make sure that "Public accessibility" is on "Yes", assign a database name (e.g.
mydemodb
), and then skip to the bottom and click on the orange button "Create database". - Check out the confirmation page and then check out the DB instance details. After some minutes, a URI will appear under "Connect > Endpoint".
After you cloned this repo, rename the file .env.example
to .env
and complete it with your DB credentials:
MYSQL_ADDR='localhost' <-- The endpoint of your DB instance (from step 6)
MYSQL_PORT='9000' <-- The port of your DB instance, typically '3306'
MYSQL_USER='user' <-- The master username for your DB instance (from step 4)
MYSQL_PASSWORD='password' <-- The password for your DB instance (from step 4)
MYSQL_DATABASE='jovoapp' <-- The DB name from step 5
Unlike the user database, the voice app will not automatically create a table for the highscores, so you have to set it up yourself. I have prepared a little setup script (setup.js
) that will use the project's credentials to set up this table initially.
To execute it, navigate into the project's root folder and run the following on your command line:
node setup.js
The mechanics of the voice app are very simple:
- You launch the voice app
- It rolls 6 6-sided dice and adds their face values to a score
- It queries the
scores
table to count how often a higher score has been recorded - It presents the score to the user, along with a note whether they are the highest-scoring user, or else, which rank they have
- It asks the user if they want to roll again
- If the user accepts, the voice app restarts the game cycle at item 2 of this list, otherwise is quits the Skill