Skip to main content

A complete Python framework for full-stack development

Project description

JLFramework

PyPI version Python 3.9+ License: MIT

A complete Python framework for full-stack development with FastAPI and Vue.js. Create production-ready applications in minutes with Django-like scaffolding and importable utilities.

โœจ Features

  • ๐Ÿš€ Rapid Scaffolding - Create full-stack projects in under 5 minutes
  • ๐Ÿ—๏ธ Production-Ready Templates - FastAPI backend + Vue.js frontends with best practices
  • ๐Ÿ”ง Flexible & Modular - Use only what you need, mix and match templates
  • ๐Ÿ“ฆ Batteries Included - Database, auth, logging, middleware, and more
  • ๐Ÿ Django-like Experience - Clean imports and intuitive CLI commands
  • ๐ŸŽจ Multiple Frontend Options - Embedded, features, and marketplace templates
  • ๐Ÿ”’ Security First - Tenant isolation, OIDC auth, audit logging built-in
  • ๐Ÿณ Docker Ready - Dockerfiles included for all templates

๐Ÿ“ฆ Installation

pip install jlframework

๐Ÿš€ Quick Start

Create a New Project

# Initialize a new project
jlframework init my-awesome-app
cd my-awesome-app

# Add backend
jlframework add backend

# Add frontend
jlframework add frontend-embedded

# List available templates
jlframework list

Use Importable Utilities

from fastapi import FastAPI, Request, Depends
from sqlalchemy.orm import Session
from jlframework import (
    get_db,
    CommonManager,
    AuditManager,
    AuditStatus,
    AuditAction,
    EntityType,
    restrict_access_middleware,
)

app = FastAPI()

# Add middleware
app.middleware("http")(restrict_access_middleware)

@app.get("/api/v1/items")
async def get_items(
    request: Request,
    db: Session = Depends(get_db)
):
    # Get tenant ID from request
    tenant_id = CommonManager.get_tenant_id(request)
    
    # Query database
    items = db.query(Item).filter_by(tenant_id=tenant_id).all()
    
    return {"items": items}

๐Ÿ“š Available Templates

Backend

FastAPI backend with:

  • Domain-driven design structure
  • SQLAlchemy ORM with multiple database support
  • Tenant-based access control middleware
  • Audit logging with MongoDB
  • Azure integration (optional)
  • Docker support
  • Environment-based configuration

Frontend - Embedded

Vue.js 3 embedded application with:

  • Vite build system
  • TypeScript support
  • Vue Router
  • OIDC authentication (optional)
  • API service layer
  • Tailwind CSS
  • Docker + Nginx deployment

Frontend - Features

Vue.js 3 micro-frontend features:

  • Modular component architecture
  • Custom event system
  • Shared state management
  • Independent deployment

Frontend - Marketplace

Vue.js 3 marketplace application:

  • Full marketplace UI
  • Product catalog
  • User management
  • OIDC authentication

๐ŸŽฏ CLI Commands

jlframework init

Initialize a new project with configuration files.

jlframework init my-project
jlframework init my-project --no-git  # Skip git initialization

jlframework add

Add a template to your project.

jlframework add backend
jlframework add frontend-embedded
jlframework add frontend-features
jlframework add frontend-marketplace
jlframework add backend --skip-install  # Skip dependency installation

jlframework list

List all available templates.

jlframework list

๐Ÿ“– Importable Utilities

Database

from jlframework import get_db, get_db_session, database_middleware

# Use as FastAPI dependency
@app.get("/items")
def get_items(db: Session = Depends(get_db)):
    return db.query(Item).all()

# Use as middleware
app.middleware("http")(database_middleware)

Handlers

from jlframework import CommonManager, AuditManager, AuditData

# Get tenant ID from request
tenant_id = CommonManager.get_tenant_id(request)

# Get client information
client_info = CommonManager.get_client_info(request)

# Validate pagination
CommonManager.validate_pagination(page_index=1, page_size=50)

# Audit logging
audit = AuditManager(app_id=1, tenant_id=tenant_id, mongo_connection_string=config)
await audit.save_audit(AuditData(...))

Enums

from jlframework import AuditStatus, AuditAction, EntityType

# Use in your code
status = AuditStatus.SUCCESS
action = AuditAction.CREATE
entity = EntityType.Customer

Middleware

from jlframework import restrict_access_middleware, get_tenant_id

# Add tenant validation middleware
app.middleware("http")(restrict_access_middleware)

# Get tenant ID from request state
tenant_id = get_tenant_id(request)

Configuration

from jlframework import Settings, get_settings

# Get application settings
settings = get_settings()
print(settings.app_name)
print(settings.debug)

๐Ÿ—๏ธ Project Structure

After running jlframework init and adding templates:

