Simple Go/GraphQL/PostgreSQL template
Purpose
Have a good starting point for any project that needs a graphql, go, and postgres backend. It's a very light solution that is meant to be customized and built upon, not a full blown application with opinionated thoughts.
Features
- Creates a connection to a PostgreSQL database through PGX Pool and a url defined in the environment variable
DATABASE_URL
- Simple user authentication
- Initial middleware for dependency injection with the database connection
- Initial test showing an example of how to test with a database connection
- Resolvers for logging in and registering a user
To Be Done
- Setup automatic authentication for routes/resolvers through middleware
- Setup frontend application to be served through the static assets route
- This is for ease of deployment and development, your production needs may be different where the frontend and backend are seperated from each other entirely.
- Integrate GraphQL with the frontend integration
Commands
go run github.com/99designs/gqlgen generate
to regenerate the graphql generated files