Tutorial: Audio Backend
Cover Page
DUE Thu, 10/16, 2 pm
Install updates
Remember to install updates available to your Ubuntu back end. If N in the following notice you
see when you ssh to your back-end server is not 0,
N updates can be applied immediately.
run the following:
server$ sudo apt update
server$ sudo apt upgrade
Failure to update your packages could lead to your solution not performing at all, with no warning that it is because you haven’t updated, and also makes you vulnerable to security hacks.
Any time you see *** System restart required *** when you ssh to your server, immediately run:
server$ sync
server$ sudo reboot
Your ssh session will be ended at the server. Wait a few minutes for the system to reboot before you ssh to your server again.
Database table
Add one new column named audio of type TEXT to the chatts table in your chatterdb
database:
- Log into an interactive PostgreSQL (
psql) session as userpostgres - Connect to the
chatterdbdatabase - Clear your
chattstable of all oldchatts, use the SQL command:TRUNCATE TABLE chatts; - Add a new column to
chattsto storeaudioasTEXT. Type the following:ALTER TABLE chatts ADD COLUMN audio TEXT;Columns of type
TEXTallow the user to store strings of undetermined length. - To verify that you’ve added the new column to the
chattstable, enter:SELECT * FROM chatts;Make sure you get back the following result (though perhaps more stretched out and may include other column(s), such as
appIDif you have completed other tutorial(s)):username | message | id | time | audio | ----------+----------+----+------+-------+ (0 rows)If so congratulations! You have successfully added the new column!
- Exit PostgreSQL
Web server
We next prepare the Chatter backend to handle audio data. Please click the relevant
link for the web framework of your choice:
| Go | Python | Rust | TypeScript |
and return here to resume the server setup once you have your web framework set up.
Testing audio upload
Unfortunately there’s no practical way to include a base64-encoded sample audio string,
nor a way to play it back without a front-end to decode it. The simplest way to test
is to use your front end to record an audio message and post it to your back end, and
then retrieve the chatt from the back end for play back.
WARNING: You will not get full credit if your front end is not set up to work with your backend!
Everytime you rebuild your Go or Rust server or make changes to either of your JavaScript or Python files, you need to restart chatterd:
server$ sudo systemctl restart chatterd
Leave your chatterd running until you have received your tutorial grade.
TIP:
server$ sudo systemctl status chatterd
is your BEST FRIEND in debugging your server. If you get an HTTP error code 500 Internal Server Error or if you just don’t know whether your HTTP request has made it to the server, first thing you do is run sudo systemctl status chatterd on your server and study its output, including any error messages and debug printouts from your server.
That’s all we need to do to prepare the back end. Before you return to work on your front end, wrap up your work here by submitting your files to GitHub.
Submitting your back end
We will only grade files committed to the main branch. If you use multiple branches, please
merge them all to the main branch for submission.
Navigate to your reactive folder:
server$ cd ~/reactive/
Commit changes to the local repo:
server$ git commit -am "audio back end"
and push your chatterd folder to the remote GitHub repo:
server$ git push
If git push failed due to changes made to the remote repo by your tutorial partner, you must run
git pull first. Then you may have to resolve any conflicts before you can git push again.
Go to the GitHub website to confirm that your back-end files have been uploaded to your
GitHub repo.
Congratulations! You’ve completed the back end modifications necessary to support audio!
Prepared by Wendan Jiang, Ollie Elmgren, Benjamin Brengman, Mark Wassink, Alexander Wu, Chenglin Li, Xin Jie ‘Joyce’ Liu, Yibo Pi, and Sugih Jamin | Last updated August 29th, 2025