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

Uploaded Python 3

File details

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

File metadata

  • Download URL: jsweb-1.2.0.tar.gz
  • Upload date:
  • Size: 108.9 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.0.tar.gz
Algorithm Hash digest
SHA256 a68a89bbc014ae9b403d1fd6210cfdaf0a3473043f1a1c55ba1b0bdd219b3ff9
MD5 26e5696a34f2ec737a82d4ec7009241d
BLAKE2b-256 7930448666ab57993509a6a5bdcb8abdb59160f848f94c8fb492539364fe3ef4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jsweb-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 122.4 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 542ccfff0cd4246afdffe90624a8349711baa84e364f647296b41e702efbddf6
MD5 c14050c4aa4558f4c4df7b24b4f54cde
BLAKE2b-256 f8cd84b2a394d9751957b4268fac7b2c1f2ccd36d3efa009f2b5bba61e6b3c4e

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