Skip to content
This repository was archived by the owner on Dec 23, 2020. It is now read-only.

yhagio/fastify-rest-graphql-api

Repository files navigation

Build Status codecov MIT Licence Open Source Love

Fastify REST GraphQL API Boilerplate

Note: in demo, I disabled email

Built with 💖


Features 🎁

  • User Auth functionality (Signup, Login, Forgot Password, Reset Password)
  • JWT Authentication
  • REST API
  • Dependency injection
  • Configs via environmental variables
  • Email notification (Welcome email, Reset password email)
  • Knex with Postgres implementation
  • Unit tests
  • Travis CI
  • Badges (coverage, opesn source, MIT, up-to-date dependencies)
  • MIT LICENSE
  • GraphQL API
  • GraphQL playground
  • Swagger REST API documentation
  • Diagram
  • ? Auto migration (optional via env var)

component diagram

diagram

swagger

swagger

graphql playground

swagger


Run locally 🚙

Envronmental variables, see ./config. You can customize the ./config/default.json and ./config/custom-environment-variables.json.

You can put .env in root of repo as well

MAILGUN_API_KEY=key-b9jksfh8s9843uhfsdhds
MAILGUN_DOMAIN=xxxxx.mailgun.org

LOG_LEVEL=info

APP_DB_TYPE=postgres
APP_DB_HOST=localhost
APP_DB_PORT=5432
APP_DB_DB=my-db
APP_DB_USER=local-user
APP_DB_PASSWORD=password

JWT_SECRET=secret
JWT_EXPIRES_IN=3h

ENV=development

APP_PORT=3000
APP_HOST=http://localhost

Run

# Terminal 1
docker-compose up        # docker-compose up (Run postgres)
docker-compose down      # docker-compose down (Shutdown postgres)

# Terminal 2
yarn migrate           # Migrate DB
yarn rollback          # Rollback migration
yarn dev               # Run application
yarn test              # Run unit tests (lint & format code as well)
yarn build             # Build application

You can see graphql playground at http:/localhost:3000/graphql once application is up and running.

You can see swagger REST API docs at http:/localhost:3000/docs once application is up and running.

See more commands in ./package.json

Releases

No releases published

Packages

No packages published