Skip to content

A nearly production ready GraphQL server incorporating industry best practices. Written in TypeScript, Apollo GraphQL and SQLite

Notifications You must be signed in to change notification settings

esam091/graphql-backend

Repository files navigation

Live Demo

A nearly production ready implementation of a GraphQL server incorporating industry best practices.

Highlights

✅ Well designed schema with reusable objects.
✅ Standard authorization: Users can only modify products for their own shop, etc.
✅ Field level authorization: Only admins and shop owners can see the shop's address, Only admins and the user can see the user's date of birth.
✅ Malicious query protection: Queries beyond certain depth are rejected.
✅ Data loader pattern to prevent n+1 query problem.
✅ Relay compliant pagination.
✅ Input limit validation.
✅ Robust error handling.
✅ 100% type safety with TypeScript and graphql-codegen.

What this project is NOT about

  • Complete authentication solution. I built just enough so users can sign in.
  • Highly optimized SQL queries.

Additional notes

  • The GraphQL server is embedded within a Next.js route for easy hosting with Vercel
  • Introspection and playground is enabled so that visitors can play around with the playground.

Running the app locally

  • Checkout the project
  • Run npm install
  • Copy .env.example to .env
  • Run npm run dev and you're good to go

Technologies

GraphQL Apollo GraphQL TypeScript Drizzle ORM SQLite Next.js

About

A nearly production ready GraphQL server incorporating industry best practices. Written in TypeScript, Apollo GraphQL and SQLite

Topics

Resources

Stars

Watchers

Forks

Languages