my-project/
โ”œโ”€โ”€ .jlframework.json      # Project configuration
โ”œโ”€โ”€ README.md              # Project documentation
โ”œโ”€โ”€ .gitignore            # Git ignore patterns
โ”œโ”€โ”€ backend/              # FastAPI backend
โ”‚   โ”œโ”€โ”€ main.py
โ”‚   โ”œโ”€โ”€ routes.py
โ”‚   โ”œโ”€โ”€ requirements.txt
โ”‚   โ”œโ”€โ”€ Dockerfile
โ”‚   โ”œโ”€โ”€ configs/
โ”‚   โ”œโ”€โ”€ domains/
โ”‚   โ”œโ”€โ”€ middlewares/
โ”‚   โ””โ”€โ”€ shared/
โ””โ”€โ”€ frontend/
    โ”œโ”€โ”€ embedded/         # Embedded Vue.js app
    โ”œโ”€โ”€ features/         # Micro-frontend features
    โ””โ”€โ”€ marketplace/      # Marketplace Vue.js app

๐Ÿ”ง Configuration

Backend Configuration

The backend template uses environment variables for configuration. Create a .env file:

# Application
APP_NAME=My Awesome API
DEBUG=false
HOST=0.0.0.0
PORT=8000

# Database
DATABASE_URL=mssql+pyodbc://user:pass@server/db?driver=ODBC+Driver+17+for+SQL+Server

# Azure (optional)
AZURE_APP_CONFIG_CONNECTION_STRING=...

# MongoDB (for audit logging)
MONGO_CONNECTION_STRING={"connection_string": "...", "database_name": "..."}

Frontend Configuration

Frontend templates use .env files for configuration:

VITE_API_URL=http://localhost:8000
VITE_OIDC_AUTHORITY=https://your-oidc-provider
VITE_OIDC_CLIENT_ID=your-client-id

๐Ÿณ Docker Support

All templates include Dockerfiles for containerization:

# Backend
cd backend
docker build -t my-backend .
docker run -p 8000:8000 my-backend

# Frontend
cd frontend/embedded
docker build -t my-frontend .
docker run -p 80:80 my-frontend

๐Ÿงช Development

Running Backend

cd backend
pip install -r requirements.txt
python main.py

Running Frontend

cd frontend/embedded
npm install
npm run dev

๐Ÿ“ Examples

Complete FastAPI Application

from fastapi import FastAPI, Request, Depends
from sqlalchemy.orm import Session
from jlframework import (
    get_db,
    CommonManager,
    restrict_access_middleware,
    database_middleware,
)

app = FastAPI(title="My API")

# Add middlewares
app.middleware("http")(database_middleware)
app.middleware("http")(restrict_access_middleware)

@app.get("/api/v1/customers")
async def get_customers(
    request: Request,
    db: Session = Depends(get_db)
):
    tenant_id = CommonManager.get_tenant_id(request)
    customers = db.query(Customer).filter_by(tenant_id=tenant_id).all()
    return {"customers": customers}

if __name__ == "__main__":
    import uvicorn
    uvicorn.run(app, host="0.0.0.0", port=8000)

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some 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

๐Ÿ“ž Support

๐Ÿ—บ๏ธ Roadmap

  • Additional database support (MongoDB, PostgreSQL)
  • More frontend templates (React, Angular)
  • Code generators for models, routes, services
  • Database migration tools
  • Testing utilities
  • Deployment helpers (Kubernetes, Docker Compose)
  • VS Code extension
  • Web-based project configurator

Made with โค๏ธ by the JLFramework Team

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

jlframework-1.0.3.tar.gz (193.4 kB view details)

Uploaded Source

Built Distribution

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

jlframework-1.0.3-py3-none-any.whl (225.0 kB view details)

Uploaded Python 3

File details

Details for the file jlframework-1.0.3.tar.gz.

File metadata

  • Download URL: jlframework-1.0.3.tar.gz
  • Upload date:
  • Size: 193.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for jlframework-1.0.3.tar.gz
Algorithm Hash digest
SHA256 2e752716c1d0854cf6ac8b70f4cf96b1169c3776e520ba3b4b4ab3eacaf10749
MD5 f7913686661538bec4838e65f6873f5a
BLAKE2b-256 2b0e3105d14d28702f5acd3520228ffe66111ab9fe0c12002d86262bea69cd55

See more details on using hashes here.

File details

Details for the file jlframework-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: jlframework-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 225.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for jlframework-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d22291844404e11918415e385e1d375ab41aea07b04e8345d497afd6af687c75
MD5 ae217f4b1aa56ce4e657337959d214cb
BLAKE2b-256 97d8357cf4a27e37773b8573ae616162d028e069dcb366d074c94bd07d407c5f

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