Transforming Teaching with Teachingo - Update #2

chloemcateer3

Chloe McAteer

Posted on April 18, 2020

Transforming Teaching with Teachingo - Update #2

This is an update on our #TwilioHackathon project progress - you can see the original post here:


Data is the new oil 🛢

When thinking about the different user flows for an application like this, it is clear to see that there are a lot of different data points being generated, which meant we had to think about adding a persistence layer to our application.

So we initially spent some time thinking about what the best way to store this data was. Both of us have previous experience working with NoSQL, so we considered using MongoDB since it is quick & easy to get up and running.

However, we took the time to understand what all data we would be working with, we realised we would need to store all of the following:

  • Users email address, password, name, mobile and if they where a student or teacher.
  • Class names, teacher that teaches it, students that attend it
  • Lesson time/date, number of questions asked in lesson, lesson feedback etc.

Brooklyn Nine Nine, There is another way

From seeing this, it was clear that it made more sense for us to opt for a more structured database approach, the relationships between the different data points were more complex than we initially thought. We had a quick brainstorm about the database platform, ultimately settling on PostgreSQL.

Integrations.js ✨

Having decided on the platform, we needed to understand how our Node.js service could interact with a Postgres instance. I came across Knex.js which is an SQL query builder that can be used with Postgres!

It allowed me to be able to define schemas for each table within the code and create functions for getting, adding and removing data from the db - I was amazed by how powerful it was and how much of the heavy lifting it could do out of the box.

Brooklyn Nine Nine, Boyle holding Terry

It also meant that once someone else pulled down the repository, they could run the database migrations, to get all the tables set up the correct way!

Knex also allowed me to define and generate seed data for the application, which meant I could put large amounts of dummy data into the database.

We now have our database up and working, but we did face some problems along the way, when it came to actually modelling it. For example: duplication of data and over complicated tables.

💖 💪 🙅 🚩
chloemcateer3
Chloe McAteer

Posted on April 18, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related