Skip to main content

About quotes project

It can be hard to start with GraphQL and I struggled a lot with the first setup. I did several beginner mistakes and when I checked the internet I could find just some really basic examples. So I created an example project for everyone who wants to start with GraphQL.

The project itself is very easy. It is about IT quotes, so you have some author and he / she can have one or more quotes. The API then let a user ask for list of quotes or authors, filter and order them. Backend code is available in two languages: PHP and NodeJS.

If you are interested in frontend, then you can check this repository where is used React, Relay and TypeScript. Working application is available here.

Tech stack

PHP

NodeJS

Frontend

Database

Database has just two tables, author and quote. You can init the database with a script that is part of the project, or run migrations.

Table author:

idfirstNamelastName
1JohnJohnson
2MartinFowler
3JasonLengstorf

Table quote

idauthorIdtext
11First, solve the problem. Then, write the code.
22Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
33If you stop learning, then the projects you work on are stuck in whatever time period you decided to settle.

Tests

Project contains also couple of integration tests to check if the whole applicaton is working. If someone opens a pull request it runs a GitHub action, creates a database, run migrations and seed test data. Then run queries and check if the result is correct.