Skip to content

itsrcx/url-shortner-factory

Repository files navigation

⚡ URL Shortener Factory

A serverless URL shortener with animated factory-themed UI built on AWS.

🎯 Features

  • 🏭 Factory Animation - Watch URLs get processed in a digital factory
  • Serverless - Built with AWS Lambda, API Gateway, DynamoDB
  • 🔒 Rate Limiting - 10 URLs per IP per day
  • URL Validation - Frontend format check + backend accessibility check
  • 📱 Mobile Responsive - Works on all devices
  • 🎨 Modern UI - Smooth animations and gradients

📋 Prerequisites

  • AWS CLI configured
  • AWS SAM CLI installed
  • Bash shell

🚀 Deployment

Quick Deploy

chmod +x deploy.sh
./deploy.sh

Choose N when asked about CloudFront (unless you need CDN).

What Gets Created

  • Lambda Functions: URL creation and redirection
  • API Gateway: HTTP API endpoints
  • DynamoDB Table: URL storage with rate limiting
  • S3 Bucket: Static website hosting
  • CloudFront (optional): CDN distribution and https with OAC

🧪 Testing

After deployment, test the API:

# Create short URL
curl -X POST https://YOUR-API-URL/shortner/create \
  -H 'Content-Type: application/json' \
  -d '{"long_url":"https://example.com"}'

# Access short URL (redirects)
curl -I https://YOUR-API-URL/shortner/SHORT_CODE

🗑️ Cleanup

Delete all AWS resources:

chmod +x cleanup.sh
./cleanup.sh

This removes:

  • S3 bucket and files
  • CloudFormation stack (all resources)
  • Local build artifacts

📁 Project Structure

url-shortner/
├── src/
│   ├── lambda/             # Python Lambda functions
│   └── static-web/         # Frontend (HTML/CSS/JS)
├── template.yml            # SAM template
├── cloudfront-template.yml # Coludfront deployment with OAC
├── deploy.sh               # Deployment script
├── cleanup.sh              # Cleanup script
└── README.md

🎨 Frontend Features

  • Animated conveyor belts
  • Rotating factory machine during processing
  • Smooth transitions and error handling
  • Copy to clipboard functionality
  • URL format validation

🔧 Configuration

Edit deploy.sh and cleanup.sh to change:

  • PROJECT_NAME - Project identifier
  • REGION - AWS region (default: ap-south-1)

💰 Cost

  • Free Tier: Likely free for low usage
  • DynamoDB: On-demand pricing
  • Lambda: Pay per request
  • API Gateway: Pay per request
  • S3: Minimal storage costs

🤝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Quick Start for Contributors

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test locally with ./deploy.sh
  5. Submit a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

📝 Made with ❤️ in 2025

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors