Skip to content

Releases: Jsweb-Tech/jsweb

JsWeb v1.2.0 Release

11 Dec 07:35

Choose a tag to compare

JsWeb v1.2.0 Release Notes

Release Date: 11 December 2025
Status: Stable Release


Special Thanks 🩷

A special thank you to @kasimlyee for his valuable contributions, insights, and continuous support throughout the development of JsWeb.
All the features mentioned below were implemented by him with great dedication and expertise. 🙏🚀


What's New 🎉

JsWeb v1.2.0 introduces major improvements to developer experience, API documentation, routing performance, and error handling. This release brings the framework closer to production-ready status with automatic documentation and significant performance optimizations.


Major Features ⚡

Automatic OpenAPI/Swagger Documentation System

JsWeb now includes a complete, production-ready OpenAPI 3.0.3 documentation system that works automatically out of the box.

Key Features:

  • Automatic API Documentation - Docs are automatically generated and available at /docs, /redoc, and /openapi.json
  • Multiple UI Options - Swagger UI, ReDoc, and RapiDoc support
  • Experience - Automatic request validation with Pydantic v2
  • Decorators - Fine-grained documentation control with decorators
  • Zero Configuration - Works automatically when you run jsweb run
  • Hybrid DTO System - Uses Pydantic v2 internally but exposes clean jsweb API

Usage Example:

from jsweb import JsWebApp
from jsweb.dto import JswebBaseModel, Field
from jsweb.docs import api_operation, api_body, api_response
from jsweb.response import json

app = JsWebApp(__name__)

# Define a DTO
class CreateUserDto(JswebBaseModel):
    name: str = Field(..., min_length=1, max_length=100)
    email: str = Field(..., pattern=r'^[\w\.-]+@[\w\.-]+\.\w+$')
    age: int = Field(..., ge=0, le=150)

# Automatic validation and documentation
@app.route('/users', methods=['POST'])
@api_operation(
    summary="Create a new user",
    description="Creates a new user with automatic validation"
)
@api_body(CreateUserDto)  # Auto-validates request body!
@api_response(201, CreateUserDto, description="User created successfully")
async def create_user(req):
    # req.validated_body contains the validated DTO
    user_data = req.validated_data
    return json(user_data, status=201)

What You Get:

  • Automatic request body validation
  • Detailed validation error messages
  • Interactive API documentation at /docs
  • OpenAPI JSON spec at /openapi.json
  • Alternative docs at /redoc

Configuration:
All new projects include OpenAPI configuration in config.py:

ENABLE_OPENAPI_DOCS = True           # Enable automatic API documentation
API_TITLE = "Your Project API"
API_VERSION = "1.0.0"
API_DESCRIPTION = "API documentation for Your Project"
OPENAPI_DOCS_URL = "/docs"           # Swagger UI
OPENAPI_REDOC_URL = "/redoc"         # ReDoc UI
OPENAPI_JSON_URL = "/openapi.json"   # OpenAPI spec JSON

Documentation:

  • Full usage guide: JSWEB_OPENAPI_GUIDE.md
  • Example API: examples/example_api.py

2. Routing Performance Optimizations 📈

Significant improvements to routing performance and efficiency.

Performance Improvements:

  • Optimized Route Matching - Faster route resolution algorithm
  • Static Route Priority - Static routes checked before dynamic routes
  • Method Pre-Filtering - Quick rejection of invalid HTTP methods before regex matching
  • Reduced Overhead - Minimized computational cost per request

Benchmarks:

  • Route resolution is now comparable to other production frameworks
  • Reduced latency for high-traffic applications
  • Better performance with large numbers of routes

Technical Details:

  • Static routes use O(1) dictionary lookup
  • Dynamic routes filter by method before expensive regex matching
  • Optimized route compilation and caching

3. Enhanced DTO System with Pydantic v2

A powerful hybrid DTO system that combines Pydantic's validation speed with a clean jsweb API.

Features:

  • Pydantic v2 Performance - 100x faster validation than v1
  • Clean API - No Pydantic imports needed in user code
  • Automatic Validation - Works seamlessly with @api_body decorator
  • Custom Validators - @validator and @root_validator decorators
  • OpenAPI Integration - Automatic schema generation

Available in jsweb.dto:

  • JswebBaseModel - Base class for DTOs
  • Field() - Field configuration with validation
  • ValidationError - Validation error exception
  • @validator - Field-level validation decorator
  • @root_validator - Model-level validation decorator

Example:

from jsweb.dto import JswebBaseModel, Field, validator

class UserDto(JswebBaseModel):
    name: str = Field(..., min_length=2)
    email: str
    age: int = Field(..., ge=18)

    @validator('email')
    def validate_email(cls, value):
        if '@' not in value:
            raise ValueError('Invalid email format')
        return value.lower()

4. Improved Error Handling

Fixed critical error handling issues in the routing system.

What's Fixed:

  • 404 Not Found - Missing routes now properly return 404 instead of 500
  • 405 Method Not Allowed - Invalid HTTP methods return 405 instead of 500
  • ASGI Compliance - Error responses now properly implement ASGI protocol
  • Better Error Messages - Clear JSON error responses with descriptive messages

