How bharabhi01/shorturl-go works
Project Type and Purpose
• This project is a microservice-style, full-stack backend application written in Go. Its primary purpose is to offer a scalable URL shortening service.
• Key features include generating short URLs from long ones, redirecting users, rate limiting via middleware, and performance improvements using Redis caching alongside PostgreSQL for persistent storage.
File Structure
• Top-level directories such as "api", "cmd", "config", and "internal" indicate separation of concerns:
• The "api" folder contains HTTP handlers and middleware (e.g., logging and rate limiting), which suggests that incoming HTTP requests are managed here.
• The "cmd" directory holds executable commands, specifically the server launch (cmd/server/main.go) and test-related utilities (cmd/test).
• The "config" directory is used for configuration settings.
• The "internal" directory is split into:
• "repository": Handles data interactions (database and cache logic) and defines the data models.
• "service": Contains business logic that processes URL shortening and redirection.
• The use of separate directories emphasizes the architectural principle of modularity and clear separation of the data layer, business logic, and API layer.
Additional Insights from the README
• The README gives an overview of the tech stack (Go, Gin for the web framework, PostgreSQL, and Redis).
• It outlines the API endpoints (GET for redirects, POST for URL creation, and a health check), which helps in mapping out the communication flow.