A full-stack URL shortener application with comprehensive admin panel for user, role, and permission management.
- URL Shortening: Create short links with custom labels
- Link Management: View, edit, and delete your links
- Public Redirects: Fast redirects via short URLs
- Responsive Design: Works seamlessly on all devices
- User Management: View, delete users, and manage their roles
- Role & Permission System: Granular role-based access control
- Admin Dashboard: Comprehensive admin interface
- Security: Session-based authentication with admin privileges
- FastAPI: High-performance async web framework
- SQLModel: Type-safe database operations with SQLAlchemy 2.0
- Alembic: Database migrations
- Python 3.13+: Modern Python with UV package manager
- Next.js 15: React framework with App Router
- TypeScript: Type-safe development
- Tailwind CSS: Utility-first CSS framework
- Shadcn/ui: Beautiful, accessible UI components
- Ky: Modern HTTP client for API requests
- Docker and Docker Compose
- Node.js 18+ (for local development)
- Python 3.13+ (for local development)
# Clone the repository
git clone <repository-url>
cd loslc-links
# Start the application
docker-compose up -d
# Access the application
# Frontend: http://localhost:3000
# Backend API: http://localhost:8000cd backend
# Install dependencies
uv sync
# Set up environment variables
cp .env.example .env
# Edit .env with your configuration
# Run database migrations
uv run alembic upgrade head
# Start the development server
uv run main.pycd frontend
# Install dependencies
bun install
# Set up environment variables
cp .env.example .env.local
# Edit .env.local with your configuration
# Start the development server
bun devDATABASE_URL=postgresql://user:password@localhost/dbname
SECRET_KEY=your-secret-key
ADMIN_EMAILS=admin@example.com;another@admin.com
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASSWORD=your-app-passwordNEXT_PUBLIC_API_URL=http://localhost:8000To grant admin privileges to a user:
- Add their email to the
ADMIN_EMAILSenvironment variable in the backend - Restart the backend service
- The user can now access the admin panel at
/admin
- Visit the homepage
- Sign up or log in
- Enter your URL and optional custom label
- Share your short link!
- Navigate to
/admin - Log in with admin credentials
- Manage users, roles, and permissions
- View system statistics
loslc-links/
βββ backend/ # FastAPI backend
β βββ app/
β β βββ api/ # API routes and controllers
β β βββ core/ # Core application logic
β β βββ utils/ # Utility functions
β βββ migrations/ # Database migrations
β βββ Dockerfile
βββ frontend/ # Next.js frontend
β βββ src/
β β βββ app/ # Next.js App Router pages
β β βββ components/ # React components
β β βββ lib/ # Utilities and API client
β βββ Dockerfile
βββ docker-compose.yml # Docker orchestration
- Session-based Authentication: HTTP-only cookies for security
- Role-based Access Control: Granular permission system
- Admin-only Endpoints: Protected admin functionality
- Input Validation: Comprehensive request validation
- CORS Protection: Configured cross-origin policies
Once the backend is running, visit:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
# Build and deploy
docker-compose -f docker-compose.prod.yml up -d
# Or use existing images
docker-compose up -d- Build the frontend:
bun run build - Set production environment variables
- Deploy backend and frontend to your preferred hosting platform
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes
- Add tests if applicable
- Commit your changes:
git commit -m 'Add feature' - Push to the branch:
git push origin feature-name - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please create an issue on GitHub or contact the development team.