hgiasac / hasura-typescript-boilerplate

Hasura + typescript boilerplate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hasura Typescript Boilerplate

Boilerplate templates

This is project template for Hasura v2.0 that is in beta stage. Use at your risk.

The auto-migration and CLI are v3. You need to download directly from Github releases page

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

About

Hasura + typescript boilerplate

License:MIT License


Languages

Language:TypeScript 94.5%Language:Dockerfile 4.0%Language:Makefile 1.5%