Before:

GET /missing-route → 500 Internal Server Error
POST /get-only-route → 500 Internal Server Error

After:

GET /missing-route → 404 {"error": "No route found for /missing-route"}
POST /get-only-route → 405 {"error": "Method POST not allowed for path /get-only-route"}

New Dependencies 🆕

  • pydantic>=2.0,<3.0 - Required for DTO system and OpenAPI documentation

Breaking Changes 💥

None - This release is fully backward compatible with v1.2.0b1.


Files Added 🗃️

Core OpenAPI System

  • jsweb/dto/__init__.py - DTO system exports
  • jsweb/dto/models.py - JswebBaseModel and Field
  • jsweb/dto/validators.py - Validation decorators
  • jsweb/docs/__init__.py - OpenAPI exports
  • jsweb/docs/registry.py - Metadata registry
  • jsweb/docs/decorators.py - NestJS-style decorators
  • jsweb/docs/auto_validation.py - Automatic validation
  • jsweb/docs/schema_builder.py - OpenAPI schema generator
  • jsweb/docs/ui_handlers.py - Swagger/ReDoc handlers
  • jsweb/docs/introspection.py - Route discovery
  • jsweb/docs/setup.py - One-line setup function
  • jsweb/docs/validation_middleware.py - Optional middleware

Documentation & Examples

  • JSWEB_OPENAPI_GUIDE.md - Complete usage guide (~800 lines)
  • examples/example_api.py - Full CRUD API example

Files Modified

Core Framework

  • jsweb/app.py - Fixed error handling for proper 404/405 responses
  • jsweb/cli.py - Added automatic OpenAPI setup on jsweb run
  • jsweb/server.py - Fixed Windows terminal emoji encoding issues

Configuration

  • pyproject.toml - Added Pydantic v2 dependency
  • jsweb/project_templates/config.py.jinja - Added OpenAPI configuration section

Developer Experience Improvements 💻

  1. Zero Configuration Required

    • API docs work automatically with no setup
    • New projects come with OpenAPI pre-configured
  2. FastAPI-Style Validation

    • Automatic request validation on decorated routes
    • Detailed validation error responses
    • Optional - can be disabled per route
  3. Better Error Messages

    • Clear, descriptive error responses
    • Proper HTTP status codes
    • JSON error format
  4. Production-Ready

    • Thread-safe metadata registry
    • Optimized routing performance
    • Comprehensive error handling

Migration Guide 🔀

From v1.2.0b1 to v1.2.0

No breaking changes! Just update your dependencies:

pip install --upgrade jsweb

Optional: Enable OpenAPI Docs

If you're upgrading an existing project, add these to your config.py:

# OpenAPI / Swagger Documentation (Automatic!)
ENABLE_OPENAPI_DOCS = True
API_TITLE = "Your API Name"
API_VERSION = "1.0.0"
API_DESCRIPTION = "Your API description"
OPENAPI_DOCS_URL = "/docs"
OPENAPI_REDOC_URL = "/redoc"
OPENAPI_JSON_URL = "/openapi.json"

That's it! Run jsweb run and visit /docs to see your API documentation.


Bug Fixes 🐞

  • Fixed routing errors returning 500 instead of proper 404/405 status codes
  • Fixed Windows terminal encoding issues with emoji characters
  • Fixed ASGI protocol compliance in error response handling
  • Fixed race conditions in OpenAPI metadata registry (thread-safe)

What's Next 🚀

Looking ahead to v1.3.0:

  • Enhanced middleware system
  • WebSocket support improvements
  • Advanced authentication decorators
  • Request rate limiting
  • Response caching utilities
  • Database migration improvements

Contributors 🩷


Resources 📂


Feedback 📫

We'd love to hear your feedback on v1.2.0 Please:

  • Report bugs on GitHub Issues
  • Share your experience using the new OpenAPI system
  • Suggest improvements for future releases

Thank you for using JsWeb! 🎉

JsWeb 1.2.0 Beta 1

07 Dec 07:17

Choose a tag to compare

This is the first beta release for JsWeb version 1.2!

✨ New Features

  • Automatic AJAX: Forms and navigation now happen without a full page reload, right out of the box!
  • Built-in Admin Panel: A production-ready admin interface is now included.
  • Smart Forms: The forms system is now more robust and easier to use with automatic HTML rendering.

🐛 Bug Fixes & Improvements

  • The framework is now correctly identified as ASGI, not WSGI.
  • Fixed browser caching issues on protected pages.

Added Feature : JSON Request Parsing & File Upload Support

02 Dec 11:02

Choose a tag to compare


🚀 Release Notes – JSON Request Parsing & File Upload Support

This update introduces two major features to JsWeb, significantly improving its capabilities for modern API and form-based web development.


🔹 1. JSON Request Body Parsing

JsWeb now supports automatic JSON payload parsing for REST API endpoints.

Key Capabilities

  • Automatic parsing when accessing request.json
  • Header validation (Content-Type: application/json)
  • Graceful error handling (returns {} on invalid JSON)
  • Lazy loading (parsed only when accessed)
  • Fully backward compatible

