How iamn1/link-shortener works
MaizLink is a web URL-shortening service with guest and registered-user links, RBAC, authentication, analytics, administration, and operational integrations. The main workflow accepts a shorten request, creates a link through the application layer, persists it, and later redirects visitors; the README also documents batch creation, QR codes, asynchronous click counting, and email confirmation. The graph combines these documented capabilities with the sampled controller, context, and infrastructure evidence; several internal calls are left unverified where their implementation was not shown.
Main entry points: api_controller.py API controllers · manager.py SQL database · create_short_link.py Create short link · redirect_link.py Redirect workflow
Components 28
Web interface
- API controllers
src/link_shortener/web/controllers/api_controller.py - Auth controller
src/link_shortener/web/controllers/auth_controller.py - Request security
src/link_shortener/web/security/context.py
Application workflows
- Request context
src/link_shortener/application/context.py - Link workflows
src/link_shortener/application/facades/link_service.py - Create short link
src/link_shortener/application/use_cases/links/create_short_link.py - Batch creation
src/link_shortener/application/use_cases/batch/batch_create_links.py - Redirect workflow
src/link_shortener/application/use_cases/links/redirect_link.py - Account workflows
src/link_shortener/application/facades/auth_service.py - Auth DTOs
src/link_shortener/application/dtos/auth.py - Use-case base
src/link_shortener/application/use_cases/base_use_case.py - Authentication port
src/link_shortener/application/ports/auth/auth_service.py - Statistics workflows
src/link_shortener/application/use_cases/stats/get_visit_stats.py - Admin workflows
src/link_shortener/application/facades/admin_service.py
Domain model
- Link model
src/link_shortener/domain/entities/link.py - Refresh session
src/link_shortener/domain/entities/refresh_session.py - Domain errors
src/link_shortener/domain/exceptions.py - Translatable messages
src/link_shortener/domain/i18n.py
Infrastructure
- JWT authentication
src/link_shortener/infrastructure/auth/jwt_auth_service.py - SQL database
src/link_shortener/infrastructure/database/manager.py - SQL repositories
src/link_shortener/infrastructure/database/repositories/sqlalchemy_refresh_session_repository.py - Dependency container
src/link_shortener/infrastructure/di/container.py - Cache adapters
src/link_shortener/infrastructure/cache/redis_cache.py - Task queue
src/link_shortener/infrastructure/task_queue/celery_queue.py - Click and mail tasks
src/link_shortener/infrastructure/task_queue/tasks.py - Operations CLI
src/link_shortener/infrastructure/cli/adapters/flask.py
Other components
- Visitor
- SMTP mail
Connections 29
- Visitor → API controllers: shortens or redirects
README.md - API controllers → Link workflows: requests link action
src/link_shortener/web/controllers/api_controller.py - Link workflows → Create short link: delegates creation
- Create short link → SQL database: persists link
README.md - API controllers → Batch creation: accepts batch requests
README.md - API controllers → Redirect workflow: routes code lookup
README.md - Redirect workflow → Cache adapters: uses redirect cache
README.md - Redirect workflow → SQL database: resolves link
README.md - Create short link → Link model: creates domain link
- API controllers → Request context: builds request context
src/link_shortener/web/controllers/api_controller.py - Request context → Create short link: supplies request metadata
src/link_shortener/application/context.py - Auth controller → Account workflows: calls account workflows
src/link_shortener/web/controllers/auth_controller.py - Account workflows → Authentication port: uses authentication service
- Authentication port → JWT authentication: implemented by
src/link_shortener/infrastructure/auth/jwt_auth_service.py - Auth controller → Auth DTOs: formats responses
src/link_shortener/web/controllers/auth_controller.py - Request security → JWT authentication: validates session
- SQL database → SQL repositories: provides sessions
src/link_shortener/infrastructure/database/manager.py - Dependency container → SQL database: configures database
- API controllers → Cache adapters: uses two-level caching
README.md - API controllers → Task queue: queues click work
README.md - Task queue → Click and mail tasks: dispatches tasks
README.md - Click and mail tasks → SQL database: records clicks
README.md - Click and mail tasks → SMTP mail: sends confirmation mail
README.md - API controllers → Statistics workflows: serves analytics
README.md - API controllers → Admin workflows: serves administration
README.md - Operations CLI → Dependency container: gets application services
src/link_shortener/infrastructure/cli/adapters/flask.py - Use-case base → Request context: shares request metadata
src/link_shortener/application/use_cases/base_use_case.py - Domain errors → Translatable messages: marks translatable text
src/link_shortener/domain/i18n.py - SQL repositories → Refresh session: maps session entity
src/link_shortener/infrastructure/database/repositories/sqlalchemy_refresh_session_repository.py