GithubHelp home page GithubHelp logo

hungngomobile / go_api_boilerplate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yhagio/go_api_boilerplate

0.0 1.0 0.0 461 KB

🐶Go (Golang)🚀REST / GraphQL API + Postgres boilerplate

Home Page: https://go-gin-postgres-api.herokuapp.com/graphql

License: MIT License

Shell 0.49% Go 99.05% Dockerfile 0.46%

go_api_boilerplate's Introduction

Build Status codecov MIT Licence Open Source Love

Go (Golang) REST / GraphQL API Boilerplate

Note: in demo, I disabled email

Used libraries:


  • Components Diagram

diagram image

  • See Swagger Doc http://localhost:3000/swagger/index.html

swagger image

  • See GraphQL Playground http://localhost:3000/graphql

graphql image


Features

  • User Auth functionality (Signup, Login, Forgot Password, Reset Password)
  • JWT Authentication
  • REST API
  • GraphQL API
  • Gorm (Golang SQL DB ORM) with Postgres implementation and auto migration
  • Configs via environmental variables
  • Email notification (Welcome email, Reset password email)
  • Swagger REST API documentation
  • GraphQL playground
  • Unit tests
  • Dependency injection

Run locally

Create .env at root, i.e.

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

EMAIL_FROM=support@go_api_boilerplate.com

DB_HOST=localhost
DB_PORT=5432
DB_USER=your-user
DB_PASSWORD=your-password
DB_NAME=local-dev-db

JWT_SIGN_KEY=secret
HAMC_KEY=secret
PEPPER=secret

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
go run github.com/99designs/gqlgen -v # Generate Graphql stuff
swag init -g app/app.go               # Generates Swagger
go run *.go                           # Run application
go test -v -cover ./...               # Run go test

Todo

  • Input Validations
  • Custom Error messages
  • Logger
  • More unit tests

maybe?

  • gRPC
  • Redis Streams
  • Redis PubSub
  • WebSocket
  • MongoDB

Contribution

Welcome for suggestions

go_api_boilerplate's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.