Skip to main content

Lightweight full-stack async Python web framework built on Starlette designed for rapid development without compromising in UX

Project description

Z8ter

Z8ter is a lightweight, async Python web framework built on Starlette, designed for rapid development without compromising UX. It combines SSR-first rendering, auto-discovered routes, auth scaffolding, and CLI tooling into one cohesive developer experience.


⚠️ Status: Public Alpha — Z8ter is under active development and not yet recommended for production. APIs and module paths may change without notice.


Quickstart

z8 new myapp
cd myapp
python3 -m venv venv
source venv/bin/activate  # Windows: .\.venv\Scripts\activate
pip install -r requirements.txt
z8 run dev

Features

  1. File-based routing — Files under views/ map to routes automatically, each paired with a Jinja template and optional Python logic.
  2. SSR + Islands — Server-side rendering by default, with per-page JS “islands” in static/js/pages/<page_id>.js for interactivity.
  3. Decorator-driven APIs — Define class-based APIs using decorators; auto-mounted under /api/<id>.
  4. Auth & Guards — Session middleware, Argon2 password hashing, and decorators like @login_required for route protection.
  5. Composed BuilderAppBuilder wires config, templating, Vite, sessions, and error handling in a predictable order.
  6. CLI Tooling — Scaffold apps, views, and APIs with z8 new, z8 create_page, z8 create_api; serve with z8 run dev.
  7. React, DaisyUI, Tailwind Ready — Ships with modern frontend defaults for seamless full-stack workflows.

Installation

pip install z8ter

Authentication Example

from z8ter.endpoints.view import View
from z8ter.auth.guards import login_required

class Dashboard(View):
    @login_required
    async def get(self, request):
        return self.render(request, "dashboard.jinja")

AppBuilder Example

from z8ter.builders.app_builder import AppBuilder
from myapp.repos import MySessionRepo, MyUserRepo

builder = AppBuilder()
builder.use_config(".env")
builder.use_templating()
builder.use_vite()
builder.use_app_sessions(secret_key="supersecret")
builder.use_auth_repos(session_repo=MySessionRepo(), user_repo=MyUserRepo())
builder.use_authentication()
builder.use_errors()

app = builder.build(debug=True)

Module Overview

Module Purpose
z8ter.auth Auth contracts, Argon2 crypto, guards, and session middleware
z8ter.builders AppBuilder and composable setup steps for config, templating, vite, auth, errors
z8ter.cli CLI entrypoints: new, create_page, create_api, and run dev
z8ter.endpoints Base API and View classes for SSR and REST endpoints
z8ter.route_builders Discovers SSR and API routes from filesystem
z8ter.responses / requests Wrappers around Starlette primitives
z8ter.logging_utils Rich logging with CancelledError suppression
z8ter.errors Centralized 404/500 error handling
z8ter.vite Dev/prod script tag helpers for Vite asset loading
z8ter.config Config loader with BASE_DIR and Starlette settings
z8ter.core Lightweight ASGI wrapper around Starlette

Framework Architecture

Backend Flow

  • route_builders walks your project structure to register SSR View classes and API mounts.
  • View.render() merges content/*.yaml data into Jinja templates, injecting page_id for client hydration.
  • API.endpoint() decorators map handlers into Starlette routes automatically.
  • Auth pipeline: middleware → guards → session manager ensures secure user sessions.
  • Unified error and response modules abstract Starlette internals.

Frontend Pipeline

  • src/ts/app.ts bootstraps JS “islands” using data-page attributes.
  • Solid.js components (e.g. z8-clock.tsx) render inline via solid-element (no shadow DOM).
  • vite.config.ts compiles and writes manifest under /static/js/.vite.
  • z8ter/vite.py injects dev or manifest-based <script> tags dynamically.
  • Tailwind and DaisyUI ship preconfigured for cohesive UI design.

CLI & Scaffolding

  • z8 new → initializes a full project tree (safe for wheel installs).
  • z8 create_page / create_api → generate views, content YAML, and JS islands.
  • z8 run dev → launches Uvicorn with rich logging and live reload.

Philosophy

“Small surface area, sharp tools.”

  • SSR-first with optional client interactivity
  • Conventions over configuration
  • Predictable lifecycle: builder → routes → middleware → templates
  • Full-stack parity between Python and JS layers

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

z8ter-0.2.6.tar.gz (196.0 kB view details)

Uploaded Source

Built Distribution

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

z8ter-0.2.6-py3-none-any.whl (221.9 kB view details)

Uploaded Python 3

File details

Details for the file z8ter-0.2.6.tar.gz.

File metadata

  • Download URL: z8ter-0.2.6.tar.gz
  • Upload date:
  • Size: 196.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for z8ter-0.2.6.tar.gz
Algorithm Hash digest
SHA256 1518c3107189756d9058ff005e43c1e966d49c745a1e2f1171549d637b8f620f
MD5 66f1fdcff640158abdc429e7a7b68920
BLAKE2b-256 0dec4ce196292deb38515c7b4e8bd5e737c1bf09117295ec796d3d80b6b63395

See more details on using hashes here.

File details

Details for the file z8ter-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: z8ter-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 221.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for z8ter-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 9d7cf2285fc42a590025071f6c62307c24efc89c11d2cc3e2c43b018b8882c8e
MD5 863e9079924718a19b3a53373c65e909
BLAKE2b-256 d43f8737d1f0432f6c60d63796aee7e4a413cdb64995ab05ddaca751342e08f0

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