Skip to main content

JsWeb - A lightweight and modern Python web framework designed for speed and simplicity.

Project description

JsWeb Logo

The Blazing-Fast ASGI Lightweight Python Web Framework

Build full-stack web apps and APIs with JsWeb. Pure Python, pure speed.

PyPI version License Downloads

Discord Documentation Sponsor GitHub PayPal Sponsor


๐Ÿ† Contributors

Contributors

About JsWeb

JsWeb is a modern, high-performance Python web framework built from the ground up on the ASGI standard. It's designed for developers who want the speed of asynchronous programming with the simplicity of a classic framework. With built-in, zero-configuration AJAX and a focus on developer experience, JsWeb makes it easy to build fast, dynamic web applications without writing a single line of JavaScript.

Why Choose JsWeb?

  • โšก Lightning Fast - ASGI-based async framework handles thousands of concurrent connections
  • ๐ŸŽฏ Developer Experience - Simple, intuitive API inspired by Flask with modern features
  • ๐Ÿš€ Full-Stack Ready - Everything you need: routing, forms, templates, database, admin panel
  • ๐Ÿ”„ Zero-Config AJAX - Automatic SPA-like experience without JavaScript
  • ๐Ÿ›ก๏ธ Security First - CSRF protection, secure sessions, password hashing built-in
  • ๐Ÿ“ฆ Production Ready - Auto-generated admin panel, API docs, and more

โœจ Core Features

  • ๐Ÿš€ Blazing-Fast ASGI Core - Built for speed and concurrency, compatible with servers like Uvicorn
  • ๐Ÿ”„ Zero-Config AJAX - Forms and navigation automatically handled for a smooth SPA feel
  • ๐Ÿ›ฃ๏ธ Elegant Routing - Simple decorator-based route definition
  • ๐ŸŽจ Jinja2 Templating - Powerful templating engine with inheritance and macros
  • ๐Ÿ›ก๏ธ Built-in Security - CSRF protection, password hashing, and secure session management
  • ๐Ÿ“ Full-Featured Forms - Form validation, file uploads, and field types
  • ๐Ÿ—„๏ธ SQLAlchemy Integration - ORM with Alembic migrations included
  • โš™๏ธ Automatic Admin Panel - Production-ready data management interface generated automatically
  • ๐Ÿงฉ Modular Blueprints - Organize code into clean, reusable components
  • ๐Ÿ› ๏ธ Powerful CLI - Create projects, run server, and manage database from command line
  • ๐Ÿ“š Auto API Documentation - OpenAPI 3.0.3 docs at /docs, /redoc, and /openapi.json
  • ๐Ÿ” Hybrid DTO System - Uses Pydantic v2 internally with clean JsWeb API

๐Ÿš€ Quick Start (30 seconds)

1. Install JsWeb

pip install jsweb

2. Create a Project

jsweb new my_project
cd my_project

3. Run the Server

jsweb run --reload

Visit http://127.0.0.1:8000 and your app is live! ๐ŸŽ‰


๐Ÿ“ Basic Example

Here's a simple but complete JsWeb application:

views.py - Define your routes

from jsweb import Blueprint, render

views_bp = Blueprint('views')

@views_bp.route("/")
async def home(req):
    return render(req, "welcome.html", {"name": "World"})

@views_bp.route("/api/status")
async def status(req):
    return {"status": "online", "message": "Hello from JsWeb!"}

app.py - Wire it all together

from jsweb import JsWebApp
from views import views_bp
import config

app = JsWebApp(config=config)
app.register_blueprint(views_bp)

# Run with: jsweb run --reload

That's all you need for a working application!


๐Ÿ“– Installation & Setup

Get up and running in under a minute.

Prerequisites

  • Python 3.8+ (Python 3.10+ recommended)
  • pip (Python package manager)
  • A text editor or IDE

Step 1: Create Virtual Environment

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

Step 2: Install JsWeb

pip install jsweb

Step 3: Create New Project

jsweb new my_awesome_app
cd my_awesome_app

Step 4: Setup Database (Optional)

jsweb db prepare -m "Initial migration"
jsweb db upgrade

Step 5: Run Development Server

jsweb run --reload

