/hasura-typescript-boilerplate

Hasura + typescript boilerplate

Primary LanguageTypeScriptMIT LicenseMIT

Hasura Typescript Boilerplate

Boilerplate templates

NOTE: These templates are in sample repository. You should checkout which feature you need (JWT, Firebase). master branch contains clean structure, so there aren't any migration.

  1. Base Project
  1. JWT Authentication
  1. Firebase Authentication
  1. Extras
  • With Remote Schemas: From Hasura 1.2.0, remote schema can be replaced with Action. So remote-schemas is remove from main branches

Project Structure

  • services/auth: Authentication webhook
  • services/data: Hasura GraphQL project with migrations
  • services/events: Event triggers
  • services/actions: Hasura actions

Database design and migration

Use Hasura CLI: https://docs.hasura.io/1.0/graphql/manual/hasura-cli/install-hasura-cli.html#install

  • Design: go to services/data, then run
hasura console --admin-secret [secret] --endpoint [endpoint]
  • Migrate:
hasura migrate apply --admin-secret  [secret] --endpoint [endpoint]

How to Run

  • Copy dotenv file to .env and edit configuration if necessary

  • Use Docker with docker-compose

# start development dockers
make dev
# because docker caches built images, when changing packages, we need to rebuild containers
make dev-build
  • For Test/Production environment, use docker-compose.test.yaml or docker-compose.prod.yaml config file. It requires gcplogs driver (read below), or you can remove it if using another logging services
make staging
# or
make prod

Advanced guidelines