A modern URL shortening service built with Laravel 12 and Livewire 4. Create short, memorable links and track their performance with built-in analytics and QR code generation.
- URL Shortening - Generate 6-character alphanumeric short codes for any URL
- QR Code Generation - Create downloadable QR codes (SVG/PNG) with scan tracking
- Click Analytics - Track total clicks, QR scans vs regular clicks, and view detailed statistics
- User Dashboard - Manage all your shortened URLs in one place
- Authentication - Full user registration, login, and password reset functionality
- Two-Factor Authentication - Optional 2FA for enhanced account security
- Email Verification - Verify user email addresses
- Backend: PHP 8.2+, Laravel 12
- Frontend: Livewire 4, Flux UI, Tailwind CSS 4
- Authentication: Laravel Fortify
- Testing: Pest 4
- Build Tools: Vite 7
- Database: SQLite (default), MySQL/PostgreSQL supported
- PHP 8.2 or higher
- Composer
- Node.js and npm
- SQLite (default) or MySQL/PostgreSQL
-
Clone the repository
git clone git@github.com:thecodeholic/livewire-url-shortener.git cd url-shortener -
Install dependencies
composer install npm install -
Environment setup
cp .env.example .env php artisan key:generate -
Database setup
touch database/database.sqlite php artisan migrate -
Build assets
npm run build
Alternatively, run the setup script:
composer setup
Start all development services (server, queue, logs, and Vite) with a single command:
composer dev
This runs:
- Laravel development server at
http://localhost:8000 - Queue worker for background jobs
- Log viewer with Laravel Pail
- Vite for hot module replacement
Build assets for production:
npm run build
Run the full test suite:
php artisan test
Run tests with code style checking:
composer test
Run a specific test file:
php artisan test tests/Feature/UrlShortenerTest.php
Filter by test name:
php artisan test --filter=testName
This project uses Laravel Pint for code formatting:
# Fix code style issues
composer lint
# Check for code style issues without fixing
composer test:lint
app/
├── Http/Controllers/ # HTTP controllers
├── Livewire/ # Livewire components
├── Models/ # Eloquent models (Url, UrlClick, User)
├── Policies/ # Authorization policies
└── Services/ # Business logic (UrlShortenerService, QrCodeService)
resources/views/
├── components/ # Livewire component views
├── layouts/ # Application layouts
└── pages/ # Page views (auth, settings)
tests/
├── Feature/ # Feature tests
└── Unit/ # Unit tests
This project is open-sourced software licensed under the MIT license.