Skip to main content

A FastAPI-based web framework

Project description

Vilcos Framework ๐Ÿš€

A modern, full-stack web framework built on FastAPI and Vue.js with real-time capabilities.

Features โœจ

  • Modern UI - Vue 3 + Vuetify 3.7.3 for beautiful, responsive interfaces
  • Authentication - Secure session-based auth with Argon2 password hashing and role-based access control
  • Database - Async SQLAlchemy with PostgreSQL and connection pooling
  • API Ready - FastAPI-powered REST endpoints with automatic OpenAPI docs
  • Developer Friendly - CLI tools, hot reloading, and interactive shell
  • Real-time WebSockets - Multi-channel WebSocket support with JSON message broadcasting
  • Session Management - Redis-backed secure sessions with configurable settings
  • User Management - Complete user administration with CRUD operations
  • Role-Based Access - Flexible role management system with admin interface
  • Modern Frontend - Material Design Icons, Axios for HTTP requests, and responsive layouts

Quick Start ๐Ÿƒ

Installation

# Clone the repository
git clone https://github.com/yourusername/vilcos.git
cd vilcos

# Create and activate virtual environment
python -m venv venv
source venv/bin/activate  # On Windows use: venv\Scripts\activate

# Install vilcos
pip install vilcos

Environment Setup

  1. Set up your environment variables:
# Copy the sample environment file
cp .env.sample .env

# Edit .env with your configuration
vim .env  # or use your preferred editor

Required environment variables:

# Database Configuration
DATABASE_URL=postgresql+asyncpg://user:pass@localhost/dbname

# Security Settings
SECRET_KEY=your-secure-secret-key
SESSION_COOKIE_NAME=vilcos_session
SESSION_COOKIE_MAX_AGE=86400
SESSION_COOKIE_SECURE=true
SESSION_COOKIE_SAMESITE=lax

# Redis Configuration
REDIS_URL=redis://localhost:6379
  1. Initialize and run:
# Create database tables and default roles
vilcos init-db

# Create an admin user (optional)
vilcos create-admin

# Start the development server
vilcos run

Your app is now running at http://localhost:8000 ๐ŸŽ‰

Project Structure ๐Ÿ“

vilcos/
โ”œโ”€โ”€ .env.sample          # Sample environment configuration
โ”œโ”€โ”€ pyproject.toml      # Project configuration and dependencies
โ”œโ”€โ”€ requirements.txt    # Python dependencies
โ””โ”€โ”€ vilcos/            # Main package
    โ”œโ”€โ”€ static/        # Static assets
    โ”œโ”€โ”€ templates/     # View templates
    โ”‚   โ”œโ”€โ”€ admin/    # Admin interface templates
    โ”‚   โ””โ”€โ”€ auth/     # Authentication templates
    โ”œโ”€โ”€ routes/        # API endpoints and routes
    โ”‚   โ”œโ”€โ”€ auth.py    # Authentication routes
    โ”‚   โ”œโ”€โ”€ users.py   # User management routes
    โ”‚   โ”œโ”€โ”€ roles.py   # Role management routes
    โ”‚   โ””โ”€โ”€ websockets.py  # WebSocket routes
    โ”œโ”€โ”€ models.py      # Database models
    โ”œโ”€โ”€ schemas.py     # Pydantic schemas
    โ”œโ”€โ”€ config.py      # Application settings
    โ”œโ”€โ”€ db.py         # Database configuration and utilities
    โ”œโ”€โ”€ auth_utils.py  # Authentication utilities
    โ”œโ”€โ”€ utils.py      # Utility functions
    โ”œโ”€โ”€ cli.py        # Command-line interface
    โ””โ”€โ”€ app.py        # Application entry point

Authentication ๐Ÿ”‘

Vilcos uses a simple but secure session-based authentication system:

  • Secure Password Storage: Argon2 hashing (winner of the Password Hashing Competition)
  • Session Management: Redis-backed sessions with secure defaults
  • Cookie Security: HTTPOnly, Secure, and SameSite flags enabled
  • Database Integration: Direct SQLAlchemy models for user management

Routes

  • /auth/signin - User login
  • /auth/signup - New user registration
  • /auth/signout - User logout
  • /admin/users - User management dashboard
  • /admin/roles - Role management dashboard

Security Best Practices

  1. Generate a strong secret key:
python -c "import secrets; print(secrets.token_hex(32))"
  1. In production:
  • Set SESSION_COOKIE_SECURE=True
  • Use HTTPS
  • Configure Redis with authentication
  • Use strong database passwords

Key Features ๐Ÿ”‘

User Management

The framework includes a comprehensive user management system:

  • User Administration

    • Create, read, update, and delete users
    • Manage user roles and permissions
    • Toggle user activation status
    • Secure password management
  • Role Management

    • Create and manage custom roles
    • Assign/remove roles from users
    • Role-based access control for routes
    • Admin interface for role management

WebSockets

// Connect to a specific channel
const ws = new WebSocket('ws://localhost:8000/ws/mychannel');

// Send JSON messages
ws.send(JSON.stringify({ 
    type: 'chat',
    content: 'Hello everyone!' 
}));

// Handle incoming messages
ws.onmessage = (event) => {
    const data = JSON.parse(event.data);
    console.log(`Received at ${data.timestamp}:`, data.data);
};

CLI Tools

vilcos version          # Show version
vilcos run             # Start development server
vilcos init-db         # Initialize database tables
vilcos create-admin    # Create admin user
vilcos shell           # Launch interactive shell

Requirements ๐Ÿ“‹

  • Python 3.8+
  • PostgreSQL
  • Redis

Configuration โš™๏ธ

Essential .env settings:

DATABASE_URL=postgresql+asyncpg://user:pass@localhost/dbname
SECRET_KEY=your-secure-secret-key
REDIS_URL=redis://localhost:6379

Contributing ๐Ÿค

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

License ๐Ÿ“„

MIT License - see LICENSE file

Support ๐Ÿ’ฌ

  • GitHub Issues: Bug reports
  • GitHub Discussions: Questions
  • Documentation: [Coming Soon]

Built with โค๏ธ using FastAPI, Vue.js, and modern web technologies.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vilcos-0.2.0.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vilcos-0.2.0-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file vilcos-0.2.0.tar.gz.

File metadata

  • Download URL: vilcos-0.2.0.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.0

File hashes

Hashes for vilcos-0.2.0.tar.gz
Algorithm Hash digest
SHA256 878cb6864122d9d0f7599b5fc08fe907bb824c8f793d5961f22aa60424bb1819
MD5 0995a78981aba49c083c0bcaa25a5d80
BLAKE2b-256 b8a6ef0260d6b6fd2c3d677d3b780d405d035d850185231e834b2eac14a2518a

See more details on using hashes here.

File details

Details for the file vilcos-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: vilcos-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 28.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.0

File hashes

Hashes for vilcos-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c5a0c40d0f7ef4072c605c18f260122b7fe150a9eeefc7367743eda7403031c
MD5 4a0a60b64584efbc5b6524672729b64b
BLAKE2b-256 59bf5cd74854bf4535e3ae0cb0c1c26d892ce559d99bf0690ab5d4cf16056196

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page