Example

@app.route("/api/users", methods=["POST"])
def create_user(request):
    data = request.json   # Automatically parsed JSON body
    return json({"message": "User created", "user": data})

🔹 2. File Upload Support

Full multipart/form-data handling is now part of JsWeb, making file uploads simple and powerful.

request.files

Access uploaded files directly:

  • request.files["file"]
  • Each file is an UploadedFile instance.

UploadedFile Features

  • read() – Read file content
  • save(path) – Save file to disk
  • size – File size in bytes
  • content_type – MIME type

🔹 3. FileField + Validators (Forms)

JsWeb now includes Form support for file inputs.

Supported Validators

  • FileRequired() – Ensures a file was submitted
  • FileAllowed([...]) – Restricts allowed extensions
  • FileSize(max_size=...) – Maximum size validation

Example

from jsweb import Form, FileField, FileRequired, FileAllowed, FileSize

class UploadForm(Form):
    document = FileField('Document', validators=[
        FileRequired(),
        FileAllowed(['pdf', 'doc', 'docx']),
        FileSize(max_size=10 * 1024 * 1024)  # 10MB
    ])

@app.route("/upload", methods=["GET", "POST"])
def upload(request):
    form = UploadForm(request.form, request.files)
    if request.method == "POST" and form.validate():
        file = form.document.data
        file.save(f"uploads/{file.filename}")
        return html(f"Uploaded: {file.filename}")
    return render(request, "upload.html", {"form": form})

🙌 Special Thanks

A huge thank-you to @kasimlyee for contributing this PR.
Your work brings essential modern features to JsWeb and greatly enhances its usability for real-world applications.
We appreciate your excellent contribution! 💙🐇


Stable Release

23 Sep 07:38

Choose a tag to compare

Stable Release

JsWeb v0.2.0: A Feature-Packed Major Release

23 Sep 07:27

Choose a tag to compare

🚀 Announcing JsWeb v0.2.0: A Feature-Packed Major Release!

We are ecstatic to announce the release of JsWeb v0.2.0! This is a transformative update, evolving JsWeb from a micro-framework into a powerful, fully-featured solution for building robust web applications. This release introduces a suite of essential tools for authentication, form handling, database management, and much more.

✨ What's New in v0.2.0?

This release is packed with core features that provide the foundation for any serious web application.

🔐 Full-Featured Authentication & Security

You can now secure your applications with a complete, built-in authentication system.

  • Session Management: Easily log users in and out with login_user and logout_user.
  • Route Protection: Use the @login_required decorator to protect sensitive views.
  • Password Hashing: Securely handle user passwords with generate_password_hash and check_password_hash.

📝 Advanced Form Handling & Validation

Simplify data collection and validation with our new forms module.

  • Define Forms: Create form classes with fields like StringField and PasswordField.
  • Built-in Validators: Leverage powerful validators like DataRequired, Email, Length, and EqualTo to ensure data integrity.
  • Easy Integration: Render forms in templates and process validated data in your views with ease.

🧱 Modular Applications with Blueprints

Organize your growing application into clean, reusable components. Blueprints allow you to group related routes and logic into separate modules, keeping your codebase scalable and maintainable.

⚙️ Powerful Database & Migration Tools

We've supercharged database integration with SQLAlchemy and Alembic.

  • Seamless ORM: Define your models and interact with your database using the power of SQLAlchemy.
  • Effortless Migrations: The jsweb db command-line tools make schema migrations a breeze. Just change your models and run jsweb db prepare followed by jsweb db upgrade.

🚀 Enhanced Developer Experience & CLI

The command-line interface is now more powerful, boosting your productivity from start to finish.

  • Project Scaffolding: Create a new, well-structured project in seconds with jsweb new <project_name>.
  • Auto-Reload Server: The jsweb run --reload command now automatically restarts the server when you make code changes.

A Glimpse of the New Features in Action

Here's how easy it is to create a protected, form-based view with the new tools:

1. Define your form (forms.py):

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

class PostForm(Form):
    title = StringField(label="Title", validators=[DataRequired()])
    content = StringField(label="Content", validators=[DataRequired()])

2. Create the protected route (app.py):

from jsweb.auth import login_required
from jsweb.response import render, redirect
from .forms import PostForm
from .models import Post

@app.route("/create-post", methods=["GET", "POST"])
@login_required
def create_post(request):
    form = PostForm(request.form)
    if request.method == "POST" and form.validate():
        Post.create(
            title=form.title.data,
            content=form.content.data,
            author=request.user
        )
        return redirect("/dashboard")
    return render(request, "create_post.html", {"form": form})

🔗 Get the Update

Ready to build with these powerful new features? Upgrade to the latest version from PyPI now:

pip install --upgrade jsweb

This release marks a new era for JsWeb, and we can't wait to see what you create with it.

Happy coding!

Initial Release

10 Jul 11:36

Choose a tag to compare

A lightweight and modern Python web framework designed for speed, simplicity, and a great developer experience.