Open University - TM470 Final Year Project


20 November 2018

Last Edited: 23 November 2018

22nd Novemember 2018

The backbone of any successful application is its 'backend', here all of the heavy lifting in terms of database manipulation is carried out, so this is where I will begin. Once I have a solid foundation I can then focus on building the frontend components..the pretty parts.

My backend stack is as follows:

frontend request ➡︎ graphql yoga ➡︎ prisma ➡︎ database

GraphQL Yoga provides a server based on express, it has the ability to implement middleware functionality, ie intercept and manipulate the network request prior to being sent to the server. The kind of services I will implement will be:

  • Database Mutation and Query resolvers
  • User Authentication and Permission checking
  • Providing custom server logic

Prisma provides a complete set of CRUD (Create, Read, Update, Delete) APIs for the database, it essentially sites between our database and server to abstract away the complexity and labour intensive act of creating database queries.

Database this holds all of our applications data, the type of database is not of great consequence as we have no interaction directly with the database, we only need worry which kind Prisma supports, which currently is, postgres, mysql and mongodb . For the purposes of RideOut a mysql database is perfectly adequate and is also provided as the test database for Prisma, so is the natural choice.

Screenshot 2018-11-23 at 20.17.12

Here I am creating a new server, passing in the port from my ENVIRONMENTAL variable folder. This is to ensure that no sensitive passwords are stored within my JavaScript files. The create server function imported from a seperate file and is called with an object of settings as its argument.

Screenshot 2018-11-23 at 20.17.24

Here is where I define the create server function. It uses a GraphQLServer function provided by graphql-yoga which will launch an express server. I pass in an object of settings which point to the location of my Mutation, Resolvers and Schema, I also pass in along an additional option context, which contains the original reqest from the front end. This function is then exported so it can be used in index.js.

Screenshot 2018-11-23 at 20.17.32

Here is where I define my database settings, I use a class Prisma (provided by the prisma-binding library), passing it my Prisa.io endpoint and secret. I set these up via the Prisma.io website.

Screenshot 2018-11-23 at 20.52.53

Here is the graphql config file, it provides the path where my Prisma APIs live, these enable me to perform functions on the database. The Prisma APIs are automatically generated by Prisma when I deploy my Schema (database model) to Prisma, it is then automatically downloaded into my project so I have access to new APIs each time I modify the Schema.

Screenshot 2018-11-23 at 20.52.58

This is the Schema, currently it only provides the original setup model which is a User, containing a unique ID and a name. Here is where I will add future database models such as meetups, geodata and chat logs.


Screenshot 2018-11-23 at 20.55.14

The config file which provides the Prisma library with the setup information (note the further use of environmental variables to protect sensitive data).

Screenshot 2018-11-23 at 20.53.06

A simple screenshot of the Prisma.io user interface showing the sandbox mysql database I will use for testing my application. This will be migrated to a full scale service once it is complete.

Screenshot 2018-11-23 at 20.54.24

20th Novemember 2018

My final year project with the Open University commences in early 2019 but in order to make sure that I have the maximum possible time to complete this and gain the best marks I am beginning my preparation work now.

It is required that I pass my project ideas to my assigned tutor for acceptance before I start, however as I want to get started early I am taking a gamble and starting my project now without the green light.

The requirements for the TM470 is to create a project which is broadly based on one of the final year courses that you have already or are currently studying. Because I am only studying TM352 - Web, mobile and cloud technologies at the moment, then it will be based around this, which is my chosen specialism anyway.

The reason I am studying the project now, as apposed to when I have compeleted all level 3 units is simply a matter of timing, as TM470 has a Feburary start it means I would complete my degree 6 months later than planned if I waited till 2020.

Project Background

In my spare time I am a keen motorcyclist, and even though I know many fellow bikers, I often find it difficult to arrange meetups with them. It is a much safer practice to ride with friends who can watch out for you and potential dangers on the road than it is to ride alone.

My solution is an only meeting place with built in route planner, my app "RideOut" will enable users to create an account, suggest meetups and routes, they will also be able to sign up for other users meetups and participate in online discussions around the event. A simple premise, but I plan to make use of cutting edge web technologies such as NextJS, prisma and graphql to create a highly performant and responsive application. The app is more a demonstration of knowledge of these technologies than trying to make it feature rich.

I will be using this blog post to keep track of my progress, which should come in useful when compiling my project reports.