How egor-abramov/avitowinter25 works
AvitoWinter25 is a Go HTTP service for user authentication and virtual-coin commerce. The visible runtime workflow accepts login or authenticated requests, routes them through handlers and services, and uses PostgreSQL-backed repositories for account, coin, and merchandise operations. Coin transfers and merchandise purchases run through a transaction manager. The source also registers an information endpoint; its detailed composition is not established by the shown excerpts. The README gives no further capability detail, so relationships beyond the visible wiring and calls are omitted.
Main entry points: app.go Router and app · merch.go Merchandise · coin.go Coin repository · user.go User repository
Components 18
HTTP runtime
- Router and app
internal/app/app.go - Auth handler
internal/handler/auth.go - Coin handler
internal/handler/coin.go - Merch handler
internal/handler/merch.go - Info handler
internal/handler/info.go - JWT middleware
internal/handler/middleware/jwt.go
Domain services
- Authentication
internal/service/auth/auth.go - Coin transfers
internal/service/coin/coin.go - Merchandise
internal/service/merch/merch.go - Account info
internal/service/info/info.go
Persistence
- User repository
internal/repo/user.go - Coin repository
internal/repo/coin.go - Merch repository
internal/repo/merch.go - PostgreSQL
Application setup
- Configuration
internal/config/config.go - Pool setup
internal/infrastructure/postgres/setup.go - Process entry
cmd/main.go
Other components
- API client
Connections 25
- API client → Router and app: sends requests
internal/app/app.go - Router and app → Auth handler: routes auth
internal/app/app.go - Router and app → Coin handler: routes transfers
internal/app/app.go - Router and app → Merch handler: routes purchases
internal/app/app.go - Router and app → Info handler: routes info
internal/app/app.go - Router and app → JWT middleware: protects routes
internal/app/app.go - Auth handler → Authentication: calls login
internal/handler/auth.go - Authentication → User repository: reads and creates users
internal/service/auth/auth.go - Router and app → Authentication: constructs
internal/app/app.go - Router and app → Coin transfers: constructs
internal/app/app.go - Router and app → Merchandise: constructs
internal/app/app.go - Router and app → Account info: constructs
internal/app/app.go - Router and app → User repository: constructs
internal/app/app.go - Router and app → Coin repository: constructs
internal/app/app.go - Router and app → Merch repository: constructs
internal/app/app.go - Coin transfers → Coin repository: reads and updates
internal/service/coin/coin.go - Coin transfers → User repository: checks and reads users
internal/service/coin/coin.go - Merchandise → Merch repository: reads and records merch
internal/service/merch/merch.go - Merchandise → Coin repository: deducts coins
internal/service/merch/merch.go - Merchandise → User repository: reads user
internal/service/merch/merch.go - Coin repository → PostgreSQL: queries
internal/repo/coin.go - Process entry → Configuration: loads settings
cmd/main.go - Process entry → Router and app: starts and stops
cmd/main.go - Router and app → Pool setup: opens pool
internal/app/app.go - Pool setup → PostgreSQL: connects
internal/infrastructure/postgres/setup.go