How swoggoi/url-shorter works
This repository is structured as a URL-shortening service with URL and user domain models, service interfaces, HTTP transport, and PostgreSQL/Redis repository implementations. The apparent workflow is HTTP requests through transport and services to storage, but the sampled transport and operation files do not expose those calls, and main is empty; those connections are therefore omitted. The graph preserves the visible service/domain and DTO/domain relationships, plus the distinct rate-limit component, without claiming unshown wiring.
Main entry points: url.go URL model · user.go User model · errors.go Domain errors · dto_common.go URL DTO mapping
Components 13
HTTP transport
- URL transport
internal/transport/http/url/transport.go - URL DTO mapping
internal/transport/http/url/dto_common.go
Domain services
- URL service
internal/service/url - User service
internal/service/user
Domain models
- URL model
internal/domain/url.go - User model
internal/domain/user.go - Domain errors
internal/errors/errors.go
Persistence and cache
- URL PostgreSQL repository
internal/repository/url/postgres - User PostgreSQL repository
internal/repository/user/postgres - URL Redis repository
internal/repository/url/redis - User Redis repository
internal/repository/user/redis - URL rate limiting
internal/repository/url/ratelimit/redis.go
Other components
- HTTP client
Connections 5
- URL service → URL model: uses types
internal/service/url/service.go - User service → User model: uses types
internal/service/user/service.go - URL DTO mapping → URL model: maps from
internal/transport/http/url/dto_common.go - URL model → Domain errors: returns errors
internal/domain/url.go - User model → Domain errors: returns errors
internal/domain/user.go