tryoasnafi / users

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Users Service

Description

This is users details service

Tech Stacks

  • Golang
  • PostgreSQL (Database)
  • Docker

Framework & Library

API Specs

API Specs in docs folder or you can run the project and access http://localhost:9090/api/docs/index.html

Rebuild documentation

Installing swaggo cli

go install github.com/swaggo/swag/cmd/swag@latest

Generate docs

swag fmt
swag init --parseDependency --parseInternal -g cmd/api/main.go

Development

  1. Clone the project
git clone https://github.com/tryoasnafi/users
  1. Setting .env
cd users
cp -p .env.example .env
  1. Install project dependencies
go get ./...
  1. Install Air (auto-reload) and run docker compose
go install github.com/air-verse/air@latest
make watch

If you don't have GNU Make, you can run docker compose -f compose.dev.yaml up -d --build

Database Migration

Database migration using GORM Auto migrate, make sure to set .env

go run cmd/migration/main.go

Testing

Run Unit Tests

go test ./...

Production

Build users service image

make build

or run docker build -f Dockerfile.production . -t user-service:latest

About


Languages

Language:Go 96.3%Language:Makefile 3.2%Language:Dockerfile 0.5%