shrinkit

module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2025 License: MIT

README ΒΆ

ShrinkIt β€” Serverless URL Shortener

ShrinkIt is an open-source, serverless URL shortener built with AWS SAM and Go (Golang). It allows you to shorten long URLs into tiny, shareable links while staying cost-efficient and fully under your control.

✨ Features

  • πŸ”— Short URLs β€” Generate simple, easy-to-share links.
  • ⚑ Serverless β€” Powered by AWS Lambda for high scalability and low cost.
  • πŸ›  Built with Go β€” Fast, efficient, and highly portable.
  • 🧩 Infrastructure as Code β€” Managed using AWS SAM templates.

πŸ—οΈ Architecture

ShrinkIt is designed as a fully serverless app:

  • API Gateway β€” Provides REST endpoints for creating and retrieving short URLs.
  • Lambda (Go) β€” Business logic written in Go, handling shortening and redirection.
  • DynamoDB β€” Stores original URLs and short-code mappings.
  • AWS SAM β€” Deploys and manages the entire infrastructure.
[ Client ] β†’ [ API Gateway ] β†’ [ Lambda (Go) ] β†’ [ DynamoDB ]

πŸš€ Getting Started

Prerequisites
1. Clone the Repository
git clone https://github.com/ticatwolves/shrinkIt.git
cd shrinkIt
2. Build the Project
make build
3. Deploy to AWS
make deploy

Follow the prompts to configure stack name, region, and permissions.

4. Usage
  • Shorten a URL

    curl -X POST https://<api-id>.execute-api.<region>.amazonaws.com/prod     -H "Content-Type: application/json"     -d '{"url": "https://example.com/very/long/url"}'
    

    Response:

    { "short_url": "https://<api-id>.execute-api.<region>.amazonaws.com/prod/shrink/abcd123" }
    
  • Redirect to original URL

    curl -i https://<api-id>.execute-api.<region>.amazonaws.com/prod/shrink/abcd123
    

πŸ›  Development

Run Locally with SAM
make local-start

Test with:

curl http://127.0.0.1:3000/shrink -d '{"url":"https://example.com"}'

πŸ“‚ Project Structure

.
β”œβ”€β”€ cmd/             # Go Lambda handler
β”œβ”€β”€ internal/        # Business logic
β”œβ”€β”€ deploy/template.yaml    # AWS SAM template
β”œβ”€β”€ go.mod
└── README.md

πŸ“œ License

This project is licensed under the MIT License.

Directories ΒΆ

Path Synopsis
internal
db

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL