Skip to content

A template web app with a React / TypeScript frontend and a Go GraphQL backend that uses SQLBoiler and gqlgen for a fast, schema driven development style.

License

Notifications You must be signed in to change notification settings

nvonpentz/go-graphql-react

Repository files navigation

go-graphql-react

A template web app with a React / TypeScript frontend and a Go GraphQL backend that uses SQLBoiler alongside gqlgen for a fast, database schema driven development style.

Stack

  • Golang backend server
  • Postgres database
  • SQLBoiler to generate Go ORM models based on database tables
  • gqlgen to generate a graphQL API based on the models
  • Gorilla sessions for authentication (sign up / log in / log out resolvers are implemented)
  • React / TypeScript frontend
  • Apollo GraphQL client

Development

SQLBoiler and gqlgen work really well together to generate nearly an entire graphQL API from the database:

  1. Add Postgres table definitions to the /migrations/ folder
  2. Generate ORM based on tables in the database make db
  3. Add a graphQL schema in the /api/ folder that reflects the generated ORM
  4. Generate a graphQL server from the schema that binds to the ORM make graphql (bonus: complete 2 & 4 with make models)
  5. Fill in the graphQL resolvers using the ORM in /internal/resolvers/

Running

  1. Create a new file .env.sh at the top level directory, copy in .env.example.sh and fill in the missing variables
  2. Start the React app make run-client and start the backend make run-server (migrations are run automatically with golang-migrate)

About

A template web app with a React / TypeScript frontend and a Go GraphQL backend that uses SQLBoiler and gqlgen for a fast, schema driven development style.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published