GraphQL ToDo app (Full stack with Mysql backend database)

See the code on GitHub
This project implements a full stack graphQl version of a ToDo app. The project has an api and a client layer. The backend is using react.js, sequelize.js, express, and apollo server. The GraphQl layer is served by a Mysql database.

Be warned this is a full-stack project and you will need to be comfortable with the above mentioned technologies to install and run this.
See the full code on Github

Folder structure

  • To Do App GraphQL folder structure
  • api
    • index.js (This starts the express server, I have also combined the models and resolvers here too, in the real app this will be separated)
    • sequelize.js (This file contains the database settings for MySQL plus some SQL commands to set up tables with initial data)
    • example-queries.js (This file is for reference only. It has some sample graphql queries that you can use to test)
    • package.json
    • models
      • item.js (Contains the model for to do item)
  • client
    • node_modules
    • package.json
    • src
      • index.js(The entire client app is in this file)
      • style.css

…a bit about the api code

To install api app

You need a working MySQL DB server with the following setup-:  db name : to_do , username: testuser, password : test
(database settings are found in sequelize.js)

Once you have a MySQL database setup and running with the above details you can run following from the api directory :

npm install

npm start

If the install was successful then you should get the following screen in the terminal window. You will notice that it is running some MySQL commands to create tables and entries. If you get red messages then you probably have some database setup issue.

The api app will run on port 3000. Once the server is running you can open the link http://localhost:3000/graphql in your browser and test the graphql queries as shown below :

To install the client app

change directory to client directory and run following :

npm install

npm start

The app will run on port 3001. You can open the app in the browser using the link http://localhost:3001/ (Note: the api needs to be running to use the app).