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
Installing
- Fork the repository, and clone it to your machine
git clone https://github.com/jpoz/starter
- Move into the project directory.
cd starter
- 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'
- Download the required Go dependencies.
make install
-
Setup your database and fill the required information in the .env
file. Look at the .env.example
.
-
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.