Skip to content

jkolarov/FlaskLogin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Flask Auth Skeleton πŸ”

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.

Python Flask SQLite License

🌐 Live Demo

Try it out at https://fluxory.dev

Test Accounts

Role Email Password
Admin admin@test.com admin123
User user@test.com user123

✨ Features

  • 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

πŸ“Έ Screenshots

Login Page

image

Admin Panel

image

πŸš€ Quick Start

Prerequisites

  • Python 3.11+
  • pip or Docker

Installation

  1. Clone the repository

    git clone https://github.com/jkolarov/FlaskLogin.git
    cd FlaskLogin
  2. Create virtual environment

    python -m venv venv
    
    # Windows
    venv\Scripts\activate
    
    # Linux/Mac
    source venv/bin/activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Configure environment variables

    cp .env.example .env
    # Edit .env with your settings
  5. Initialize the database

    python scripts/init_db.py
  6. Run the application

    python run.py
  7. Open your browser

    http://localhost:5000
    

Docker Installation

# Build and run with Docker Compose
docker-compose up --build

# Access at http://localhost:5000

βš™οΈ Configuration

Create 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-secret

πŸ“ Project Structure

flask-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

πŸ§ͺ Running Tests

# 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

πŸ”’ Security Features

  • 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

πŸ“ API Routes

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

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

About

A skeleton website based on Flask, SQLlite and Tailwind CSS. Great for starting point in vibe-coding projects. Auth already built in.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors