All Projects â†’ mattdamon108 â†’ go-graphql-api-boilerplate

mattdamon108 / go-graphql-api-boilerplate

Licence: MIT license
A Boilerplate of GraphQL API built in Go + graphql-go + gorm

Programming Languages

go
31211 projects - #10 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to go-graphql-api-boilerplate

Go Web
Modern Web Application with Golang
Stars: ✭ 138 (+84%)
Mutual labels:  starter-kit, gorm
Headless Wp Starter
🔪 WordPress + React Starter Kit: Spin up a WordPress-powered React app in one step
Stars: ✭ 4,144 (+5425.33%)
Mutual labels:  starter-kit, graphql-api
gorm-mongodb
GORM for MongoDB
Stars: ✭ 58 (-22.67%)
Mutual labels:  gorm
uniform-graphql
Code-first GraphQL apis in TypeScript with complete & robust end-to-end type safety.
Stars: ✭ 44 (-41.33%)
Mutual labels:  graphql-api
go-orm-code-helper
🔥🔥🔥go-orm-code-helper is a goland plugin, it aims to make gorm code getting more simple
Stars: ✭ 22 (-70.67%)
Mutual labels:  gorm
PreactSimpleStarter
PWA Simple Starter with Preact, Preact-mdl and Webpack2 🔥🔥🔥
Stars: ✭ 65 (-13.33%)
Mutual labels:  starter-kit
go2gql
graphql-go schema generator by proto files
Stars: ✭ 33 (-56%)
Mutual labels:  graphql-go
go-pangu
rest api web server based on go(High availability, high security, high performance)
Stars: ✭ 45 (-40%)
Mutual labels:  gorm
graphql-api
GraphQL-Api is an opinionated Graphql framework for Rails that supports auto generating queries based on Active Record models and plain Ruby objects
Stars: ✭ 58 (-22.67%)
Mutual labels:  graphql-api
browser-extension
Browser Extension Template with ESbuild builds, support for React, Preact, Typescript, Tailwind, Manifest V3/V2 support and multi browser build including Chrome, Firefox, Safari, Edge, Brave.
Stars: ✭ 535 (+613.33%)
Mutual labels:  starter-kit
gorm-paginator
gorm pagination extension
Stars: ✭ 154 (+105.33%)
Mutual labels:  gorm
simple-mpesa
A simple example of how MPESA works. Works with all 3 types of customers i.e. Agents, Merchants and Subscribers. Allows you to configure a tariff and apply it to transactions. The project follows DDD principles.
Stars: ✭ 31 (-58.67%)
Mutual labels:  gorm
graphql-pokeapi
🔴 The Unofficial GraphQL for PokeAPI
Stars: ✭ 137 (+82.67%)
Mutual labels:  graphql-api
create-react-app-starter
CRA + typeless starter
Stars: ✭ 21 (-72%)
Mutual labels:  starter-kit
create-next-stack
Create Next Stack is a website and CLI tool used to easily set up the boilerplate of new Next.js apps.
Stars: ✭ 149 (+98.67%)
Mutual labels:  starter-kit
simple-wallet
This is a simple wallet REST api that is capable of acount deposits and withdrawals, checking for account balance and providing a ministatement. It follows domain driven design practices. The project uses the DDD architecture approach.
Stars: ✭ 32 (-57.33%)
Mutual labels:  gorm
nextjs-landing-starter
Build your landing site based on Next.JS in minutes 🚀
Stars: ✭ 59 (-21.33%)
Mutual labels:  starter-kit
twitch-extension-starter
Kickstarts your Twitch Extension using React
Stars: ✭ 38 (-49.33%)
Mutual labels:  starter-kit
graphql-dependency
Cross service dependencies for GraphQL API with underlying @imqueue services
Stars: ✭ 17 (-77.33%)
Mutual labels:  graphql-api
prometheus
Collect DB Status or user-defined metrics with Prometheus
Stars: ✭ 94 (+25.33%)
Mutual labels:  gorm

Go GraphQL API Boilerplate

Stacks

Features

  • User Sign Up & Sign In with OAuth (Google, Kakao)
  • Change the Profile

How to Run

Initialize DB

  1. Create a database using sql/create.sql (MYSQL)

  2. Configure the db in db/db.go

// ConnectDB : connecting DB
func ConnectDB() (*DB, error) {
	db, err := sql.Open("mysql", "api:your_password$@/database_name?parseTime=true")

	if err != nil {
		panic(err)
	}

	// https://github.com/go-sql-driver/mysql/#important-settings
	db.SetConnMaxLifetime(time.Minute * 3)
	db.SetMaxOpenConns(10)
	db.SetConnMaxIdleTime(10)

	errPing := db.Ping()
	if errPing != nil {
		panic(err.Error())
	}

	qb := goqu.New("mysql", db)

	return &DB{qb}, nil
}

Make .env file

STAGE=PROD // PROD for production or else for debug
JWT_SECRET=my_secret
GOOGLE_CLIENT_ID=your_google_web_client_id
KAKAO_REST_API_KEY=your_kakao_rest_api_key
KAKAO_REDIRECT_URI=http://localhost:8280/oauth/kakao/redirect

Run the server

$ go run server.go

GraphQL Playground

Connect to http://localhost:8080

Authentication : JWT

You need to set the Http request headers Authorization: Bearer {JWT_token}

Usage

Sign In

mutation {
  signInGoogle(idToken: "12345678") {
    ok
    error
    token
  }
}
mutation {
  signInKakao(code: "12345678") {
    ok
    error
    token
  }
}

Change a Profile

mutation {
  changeProfile(nickname: "Go developer") {
    ok
    error
    user {
      id
      email
      nickname
      createdAt
      updatedAt
    }
  }
}

Get my profile

query {
  getMyProfile {
    ok
    error
    user {
      id
      email
      nickname
      createdAt
      updatedAt
    }
  }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].