How shravanashok16/urlshortener works
This is a layered .NET URL-shortening API. Users register or log in to obtain JWTs; link endpoints create and list short URLs, redirect requests record click metadata before redirecting, and deletion deactivates links. The README also documents pagination, click counts, hashed IP storage, and persistence in Neon/PostgreSQL. The excerpts show the controller, token, and EF Core interactions; database hosting and endpoint behavior beyond those excerpts are based on README documentation.
Main entry points: LinksController.cs Link operations · AppDbContext.cs EF Core context · AuthController.cs Authentication · Program.cs Application setup
Components 10
HTTP API
- Authentication
UrlShortener.Api/Controllers/AuthController.cs - Link operations
UrlShortener.Api/Controllers/LinksController.cs - JWT issuer
UrlShortener.Api/Services/TokenService.cs - Request and response DTOs
UrlShortener.Api/Models - Application setup
UrlShortener.Api/Program.cs
Domain
- Short-code generator
UrlShortener.Core/Services/ShortCodeGenerator.cs - User, link, click
UrlShortener.Core/Entities
Persistence
- EF Core context
UrlShortener.Infrastructure/Data/AppDbContext.cs - Neon PostgreSQL
Other components
- API client
Connections 13
- API client → Authentication: register or log in
README.md - API client → Link operations: manage links
README.md - Authentication → EF Core context: checks and saves users
UrlShortener.Api/Controllers/AuthController.cs - Authentication → JWT issuer: issues token
UrlShortener.Api/Controllers/AuthController.cs - Authentication → Request and response DTOs: uses auth DTOs
UrlShortener.Api/Controllers/AuthController.cs - Link operations → Short-code generator: generates code
UrlShortener.Api/Controllers/LinksController.cs - Link operations → EF Core context: queries and saves
UrlShortener.Api/Controllers/LinksController.cs - Link operations → Request and response DTOs: uses link DTOs
UrlShortener.Api/Controllers/LinksController.cs - Link operations → User, link, click: creates click records
UrlShortener.Api/Controllers/LinksController.cs - EF Core context → User, link, click: maps entity sets
UrlShortener.Infrastructure/Data/AppDbContext.cs - Application setup → EF Core context: configures PostgreSQL
UrlShortener.Api/Program.cs - Application setup → JWT issuer: registers service
UrlShortener.Api/Program.cs - EF Core context → Neon PostgreSQL: persists application data
README.md