Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

✂️ snip.dev — URL Shortener

A full-stack URL shortener built with the MERN stack. Paste any long URL and get a clean short link instantly, with click tracking included.

Features

  • 🔗 Shorten any long URL instantly
  • 📊 Track click counts per link
  • 🕒 Recent links dashboard
  • 🐳 Dockerized backend + MongoDB

Tech Stack

  • Frontend: React, Vite
  • Backend: Node.js, Express
  • Database: MongoDB, Mongoose
  • DevOps: Docker, Docker Compose

Local Setup

Prerequisites

  • Node.js v20+
  • Docker Desktop

1. Clone the repo

git clone https://github.com/Akshita0502/snip.dev.git
cd snip.dev

2. Set up environment variables

backend/.env

MONGO_URL=mongodb://mongo:27017/urlshortener
BASE_URL=http://localhost:5000
PORT=5000

frontend/.env

VITE_API_URL=http://localhost:5000

3. Start backend + MongoDB

docker-compose up --build

4. Start frontend

cd frontend
npm install
npm run dev

API Endpoints

Method Endpoint Description
GET / Health check
POST /shorten Shorten a URL
GET /r/:code Redirect to original URL
GET /stats/:code Get click stats
GET /all Get all recent URLs

Project Structure

snip.dev/
├── backend/
│   ├── server.js
│   ├── package.json
│   ├── Dockerfile
│   └── .env
├── frontend/
│   ├── src/
│   │   ├── App.jsx
│   │   └── main.jsx
│   ├── index.html
│   ├── package.json
│   ├── vite.config.js
│   └── .env
└── docker-compose.yml

About

A full-stack URL shortener built with the MERN stack (MongoDB, Express, React, Node.js). Shorten long URLs instantly and track click counts.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages