Skip to content
/ goshop Public
forked from quangdangfit/goshop

E-Commerce backend system via Golang and Postgres

License

Notifications You must be signed in to change notification settings

msam1r/goshop

 
 

Repository files navigation

Go Shop

Master codecov GitHub go.mod Go version GitHub

An example of gin contains many useful features for e-commerce websites

How to run

Required Environment

  • Postgres
  • Redis

You can see the docker compose file here to set up required environment

Config

  • Copy config file: cp pkg/config/config.sample.yaml pkg/config/config.yaml
  • You should modify pkg/config/config.yaml
environment: production
http_port: 8888
grpc_port: 8889
auth_secret: ######
database_uri: postgres://username:password@host:5432/database
redis_uri: localhost:6379
redis_password:
redis_db: 0

Run

$ go run cmd/api/main.go 
2023-09-12T15:18:36.684+0700    INFO    http/server.go:58       HTTP server is listening on PORT: 8888
2023-09-12T15:18:36.684+0700    INFO    grpc/server.go:53       GRPC server is listening on PORT: 8889

Test

$ go test

Test with Coverage

go test -timeout 9000s -a -v -coverprofile=coverage.out -coverpkg=./... ./...

or

make unittest

Document

  • API document at: http://localhost:8888/swagger/index.html

Tech stack

  • Restful API
  • GRPC
  • DDD
  • Gorm
  • Swagger
  • Logging
  • Jwt-Go
  • Gin-gonic
  • Redis

What's next?

  • gRPC functions for products and orders
  • Push message to notify place order successfully
  • Payment with PayPal
  • Define error response wrapper

About

E-Commerce backend system via Golang and Postgres

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 99.7%
  • Other 0.3%