Visit http://127.0.0.1:8000 - your app is running! ๐ŸŽ‰


๐Ÿ› ๏ธ Command-Line Interface (CLI)

JsWeb includes powerful CLI tools to streamline development:

jsweb run - Start Server

jsweb run --reload              # Auto-reload on changes
jsweb run --host 0.0.0.0        # Accessible from network
jsweb run --port 5000           # Custom port
jsweb run --reload --qr         # QR code for mobile access

jsweb new - Create Project

jsweb new my_project            # Create new project with boilerplate
cd my_project

jsweb db - Database Management

jsweb db prepare -m "Message"   # Generate migration
jsweb db upgrade                # Apply migrations
jsweb db downgrade              # Revert last migration

jsweb create-admin - Admin User

jsweb create-admin              # Interactive admin user creation

๐Ÿ“š Documentation

Complete documentation available at https://jsweb-framework.site

Core Guides


๐ŸŒŸ Key Concepts

Blueprints - Modular Organization

Organize your application into logical modules:

from jsweb import Blueprint

# Create a blueprint
auth_bp = Blueprint('auth', url_prefix='/auth')

@auth_bp.route('/login', methods=['GET', 'POST'])
async def login(req):
    return render(req, 'login.html')

@auth_bp.route('/logout')
async def logout(req):
    return redirect('/')

# Register in app.py
app.register_blueprint(auth_bp)

Forms with Validation

Built-in form handling with validation:

from jsweb.forms import Form, StringField
from jsweb.validators import DataRequired, Email

class LoginForm(Form):
    email = StringField("Email", validators=[DataRequired(), Email()])
    password = StringField("Password", validators=[DataRequired()])

@app.route("/login", methods=["GET", "POST"])
async def login(req):
    form = LoginForm(await req.form())
    if form.validate():
        # Handle login
        pass
    return render(req, "login.html", {"form": form})

Database Models

Define models with SQLAlchemy:

from jsweb.database import ModelBase, Column, Integer, String

class User(ModelBase):
    __tablename__ = 'users'
    id = Column(Integer, primary_key=True)
    username = Column(String(80), unique=True, nullable=False)
    email = Column(String(120), unique=True, nullable=False)

# Query the database
user = User.query.get(1)
users = User.query.all()
new_user = User.create(username="john", email="john@example.com")

Admin Panel

Auto-generated admin interface:

from jsweb.admin import Admin

admin = Admin(app)
admin.register(User)
admin.register(Post)
admin.register(Category)

# Access at http://localhost:8000/admin

๐Ÿค Community & Support


๐Ÿ‘ฅ Contributing

We welcome contributions from the community! Whether you want to fix a bug, add a feature, or improve documentation:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

See Contributing Guide for details.


๐Ÿ“Š Project Status

  • Status: Active Development
  • Python: 3.8+
  • License: MIT
  • Latest Version: Check PyPI

๐Ÿ“„ License

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


Made with โค๏ธ by the JsWeb team
Join our Discord community โ€ข Sponsor us

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

jsweb-1.2.1.tar.gz (569.0 kB view details)

Uploaded Source

Built Distribution

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

jsweb-1.2.1-py3-none-any.whl (578.1 kB view details)

Uploaded Python 3

File details

Details for the file jsweb-1.2.1.tar.gz.

File metadata

  • Download URL: jsweb-1.2.1.tar.gz
  • Upload date:
  • Size: 569.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for jsweb-1.2.1.tar.gz
Algorithm Hash digest
SHA256 b7168ab3c71feecb5c9d1883332daf5e57d70b6a307f751354aebabb18a79107
MD5 27ab4e1c261775ceeb20023227e60ba7
BLAKE2b-256 c9f9e5cfe6d87e8eccbfa849bc8500bf39863f29c8804193229888d7e6fb38d3

See more details on using hashes here.

File details

Details for the file jsweb-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: jsweb-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 578.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for jsweb-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 565adcdf05197be4a896b9c79860c3461aa135e92be793ea14c2aa7975476048
MD5 c75bc38c9be67f0ad34858174cb5bd21
BLAKE2b-256 d0f58836b381700457a3961b28ce93ded92bc4f0ec007b459213ad8b88d245a5

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