Trimly — URL Shortening & Link Analytics
A URL-shortening and link-analytics product built around reliable redirects, link ownership, and an event-driven analytics pipeline.
The product
Trimly is a link-management product that turns long URLs into short, shareable links and records click events for analytics. The product combines a fast redirect path with an authenticated management experience for creating and managing links.
Explore Trimly
Explore the live application to experience the product interface. For the complete experience, open Trimly in a separate tab.
If the embedded application does not load, open Trimly directly using the link above. Authentication and browser restrictions may affect the embedded experience.
The problem
Long URLs are awkward to share and difficult to manage consistently. A useful link-shortening service must do more than generate a short string: it must resolve links reliably, enforce ownership, support link lifecycle rules, and collect analytics without making every redirect depend on expensive reporting work.
Product priorities
Component
Reliable redirects
Resolve a short code and redirect users to its destination, using Redis to cache frequently accessed mappings.
Component
Link ownership
Keep management operations scoped to the authenticated owner instead of exposing another user's links.
Component
Actionable analytics
Capture click events and process them through a separate event pipeline for later reporting.
Component
Account security
Use Spring Security, JWT-based authentication, password hashing, and the implemented account-security flows.
Experience and capabilities
The implemented product includes short-link creation, custom aliases, link ownership, URL expiration, authentication, two-factor authentication, Google sign-in, click analytics, Redis caching, and Kafka-based analytics processing. Feature availability and behavior should be verified against the current deployed version before this case study is published as a product specification.
System architecture
The architecture separates the user-facing application, redirect resolution, cache, event transport, and durable analytics storage. The following diagram is a high-level representation of the current implementation rather than a deployment or latency benchmark.
Component
Browser / Cloudflare Worker
Serves the frontend and routes API or short-link requests to the backend.
Component
Spring Boot API
Handles application endpoints, authorization, link management, and redirect resolution.
Component
Redis
Caches short-code lookups to reduce repeated database reads on the redirect path.
Component
Kafka
Carries click-event messages to decouple analytics processing from reporting storage.
Component
PostgreSQL
Persists application data and click-event records for analytics queries.
Redirect flow: Browser → Cloudflare Worker → Spring Boot → Redis (cache lookup) → HTTP redirect.
Analytics flow: Click event → Kafka → consumer → PostgreSQL → analytics API → dashboard.
Key engineering decisions
- Cache hot redirect mappings: use Redis for repeated short-code lookups while retaining PostgreSQL as the durable data store.
- Separate analytics processing: use Kafka as an event boundary so analytics persistence can be handled by a consumer rather than coupling reporting queries to the redirect handler.
- Scope reverse lookups by owner: avoid using a global long-URL lookup that could reveal another user's link association.
- Version database changes: use Flyway migrations to make schema evolution repeatable.
Trade-offs to communicate
- A cache improves repeated lookups but introduces invalidation and consistency concerns.
- Kafka adds operational complexity; its value depends on event volume, failure isolation, and processing requirements.
- If the redirect request waits for Kafka acknowledgement, the event pipeline is not fully removed from redirect latency. This is an important optimization opportunity to measure.
- Authentication and authorization must be enforced on the server for every protected operation, regardless of frontend state.
Technology
Component
Backend
Java, Spring Boot, Spring Security, Maven, and Flyway.
Component
Data and events
PostgreSQL, Redis, Apache Kafka, and Spring Kafka.
Component
Frontend
React, TypeScript, Vite, Tailwind CSS, and React Router.
Component
Deployment
Render, Neon PostgreSQL, Upstash Redis, Aiven Kafka, and Cloudflare Workers.
What this project demonstrates
Trimly brings together API design, authentication, data modelling, caching, event-driven processing, deployment, and frontend integration in one product. The most valuable evidence is the implemented system, its tests, the architectural trade-offs, and the ability to explain what should be measured and improved next.
Next improvements
Potential next steps include measuring redirect latency under controlled load, reviewing the synchronous Kafka publish path, expanding analytics, strengthening operational observability, and improving link-management workflows. These are presented as future work, not as already delivered capabilities.