Check out URLShorty here
Welcome to URLShorty! This project is a URL shortener built using Go, HTML, and SQLite, allowing users to shorten long URLs for easy sharing. This is a fun little side-project in which I explore networking basics using HTTP as well as exploring the potential of Go as an efficient backend in web applications.
URLShorty's architecture involves a Go backend, Gorilla Mux
+ HTTP
for routing, SQLite
for database storage, and HTML
+ CSS
for the frontend. Mutexes are used to handle concurrent access to the database.
-
Backend:
- Go (Golang)
- Gorilla Mux (Router)
- SQLite3 (Database)
-
Frontend:
- HTML
- CSS
-
Deployment:
- Render
-
Clone the repository:
git clone https://github.com/khairalanam/urlshorty.git
-
Navigate to the project directory:
cd urlshorty
-
Build and run the Go application:
go run .
-
Access the interface at: http://localhost:3000.
URLShorty is deployed on Render for seamless hosting and accessibility.
URLs are shortened using a simple randomised algorithm, guaranteeing short and collision-resistant identifiers.
To handle concurrent reads and writes to the SQLite3 database, URLShorty utilizes mutexes. This ensures that only one operation can access the database at a time, preventing race conditions and ensuring data consistency.
The frontend provides a simple and user-friendly interface, allowing users to input long URLs and receive shortened links.
Contributions to URLShorty are welcome! You can fork this repository and change the project to your liking!
URLShorty is open-source software released under the MIT License. See the LICENSE file for details.