Skip to main content

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

Project description

JsWeb Logo

PyPI version License PyPI version

Discord Documentation Sponsor GitHub PayPal Sponsor

JsWeb: The Blazing-Fast ASGI Lightweight Python Web Framework

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.

Core Features

  • Blazing-Fast ASGI Core: Built for speed and concurrency, compatible with servers like Uvicorn.
  • Automatic AJAX: Forms and navigation are automatically handled in the background for a smooth, single-page-application feel with zero configuration.
  • Elegant Routing: Define routes with a simple decorator syntax.
  • Jinja2 Templating: Render dynamic HTML with a powerful and familiar templating engine.
  • Built-in Security: Comes with CSRF protection, password hashing, and cache-control tools out of the box.
  • Full-Featured Forms: A powerful, easy-to-use form library with validation.
  • SQLAlchemy Integration: Includes Alembic for easy database migrations.
  • Automatic Admin Panel: A production-ready admin interface for your models that's generated automatically.
  • Modular Blueprints: Organize your code into clean, reusable components.
  • Powerful CLI: A command-line interface for creating projects, running the server, and managing your database.

Contributors

Command-Line Interface (CLI)

JsWeb comes with a powerful set of command-line tools to streamline your development workflow.

  • jsweb run: Starts the development server.

    • --host <address>: Specify the host to run on (e.g., 0.0.0.0).
    • --port <number>: Specify the port.
    • --reload: Enable auto-reloading on code changes.
    • --qr: Display a QR code for accessing the server on your local network.
  • jsweb new <project_name>: Creates a new, production-ready JsWeb project with a clean directory structure and all necessary files.

  • jsweb db ...: A group of commands for managing your database migrations with Alembic.

    • jsweb db prepare -m "Your message": Generates a new database migration script based on changes to your models.
    • jsweb db upgrade: Applies all pending migrations to the database.
    • jsweb db downgrade: Reverts the last applied migration.
  • jsweb create-admin: An interactive command to create a new administrator user in the database.

Installation & Setup

Get up and running in under a minute.

  1. Install JsWeb:

    pip install jsweb
    
  2. Create a new project:

    jsweb new my_project
    cd my_project
    
  3. (Optional) Set up the database:

    jsweb db prepare -m "Initial migration"
    jsweb db upgrade
    
  4. Run the development server:

    jsweb run --reload
    

Your new JsWeb project is now running with auto-reloading enabled!

Quickstart: A Real-World Example

Here’s how a simple but structured JsWeb application looks, using Blueprints to organize your code.

views.py

from jsweb import Blueprint, render

# 1. Create a "Blueprint" for a group of related pages.
views_bp = Blueprint('views')

# 2. Define a route on the blueprint.
@views_bp.route("/")
async def home(req):
    # The render function automatically finds your templates.
    return render(req, "welcome.html", {"user_name": "Guest"})

app.py

from jsweb import JsWebApp
import config

# Import the blueprint you just created.
from views import views_bp

# 3. Create the main application instance.
app = JsWebApp(config=config)

# 4. Register your blueprint with the app.
app.register_blueprint(views_bp)

# The `jsweb run` command will find and run this `app` instance.

This structure allows you to organize your application into logical components, making it clean and scalable from the very beginning.

For more detailed usage, refer to the official documentation, individual module docstrings, and examples within the codebase.

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.0b1.tar.gz (332.5 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.0b1-py3-none-any.whl (338.7 kB view details)

Uploaded Python 3

File details

Details for the file jsweb-1.2.0b1.tar.gz.

File metadata

  • Download URL: jsweb-1.2.0b1.tar.gz
  • Upload date:
  • Size: 332.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for jsweb-1.2.0b1.tar.gz
Algorithm Hash digest
SHA256 7bb0846002254bebc7113cea5dee452cbdb5e18b8596c862fb156687b576db7e
MD5 a06d07e214cffb28997f3e8e2cb252a7
BLAKE2b-256 ca01b98086275e5e352fbbe6eea75765941082666d75935883cc1a6fb7f5e958

See more details on using hashes here.

File details

Details for the file jsweb-1.2.0b1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for jsweb-1.2.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 7c34c0da4fb99504853f4d57ea8a82d11b4983bfd78d4dabd6e83c0072e2935c
MD5 29d0665eb877c0793a2c254a0ec5cc6f
BLAKE2b-256 79e3031bb4c55acb310ceca1cafc100af7f88199938be03e5d26448888b25e1d

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