This repository is extracted from my Transcendence project at Hive Helsinki.
During the Transcendence project, our team built an online Ping-Pong game with a microservice architecture.
I was responsible for designing and implementing the auth/user service with Go and Gin.
I also implemented a minimal frontend prototype using Svelte for learning purposes. It's just a quick demo, so for UI/UX I just applied the default theme from shadcnui.
https://github.com/user-attachments/assets/550b8a53-5775-47e8-8d4f-c42a7e174bf7
Currently supported features include:
gin: web frameworkgorm: ORMgo-redis: Redisgo-playground/validator v10: data validationgodotenv: environment variablesslog-gin: logginggin-swagger: Swagger (OpenAPI) docsSvelte: frontend frameworkTailwind CSS : CSSshadcn/ui (Svelte): UI libraryZod: ValidatorSvelteKit Superforms: Form (SPA)Please make sure you have Go installed.
git clone https://github.com/danielxfeng/auth-user-prototype.git
cd auth-user-prototype
cd backend
cp .env.sample .env
make dev
Then navigate to http://localhost:3003/api/docs/index.html for swagger.
Required env vars for backend startup:
JWT_SECRETGOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRETThe provided backend/.env.sample already includes local placeholder values for these, so backend can start even if you are not testing Google OAuth.
Redis is optional. In local development it is disabled by default (REDIS_URL= in .env).
To enable Redis locally:
# example: run redis with docker
docker run --rm -p 6379:6379 redis:latest
# enable redis mode for the backend
export REDIS_URL=redis://localhost:6379/0 # or set it in backend/.env
Token extension (sliding expiration) in Redis mode:
USER_TOKEN_EXPIRY controls the Redis TTL and is extended on token validation.USER_TOKEN_ABSOLUTE_EXPIRY caps the maximum lifetime via the JWT exp claim.cd frontend
pnpm run dev
Then navigate to http://localhost:5173.
Note: Google login does not work locally until Google OAuth credentials are configured.
Due to the constraints of the Hive project, SQLite was required for the project.
As a result:
SQLite for core data due to Hive constraints.