SnapLink is a modern, scalable URL shortener built with Django (Python) and React (Frontend). It allows users to shorten URLs, track visits, and manage links via a REST API & Web Interface.
- Convert long URLs into short, shareable links
- Support for custom vanity URLs (Planned)
- Click Tracking – Monitor total clicks per short URL
- Daily Unique Visitors – Track users based on IP
- Geolocation & Device Data (Future Feature)
- Set Expiration – Define a custom expiry date for short links
- One-Time Use Links – Auto-delete after first visit
- JWT-Based Authentication with access_token & refresh_token
- User Registration & Login
- Personalized Dashboard – Users can manage their URLs
- Django Cache (Redis) for fast URL redirection
- Database Indexing & Optimization for efficient queries
- ✅ PostgreSQL Database Integration
- ✅ Rate Limiting for API security (Django Rest Framework)
- 🔜 Dockerized Deployment (Planned)
- 🔜 CI/CD Pipelines with GitHub Actions (Planned)
- 🔜 Error Monitoring with Sentry (Planned)
- Python (Django)
- Django REST Framework (DRF)
- PostgreSQL (Database)
- Redis (Caching)
- React (with Vite)
- Tailwind CSS (for styling)
-
Clone the Repository
git clone https://github.com/madhvi-n/snaplink.git cd snaplink
-
Set up a virtual environment
python -m venv venv source venv/bin/activate # On macOS/Linux venv\Scripts\activate # On Windows
-
Install Dependencies
pip install -r requirements.txt
-
Set up PostgreSQL database
sudo -u postgres psql CREATE DATABASE snaplink; CREATE USER snaplink_user WITH PASSWORD 'yourpassword'; ALTER ROLE snaplink_user SET client_encoding TO 'utf8'; ALTER ROLE snaplink_user SET default_transaction_isolation TO 'read committed'; ALTER ROLE snaplink_user SET timezone TO 'UTC'; GRANT ALL PRIVILEGES ON DATABASE snaplink TO snaplink_user;
-
Apply Database Migrations & Create Superuser
python manage.py migrate python manage.py createsuperuser
-
Run the Development Server
python manage.py runserver
Access at: http://127.0.0.1:8000
-
Navigate to the Frontend Folder
cd frontend/snap_link
-
Install dependencies
npm install
-
Set Backend API URL Create a .env file in the frontend root and add:
VITE_API_URL=http://localhost:8000/api/v1
-
Start the development server
npm run dev
The API documentation is available via Swagger:
- Swagger UI:
http://127.0.0.1:8000/api/swagger/
- Redoc:
http://127.0.0.1:8000/api/redoc/
- DRF Browsable API:
http://127.0.0.1:8000/api/v1/
SECRET_KEY=django-secret-key
DEBUG=True
BASE_URL=http://localhost:8000
REDIS_URL=your-redis-url
ALLOWED_HOSTS=localhost,127.0.0.1
DB_NAME=snaplink
DB_USER=postgres
DB_PASSWORD=123456
- Dockerization
- CI/CD Pipelines with GitHub Actions
- Production Database Setup
- ✅ Core URL Shortening (short links)
- ✅ Click Tracking (monitor total clicks per URL)
- ✅ Expiration & One-Time Use Links
- ✅ JWT-Based Authentication (access_token & refresh_token)
- ✅ User Registration & Login
- ✅ PostgreSQL Database Integration
- ✅ Rate Limiting for API security
- ⬜ Custom Vanity URLs (personalized short links)
- ⬜ Geolocation & Device Tracking
- ⬜ User Dashboard for managing URLs
- ⬜ Dockerized Deployment
- ⬜ CI/CD Pipelines with GitHub Actions
- ⬜ Error Monitoring with Sentry