Skip to content

GraphQL server for the AutoTheater app written in TypeScript with implemented cookie based sessions 🍪

License

Notifications You must be signed in to change notification settings

rodzy/Autotheater-gql-server

Repository files navigation

Auto Theater server

Auto theater server the GraphQL + Node.js version of the REST API build with Laravel 7.x and specifically done for an auto cinema application.

The REST version

Set up

Prerequisites

  1. Node
  2. Yarn v.1.22.4+
  3. PostgreSQL 9.5+

Installation

  1. fork the repository to your account.

  2. clone your fork into your local machine.

  3. cd autotheater-gql-server on your terminal.

  4. Run yarn install on your terminal to get all the dependencies used.

  5. Setup your database environment keep in mind that this server was made using PostgreSQL in mind.

  6. Create a .env file as the following

    DB_CONNECTION=pgsql
    DB_HOST=127.0.0.1
    DB_PORT=5432
    DB_NAME="autotheatergql"
    DB_USERNAME= "<your-username>"
    DB_PASSWORD= "<password>"
  7. Run yarn watch to compile all the *.ts files into *.js.

  8. Run yarn dev, and you're ready to go server must be online on http://localhost:4000/graphql.

Scripts

This project uses TypeScript watch to compile the code to JavaScript for a faster load time and better optimazation for production

The npm scripts:

  "scripts": {
        "test": "npm run db:test && jest",
        "watch": "tsc -w",
        "dev": "nodemon dist/src/index.js",
        "dev:ts": "nodemon --exec src/index.ts",
        "start": "node dist/src/index.js",
        "start:ts": "ts-node src/index.ts",
        "lint": "eslint . --ext .ts",
        "lint:fix": "eslint . --ext .ts --fix",
        "db:populate": "ts-node src/seed.ts",
        "db:test": "ts-node src/testUtils/setup.ts"
  },

Keep in mind that using dev:ts will be slower because of the re-compiling step

Data model

The current data model is composed by:

  • Roles
  • Users
  • Genres
  • Classifications (Movies)
  • Movies
  • Likes (Movies)
  • Locations
  • Billboards
  • Product_Types
  • Classification_Products (Products)
  • Products
  • Rating (Products)
  • Tickets
  • Reservations

Diagram to understand the basic flow of the aplication, some tables are not in the current data structure Misc:

🔵 Primary Keys 🟠 Foreign keys 🟢 Dynamic API types for the frontend ⚪ Basic fields.

License

AutoTheater is licensed under the MIT license, developed and manatined by @rodzy

About

GraphQL server for the AutoTheater app written in TypeScript with implemented cookie based sessions 🍪

Topics

Resources

License

Stars

Watchers

Forks