A production-ready Flask authentication skeleton with OAuth integration, role-based access control, and a responsive Tailwind CSS frontend. Great starting point for your vibe-coding project. Save some prompts with this prebuilt template.
Try it out at https://fluxory.dev
| Role | Password | |
|---|---|---|
| Admin | admin@test.com |
admin123 |
| User | user@test.com |
user123 |
- Email/Password Authentication - Secure registration and login with bcrypt password hashing
- OAuth Integration - Login with Google or GitHub via Authlib
- Role-Based Access Control - Admin and User roles with protected routes
- Admin Panel - Manage users, edit roles, and delete accounts
- Responsive UI - Clean Tailwind CSS design that works on all devices
- Docker Ready - Containerized for easy deployment
- Comprehensive Tests - Unit tests and property-based tests with Hypothesis
- Python 3.11+
- pip or Docker
-
Clone the repository
git clone https://github.com/jkolarov/FlaskLogin.git cd FlaskLogin -
Create virtual environment
python -m venv venv # Windows venv\Scripts\activate # Linux/Mac source venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Configure environment variables
cp .env.example .env # Edit .env with your settings -
Initialize the database
python scripts/init_db.py
-
Run the application
python run.py
-
Open your browser
http://localhost:5000
# Build and run with Docker Compose
docker-compose up --build
# Access at http://localhost:5000Create a .env file with the following variables:
# Flask
SECRET_KEY=your-secret-key-here
FLASK_ENV=development
# Database
DATABASE_URL=sqlite:///instance/dev.db
# OAuth (optional)
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secretflask-auth-skeleton/
βββ app/
β βββ auth/ # Authentication blueprint
β βββ admin/ # Admin panel blueprint
β βββ main/ # Main routes blueprint
β βββ services/ # Business logic
β βββ templates/ # Jinja2 templates
β βββ utils/ # Utility functions
β βββ models.py # SQLAlchemy models
β βββ __init__.py # App factory
βββ tests/ # Test suite
βββ scripts/ # Utility scripts
βββ config.py # Configuration
βββ run.py # Entry point
βββ Dockerfile
βββ docker-compose.yml
βββ requirements.txt
# Run all tests
pytest
# Run with coverage
pytest --cov=app --cov-report=html
# Run property-based tests only
pytest -m property
# Run specific test file
pytest tests/test_auth_routes.py -v- Password Hashing - bcrypt with automatic salt
- CSRF Protection - Flask-WTF on all forms
- Input Sanitization - Protection against XSS and injection
- Secure Sessions - Server-side session management
- Role-Based Access - Decorator-based route protection
| Route | Method | Description | Auth Required |
|---|---|---|---|
/auth/register |
GET, POST | User registration | No |
/auth/login |
GET, POST | User login | No |
/auth/logout |
GET | User logout | Yes |
/auth/oauth/<provider> |
GET | OAuth login | No |
/dashboard |
GET | User dashboard | Yes |
/admin/users |
GET | List all users | Admin |
/admin/users/<id>/edit |
GET, POST | Edit user role | Admin |
/admin/users/<id>/delete |
POST | Delete user | Admin |
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Flask - The web framework
- Authlib - OAuth library
- Tailwind CSS - CSS framework
- Hypothesis - Property-based testing