game-library-auth

module
v0.0.0-...-fbdc1e2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2025 License: MIT

README

game-library-auth

Introduction

game-library-auth is an authentication service for the game-library web application. It is responsible for user authentication and authorization.

This service is part of a game-library web application:

  • game-library - main service for fetching, storing, and providing games data
  • current service handles authentication and authorization
  • game-library-ui - UI representation service

Table of Contents

Installation

Prerequisites: go, Docker, Make.

To set up the service, follow these steps:

  1. Clone the repository:

    git clone https://github.com/OutOfStack/game-library-auth.git
    cd game-library-auth
    
  2. Set up the database:

    make drunpg # runs postgres server with 'auth' db in docker container
    make migrate # applies all migrations to database
    
  3. Generate key pair for local JWT signing:

    make keygen # creates private/public key pair files
    
  4. Create the app.env file based on app.example.env and update it with your local configuration settings.

  5. Get Google API Client ID for Google OAuth and set it in app.env: https://developers.google.com/identity/gsi/web/guides/get-google-api-clientid

  6. Get Resend API key and set it along with the sender details in app.env: https://resend.com/api-keys

  7. Build and run the service:

    make build
    make run
    

Refer to the List of Make Commands for a complete list of commands.

Usage

After installation, you can use the following Make commands to develop the service:

  • make test: Runs tests for the whole project.
  • make generate: Generates proto files, documentation for Swagger UI and mocks for testing.
  • make lint: Runs golangci-lint for code analysis.

Refer to the List of Make Commands for a complete list of commands.

Tech Stack and Integrations

  • Data storage with PostgreSQL.
  • Tracing with Zipkin.
  • Log management with Graylog.
  • Transactional email delivery through Resend API.
  • Code analysis with golangci-lint.
  • CI/CD with GitHub Actions and deploy to Kubernetes (microk8s) cluster.

Configuration

Documentation

API documentation is available via Swagger UI. To generate the documentation, run:

make generate
gRPC

The service exposes a gRPC endpoint for internal service-to-service communication.

Address: localhost:9001 (configurable via APP_GRPC_ADDRESS in app.env)

Protocol Buffer Schema: api/proto/authapi/v1/authapi.proto

Testing with grpcurl:

# list services
grpcurl -plaintext localhost:9001 list

# Inspect service details
grpcurl -plaintext localhost:9001 describe authapi.v1.AuthApiService

# Call VerifyToken method
grpcurl -plaintext -d '{"token": "your-jwt-token-here"}' -emit-defaults localhost:9001 authapi.v1.AuthApiService/VerifyToken

List of Make Commands

Main Commands
build      builds app
build-mng  builds manage app
run        runs app
test       runs tests for the whole project
generate   generates docs for Swagger UI
lint       runs golangci-lint
cover      outputs tests coverage
Database Commands
drunpg     runs postgres server with 'auth' db in docker container
migrate    applies all migrations to database (reads from config file)
rollback   roll backs one last migration of database (reads from config file)
Key Management
keygen     creates private/public key pair files
secretgen  generates a cryptographically secure random secret for HMAC
Docker Commands
dbuildauth builds auth app docker image
dbuildmng  builds manage app docker image
drunauth   runs auth app in docker container

License

MIT License

Directories

Path Synopsis
cmd
Package docs Code generated by swaggo/swag.
Package docs Code generated by swaggo/swag.
internal
api
api/auth/mocks
Package auth_mocks is a generated GoMock package.
Package auth_mocks is a generated GoMock package.
api/grpc/authapi/mocks
Package authapi_mocks is a generated GoMock package.
Package authapi_mocks is a generated GoMock package.
api/unsubscribe/mocks
Package unsubscribe_mocks is a generated GoMock package.
Package unsubscribe_mocks is a generated GoMock package.
facade/mocks
Package facade_mocks is a generated GoMock package.
Package facade_mocks is a generated GoMock package.
web
pkg
database/mocks
Package database_mocks is a generated GoMock package.
Package database_mocks is a generated GoMock package.
log

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL