A modern Flask web application built with MVC (Model-View-Controller) architecture, featuring TailwindCSS for styling and Alpine.js for interactive frontend functionality.
- MVC Architecture: Clean separation of concerns with Models, Views, Controllers, and Services
- Flask Blueprints: Modular application structure with organized route handling
- SQLAlchemy ORM: Database abstraction with relationship management
- TailwindCSS: Utility-first CSS framework for rapid UI development
- Alpine.js: Lightweight JavaScript framework for reactive components
- User Authentication: Complete user registration, login, and profile management
- RESTful API: JSON API endpoints for external integrations
- Responsive Design: Mobile-first responsive design patterns
- Form Validation: Client-side and server-side form validation
- Flash Messages: User feedback system with notifications
py_roadmap/
├── app/
│ ├── __init__.py # Application factory
│ ├── controllers/ # Route handlers (Controllers)
│ │ ├── __init__.py
│ │ ├── main_controller.py # Main application routes
│ │ ├── auth_controller.py # Authentication routes
│ │ └── api_controller.py # API endpoints
│ ├── models/ # Database models
│ │ ├── __init__.py
│ │ ├── base_model.py # Base model with common fields
│ │ ├── user.py # User model
│ │ └── post.py # Post model (example)
│ ├── services/ # Business logic layer
│ │ ├── __init__.py
│ │ ├── main_service.py # Main application logic
│ │ ├── auth_service.py # Authentication logic
│ │ └── api_service.py # API logic
│ ├── templates/ # HTML templates (Views)
│ │ ├── base.html # Base template
│ │ ├── main/ # Main page templates
│ │ └── auth/ # Authentication templates
│ └── static/ # Static assets
│ ├── css/ # Stylesheets
│ ├── js/ # JavaScript files
│ └── images/ # Image assets
├── config/
│ └── settings.py # Application configuration
├── run.py # Application entry point
├── pyproject.toml # Python dependencies
├── package.json # Node.js dependencies (for TailwindCSS)
├── tailwind.config.js # TailwindCSS configuration
└── README.md # This file
- Python 3.11+
- Node.js 16+ (for TailwindCSS)
- Git
git clone <your-repository-url>
cd py_roadmap
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e .
npm install
cp .env.example .env
# Edit .env file with your configuration
npm run build-css
python -c "from app import create_app, db; app = create_app(); app.app_context().push(); db.create_all()"
- Start TailwindCSS build process (in one terminal):
npm run dev
- Start Flask development server (in another terminal):
python run.py
The application will be available at http://localhost:5000
- Build production assets:
npm run build
- Set environment variables:
export FLASK_ENV=production
export SECRET_KEY=your-production-secret-key
- Run with a production WSGI server:
pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:8000 run:app
GET /api/health
- API health check
GET /api/users
- Get all usersGET /api/users/<id>
- Get specific userPOST /api/users
- Create new user
Example API usage:
# Health check
curl http://localhost:5000/api/health
# Get all users
curl http://localhost:5000/api/users
# Create new user
curl -X POST http://localhost:5000/api/users \
-H "Content-Type: application/json" \
-d '{"username": "john", "email": "[email protected]", "password": "password123"}'
This project uses Black for code formatting and Flake8 for linting:
# Format code
black .
# Lint code
flake8 .
# Type checking
mypy .
Run tests with pytest:
pytest
For database schema changes, you can use Flask-Migrate (add it to dependencies if needed):
pip install Flask-Migrate
- Controllers: Add new routes in
app/controllers/
- Models: Add new database models in
app/models/
- Services: Add business logic in
app/services/
- Templates: Add HTML templates in
app/templates/
- Static Assets: Add CSS/JS/images in
app/static/
- Flask: Lightweight WSGI web application framework
- SQLAlchemy: SQL toolkit and Object-Relational Mapping library
- Werkzeug: WSGI utility library for Python
- TailwindCSS: Utility-first CSS framework
- Alpine.js: Minimal framework for composing JavaScript behavior
- Jinja2: Modern and designer-friendly templating language
- Black: Code formatter
- Flake8: Linting tool
- MyPy: Static type checker
- Pytest: Testing framework
- 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.
If you have any questions or need help, please open an issue on GitHub.
For testing the application, you can use these demo credentials:
- Email: [email protected]
- Password: demo123
(Note: You'll need to create this user manually or add a seed script)