/typescript-graphql-starter

🧘‍♀️ ⚛️ A Typescript + GraphQL Yoga starter pack

Primary LanguageTypeScriptMIT LicenseMIT

Typescript GraphQL Template

📌 Getting Started

  1. Install any needed dev dependencies:
yarn install
  1. Boot up local Postgres database (steps differ based on OS)
  2. If not yet created, create a file named .env in the project's base directory. See .env.example for required properties.
  3. Boot up Typescript compiler:
yarn watch
  1. Start dev server:
yarn dev

⚙️ Advanced Config

  • If you need to add additional properties to the .env file, run the following:
yarn gen-env

This will update the .env.d.ts and .env.example files with the correct properties and type declarations.

📦 Running SQL Migrations

  • To run SQL migrations, run the following command:
yarn migrate

This will use Mikro-ORM's migration generator to construct and execute SQL migrations on your database.

🐳 Usage with Docker

Build an Image

docker build -t {username}/{image-name}:{tag-name}

Login with Docker Hub

docker login

Push to Docker Hub

docker push {username}/{image-name}:{tag-name}

🐳 Usage with Dokku

https://dokku.com/docs~v0.23.9/deployment/methods/images/#docker-image-tag-deployment

👨‍💻 Deploy

  • First, make the deploy.sh file executable by running the following:
chmod +x deploy.sh
  • Next, simply run the executable on the server:
deploy.sh

🚧 Testing

To run tests with Mocha

yarn test