URL Shortener - URLbits
A modern, secure URL shortener built with Next.js 15, featuring a clean UI, analytics dashboard, and localStorage-based storage.
Features
- π URL Shortening: Create short, memorable links for long URLs
- π Analytics Dashboard: Track clicks and manage your shortened URLs
- π Security: Malicious URL detection and input sanitization
- π± Responsive Design: Works perfectly on all devices
- π¨ Modern UI: Clean, intuitive interface with Tailwind CSS
- πΎ Local Storage: No server required - everything stored locally
- π Search & Sort: Find and organize your URLs easily
Live Demo
Visit the live application: https://Coderhacks444.github.io/URLbits
Local Development
Prerequisites
Installation
- Clone the repository:
git clone https://github.com/Coderhacks444/URLbits.git
cd URLbits
- Install dependencies:
- Run the development server:
- Open http://localhost:3000 in your browser.
Deployment to GitHub Pages
Automatic Deployment (Recommended)
-
Fork or Clone this repository to your GitHub account
- Update Repository Settings:
- Go to your repository settings
- Navigate to βPagesβ section
- Set source to βGitHub Actionsβ
- Update Configuration:
- Edit
package.json
and replace Coderhacks444
with your actual GitHub username
- Update
next.config.js
if your repository name is different from URLbits
- Push to Main Branch:
git add .
git commit -m "Initial commit"
git push origin main
- Check Deployment:
- Go to the βActionsβ tab in your repository
- The workflow will automatically build and deploy your site
- Your site will be available at
https://Coderhacks444.github.io/URLbits
Manual Deployment
- Build the project:
-
The static files will be generated in the out
directory
- Upload the contents of the
out
directory to your web server
Configuration
Environment Variables
Create a .env.local
file for local development:
NEXT_PUBLIC_SITE_URL=http://localhost:3000
For production, set:
NEXT_PUBLIC_SITE_URL=https://Coderhacks444.github.io/URLbits
Custom Domain
If you want to use a custom domain:
- Update
next.config.js
:
basePath: '',
assetPrefix: '',
- Update
package.json
:
"homepage": "https://yourdomain.com"
Security Features
- Input Sanitization: Automatically adds HTTPS protocol if missing
- Malicious URL Detection: Blocks javascript:, data:, vbscript:, and other dangerous protocols
- URL Validation: Ensures valid hostnames and protocols
- XSS Protection: Sanitized input handling
- Click Tracking: Secure analytics without external dependencies
Project Structure
URLbits/
βββ app/
β βββ components/ # Reusable components
β βββ dashboard/ # Dashboard page
β βββ [shortCode]/ # Dynamic route for short URLs
β βββ layout.js # Root layout
β βββ page.js # Home page
βββ .github/workflows/ # GitHub Actions
βββ public/ # Static assets
βββ next.config.js # Next.js configuration
βββ package.json # Dependencies and scripts
Technologies Used
- Next.js 15: React framework with App Router
- React 19: Latest React with hooks
- Tailwind CSS: Utility-first CSS framework
- localStorage: Client-side data storage
- GitHub Pages: Static site hosting
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature-name
- Commit your changes:
git commit -am 'Add feature'
- Push to the branch:
git push origin feature-name
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Include browser console errors if applicable
Changelog
v1.0.0
- Initial release
- URL shortening functionality
- Analytics dashboard
- Security features
- GitHub Pages deployment