jpoz / starter

Starter for a Golang service (with GORM + Graphql)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Starter

Introduction

This project is a robust starter pack for a back-end service built with Go, backed by a PostgreSQL database. It employs GraphQL to facilitate efficient data transfer, using gqlgen for schema generation.

Key Packages

  • github.com/99designs/gqlgen : For generating GraphQL servers in Go.
  • github.com/charmbracelet/log : A charming logger for all your logging needs.
  • github.com/go-chi/chi/v5 : Lightweight and feature-rich router for building Go HTTP services.
  • github.com/redis/go-redis/v9 : A Redis client for Golang.
  • gorm.io : A developer-friendly ORM for handling interactions with your PostgreSQL database.

Getting Started

Prerequisites

  • Go 1.18 or higher
  • Docker

Installing

  1. Fork the repository, and clone it to your machine
git clone https://github.com/jpoz/starter
  1. Move into the project directory.
cd starter
  1. Rename the original package name to your new name.
grep -rl 'github.com/jpoz/starter' ./ | LC_ALL=C xargs sed -i '' 's/github\.com\/jpoz\/starter/github.com\/you\/your_new_project/g'
  1. Download the required Go dependencies.
make install
  1. Setup your database and fill the required information in the .env file. Look at the .env.example.

  2. Run the server locally.

make dev

Now, your server should be running at localhost:8080. (or what ever ADDR you set in your .env file.

Deployment

You can build the project using the standard Go build tool. This will create a binary file that can be executed.

go build -o main .

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Acknowledgments

This project wouldn't be possible without these wonderful projects and their contributors:

Please feel free to contribute to this project, report bugs and issues, and suggest improvements.

About

Starter for a Golang service (with GORM + Graphql)

License:MIT License


Languages

Language:Go 76.9%Language:Makefile 23.1%