A modern URL Shortener application built using Go, with a clean architecture and MongoDB integration. This project demonstrates the implementation of a three-tier architecture using Docker for containerization. The CI/CD pipeline is managed with Jenkins, and security analysis is conducted using Trivy. The application is built and pushed to AWS ECR (Elastic Container Registry) and deployed on an AWS EKS (Elastic Kubernetes Service) cluster.
Checkout URL_Shortener (https://url-shortener-with-go-l2go.vercel.app/)
- Project Overview
- Features
- Architecture
- Tech Stack
- Installation
- Usage
- Testing
- Contributing
- License
- Contact
The URL Shortener With Go is a web application designed to shorten long URLs into concise links. The application is structured using a three-tier architecture, leveraging Go for the backend, MongoDB for data storage, and a static frontend for user interaction.
This project is an ideal demonstration for those looking to understand how to create scalable web applications with Go and MongoDB while employing containerization for deployment.
- URL Shortening: Convert long URLs into short, manageable links.
- Analytics Dashboard: Track click counts and URL usage statistics.
- User Authentication: Secure login and user management.
- RESTful API: Comprehensive API for integration with other services.
- Dockerized Environment: Seamless setup and deployment with Docker.
- Scalable Design: Three-tier architecture for robust and scalable solutions.
The project follows a three-tier architecture:
-
Presentation Layer (Frontend):
- A static landing page built with HTML, CSS, and JavaScript.
- Provides an intuitive interface for users to shorten URLs and view analytics.
-
Application Layer (Backend):
- Built with Go, handling all business logic.
- Exposes RESTful API endpoints for URL operations.
-
Data Layer (Database):
- MongoDB used for storing URL mappings and user data.
- Ensures high availability and easy scalability.
+-------------------+
| Presentation |
| (Frontend) |
+-------------------+
|
|
+-------------------+
| Application |
| (Backend/Go) |
+-------------------+
|
|
+-------------------+
| Data |
| (MongoDB) |
+-------------------+
- Go (Golang): v1.21
- MongoDB: v5.0
- Docker: v20.10
- HTML/CSS/JavaScript: Static files for frontend
git clone https://github.com/ARUP-G/URL-Shortener-With-GO.git
cd URL-Shortener-With-GO
-
Start MongoDB:
Ensure MongoDB is running on your machine. You can start it with:
mongod --config /usr/local/etc/mongod.conf --fork
-
Install Dependencies:
Navigate to the backend folder and install dependencies:
cd backend go mod tidy
-
Run the Application:
go run main.go
-
Open the Frontend:
Open the
index.html
file in your browser to start using the application.
-
Build and Start Containers:
docker-compose up --build
-
Access the Application:
Visit
http://localhost:8181
in your browser.
- Shorten URL: Enter a long URL on the landing page to receive a shortened link.
- Track URL: Log in to access analytics and view click statistics for your shortened URLs.
- API Access: Use the provided API to integrate URL shortening functionality into your applications.
Method | Endpoint | Description |
---|---|---|
POST | /api/v1/shorten |
Shortens a provided URL |
GET | /api/v1/{shortURL} |
Redirects to the original URL |
The project includes a GitHub Actions workflow to automate testing and ensure code quality.
Contributions are welcome! Please read the CONTRIBUTING.md file for guidelines on how to contribute to this project.
- Fork the repository.
- Create a new feature branch (
git checkout -b feature/YourFeature
). - Commit your changes (
git commit -m 'Add your feature'
). - Push to the branch (
git push origin feature/YourFeature
). - Open a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
For any inquiries or feedback, feel free to reach out:
- GitHub: ARUP-G
- Email: arupdascontact@gmail.com
- Special thanks to the open-source community for providing valuable resources and inspiration.
- Inspired by various URL shortener projects available online.
Feel free to customize the sections and content according to your project's specific details and requirements. If you have any additional features or specific instructions, you can add them to the appropriate sections.