Transform endless URLs into powerful, trackable links with professional URL shortening, real-time analytics, and lightning-fast redirects.
- π Features
- πΈ Screenshots
- π οΈ Tech Stack
- π Prerequisites
- π Quick Start
- π¨ Frontend Options
- π Authentication & User Management
- π Project Structure
- π API Documentation
- π Development
- πΏ Branches
- π Deployment
- π§ Troubleshooting
- π€ Contributing
- Modern URL Shortening: Convert long URLs into short, shareable links with a stunning interface
- Dual Frontend Options: Choose between modern Next.js or lightweight vanilla JavaScript
- Real-time Analytics: Monitor click counts and performance metrics
- Professional Dashboard: Beautiful glassmorphism design with smooth animations
- User Authentication: JWT-based authentication for URL management
- Admin Interface: Django admin panel for user management and backend administration
- Mobile-First Design: Responsive interface that works perfectly on all devices
- One-Click Sharing: Copy to clipboard functionality with visual feedback
- Dark Theme: Modern gradient backgrounds with dynamic visual effects
- RESTful API: Clean API endpoints for integration
π Landing Page (Not Signed In)

- Django 4.2.7 - Python web framework
- Django REST Framework - API development
- PostgreSQL 12+ with psycopg2 - Database
- JWT Authentication - Secure user sessions
π₯ Modern Frontend (Next.js 15)
- Next.js 15.5.3 - React framework with App Router
- React 19 - Latest React with modern hooks
- TypeScript - Type-safe development
- Tailwind CSS v4 - Modern utility-first styling
- Glassmorphism UI - Contemporary design with backdrop blur effects
- Advanced Animations - Smooth transitions and micro-interactions
β‘ Legacy Frontend (Vanilla)
- HTML5, CSS3, JavaScript ES6+ - Lightweight and fast
- Tailwind CSS - Utility-first styling
- Vanilla JavaScript - No framework dependencies
- Simple animations - CSS-based transitions
- Railway/Render (backend)
- Vercel/Netlify (frontend)
- Python 3.8+ - Download
- Node.js 18+ - Download (for Next.js frontend)
- PostgreSQL 12+ - Download
- Git - Download
Verify installation:
python --version && node --version && psql --version && git --versiongit clone https://github.com/HERALDEXX/link-crush.git
cd link-crush
cd backend && python -m venv venv# Windows
.\venv\Scripts\activate.bat
# Unix-based (macOS, Linux, etc)
source venv/bin/activatepip install -r requirements.txt
cd .. # Go back to root directory for shared .envWindows:
copy .env.example .env
Unix-based (macOS, Linux, WSL, etc):
cp .env.example .env
Generate Django secret key:
cd backend
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"Edit .env file and replace SECRET_KEY value with the generated key.
Connect to PostgreSQL and create database:
psql -U postgres-- Create database
CREATE DATABASE link_crush;
-- Create user with password
-- Replace 'your_postgresql_password' with your desired password for the user link_crush_user
CREATE USER link_crush_user WITH ENCRYPTED PASSWORD 'your_postgresql_password';
-- Grant privileges
GRANT ALL PRIVILEGES ON DATABASE link_crush TO link_crush_user;
-- Connect to the database
\c link_crush;
-- Grant schema privileges
GRANT ALL ON SCHEMA public TO link_crush_user;
-- Exit
\qEdit .env file (in root directory) and replace the values for:
DATABASE_PASSWORDwith the password you set forlink_crush_userin Step 5DATABASE_HOSTif only you are using a custom host, otherwise leave aslocalhostDATABASE_PORTif only you set a custom port, otherwise leave as5432
cd backend
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser
python manage.py collectstatic # If DEBUG=Falsepython manage.py runserverWindows:
cd frontend && copy .env.example .env.local
Unix-based (macOS, Linux, WSL, etc):
cd frontend && cp .env.example .env.local
Choose between our modern Next.js frontend or lightweight legacy frontend:
Features:
- β¨ Stunning glassmorphism design
- π¨ Advanced animations and transitions
- π Lightning-fast performance
- π± Mobile-first responsive design
- π TypeScript for better development experience
Setup:
# New terminal window
cd frontend
npm install
npm run devAccess: http://localhost:3000
Features:
- πͺΆ Lightweight and fast
- π¦ No build process required
- π§ Simple to customize
- π Works in any browser
Setup:
# New terminal window
cd legacy-frontend
python -m http.server 8080Access: http://localhost:8080
Authentication is required for URL management operations including deleting URLs and accessing user-specific features.
User accounts must be created through the Django admin dashboard:
-
Start the backend server:
cd backend && python manage.py runserver
-
Access admin dashboard:
http://localhost:8000/admin/ -
Login with superuser credentials
-
Create new users with appropriate permissions
Users can log in through either frontend interface:
- Modern Frontend: Glassmorphism login form with smooth animations
- Legacy Frontend: Simple, clean login interface
- Both use JWT tokens for secure API access
- Staff/admin badges display user permissions
link-crush/
βββ frontend/ # π₯ Modern Next.js Frontend
β βββ src/
β β βββ app/
β β β βββ globals.css # Enhanced Tailwind v4 + animations
β β β βββ layout.tsx # Root layout
β β β βββ page.tsx # Main page component
β β βββ components/ # React components
β β β βββ AuthBlock.tsx # Glassmorphism auth interface
β β β βββ URLShortenerForm.tsx # Modern form with animations
β β β βββ StatisticsTable.tsx # Beautiful analytics display
β β β βββ Toast.tsx # Modern notifications
β β βββ hooks/ # Custom React hooks
β β βββ lib/ # Utilities and API client
β βββ package.json
β βββ tailwind.config.js # Tailwind v4 configuration
β
βββ legacy-frontend/ # β‘ Legacy Vanilla Frontend
β βββ index.html # Main HTML file
β βββ css/styles.css # Custom CSS animations
β βββ js/app.js # Vanilla JavaScript logic
β βββ config.js # Frontend configuration
β
βββ backend/ # Django Backend
β βββ urlshortener/ # Django project
β βββ urls/ # Django app
β βββ manage.py
β βββ requirements.txt
β βββ venv/ # Virtual environment
β
βββ database/postgresql_schema.sql # Database reference
βββ .env # Environment variables (not in VCS)
βββ .env.example # Environment template
βββ README.md
See docs/API_CONTRACT.md for full API specification.
Core Endpoints:
POST /api/shorten- Create shortened URLGET /api/stats- Get URL statisticsGET /{shortCode}- Redirect to original URLDELETE /api/urls/{shortCode}/- Delete URL (auth required)
Authentication:
POST /api/token/- Login and get JWT tokensGET /api/me- Get current user info
System:
GET /api/health- Health check
# Shorten URL
curl -X POST http://localhost:8000/api/shorten \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/long-url"}'
# Get statistics
curl http://localhost:8000/api/stats
# Login
curl -X POST http://localhost:8000/api/token/ \
-H "Content-Type: application/json" \
-d '{"username": "your_user", "password": "your_pass"}'Backend:
cd backend && .\venv\Scripts\activate.bat # or source venv/bin/activate on Unix (macOS, Linux, etc)
python manage.py runserverModern Frontend:
cd frontend && npm run devLegacy Frontend:
cd legacy-frontend && python -m http.server 8080Create .env.local in frontend directory for Next.js:
NEXT_PUBLIC_API_URL=http://localhost:8000/api
NEXT_PUBLIC_SHORT_URL_BASE=http://localhost:8000- Next.js Frontend: Edit files in
src/, hot reload is automatic - Legacy Frontend: Edit HTML/CSS/JS directly, refresh browser
- Backend: Django auto-reloads on file changes
cd backend
python manage.py makemigrations
python manage.py migrateCreate feature branches from dev: git checkout -b dev/feature/your-feature
Environment variables:
SECRET_KEY=your-production-secret-key-50-chars
DEBUG=False
DATABASE_NAME=production_db_name
DATABASE_USER=production_user
DATABASE_PASSWORD=production_password
DATABASE_HOST=production_host
DATABASE_PORT=5432
CORS_ALLOWED_ORIGINS=https://your-domain.com- Connect GitHub repository
- Framework preset: Next.js
- Root directory:
frontend - Environment variables:
NEXT_PUBLIC_API_URL=https://your-backend.railway.app/api NEXT_PUBLIC_SHORT_URL_BASE=https://your-backend.railway.app
- Connect GitHub repository
- Build directory:
legacy-frontend - No build command needed
- Update
config.jswith production API URL
Server won't start:
- Check PostgreSQL is running:
sudo systemctl status postgresql - Verify
.envdatabase credentials - Ensure virtual environment is activated
Database connection failed:
- Test connection:
psql -U link_crush_user -d link_crush -h localhost - Check database exists:
psql -U postgres -l | grep link_crush
Next.js build fails:
- Clear cache:
rm -rf .next node_modules package-lock.json - Reinstall:
npm install - Check Node.js version:
node --version(requires 18+)
Tailwind styles not working:
- Ensure you're using Tailwind v4 syntax in
globals.css - Restart dev server after config changes
API calls failing:
- Check
NEXT_PUBLIC_API_URLin.env.local - Verify backend is running on correct port
- Check browser Network tab for CORS errors
CORS errors:
- Add frontend URL to
CORS_ALLOWED_ORIGINSin Django settings - Ensure trailing slashes match between frontend and backend URLs
JWT token expired:
- Tokens auto-refresh in modern frontend
- Legacy frontend requires manual re-login
- Fork the repository
- Create feature branch from
dev - Make your changes
- Test both frontend options
- Submit pull request to
devbranch
Please read CONTRIBUTING.md for detailed guidelines.
MIT License - see LICENSE file for details.
β Star this repo if you found it helpful!
π‘ Have a feature idea? We'd love to hear it in discussions


