Skip to main content

Minimal Starlette-powered app framework with pages, APIs, and a DX-first CLI.

Project description

Z8ter.py

Z8ter is a lightweight, Laravel-inspired full-stack Python web framework built on [Starlette], designed for rapid development with tight integration between backend logic and frontend templates—plus small client-side “islands” where they make sense.


✨ Features (Current)

1) File-Based Views (SSR)

  • Files under views/ become routes automatically.
  • Each view pairs Python logic with a Jinja template in templates/.
  • A stable page_id (derived from views/ path) is injected into templates and used by the frontend loader to hydrate per-page JS.

2) Jinja2 Templating

  • Template inheritance with {% extends %} / {% block %}.
  • Templates live in templates/ (default extension: .jinja).

3) Small CSR “Islands”

  • A tiny client router lazy-loads /static/js/pages/<page_id>.js and runs its default export.
  • Great for interactive bits (theme toggles, pings, clipboard, etc.) without going full SPA.

4) Decorator-Driven APIs

  • Classes under api/ subclass API and register endpoints with a decorator.
  • Each class mounts under /api/<id> (derived from module path).

Example shape (conceptual):

api/hello.py      →  /api/hello
views/about.py    →  /about
templates/about.jinja + static/js/pages/about.js (island)

🚀 Getting Started

Prerequisites

  • Python 3.11+ and pip
  • Node 18+ and npm

Install & Run (dev)

# 1) Python deps (in a venv)
python -m venv .venv
source .venv/bin/activate        # Windows: .\.venv\Scripts\Activate.ps1
pip install -r requirements.txt  # or: pip install -e .

# 2) Frontend deps
npm install

# 3) Dev server(s)
npm run dev

npm run dev runs the dev workflow (backend + assets). Check the terminal for the local URL.


📁 Project Structure

.
├─ api/                     # API classes (@API.endpoint)
│  └─ hello.py
├─ views/                   # File-based pages (SSR)
│  └─ index.py
├─ templates/               # Jinja templates
│  ├─ base.jinja
│  └─ index.jinja
├─ static/
│  └─ js/
│     └─ pages/             # Per-page islands: about.js, app/home.js, ...
│        └─ common.js
├─ z8ter/                   # Framework core (Page, API, router)
└─ main.py                  # App entrypoint

🧩 Usage Examples

View + Template (SSR)

{# templates/index.jinja #}
{% extends "base.jinja" %}
{% block content %}
  <h1>{{ title }}</h1>
  <div id="api-response"></div>
{% endblock %}

Client Island (runs when page_id matches)

// static/js/pages/common.ts (or a specific page module)
export default async function init() {
  // hydrate interactive bits, fetch data, etc.
}

Minimal API Class

# api/hello.py
from z8ter.api import API

class Hello(API):
    @API.endpoint("GET", "/hello")
    async def hello(self, request):
        return {"ok": True, "message": "Hello from Z8ter"}

🛣️ Planned

  • CLI scaffolding: z8 new, z8 dev, z8 create_page <name>
  • Auth scaffolding: login/register/logout + session helpers
  • Stripe integration: pricing page, checkout routes, webhooks
  • DB adapters: SQLite default, Postgres option
  • HTMX + Tailwind/DaisyUI polish out of the box

🧠 Philosophy

  • Conventions over configuration
  • SSR-first with tiny CSR islands
  • Small surface area; sharp, pragmatic tools

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for z8ter-0.1.3.tar.gz
Algorithm Hash digest
SHA256 873b75ea85c0acab7f79c48e74494104e2e952a8fee2bb6b43a356edded371ae
MD5 d4d27ac90a483f2c73d2d24b1e4f7b1b
BLAKE2b-256 3ed61a54c4862c5667191e215f740ce4a6e3ab7d6100b5abd278d745c73ad047

See more details on using hashes here.

File details

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

File metadata

  • Download URL: z8ter-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 13.8 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.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c5753aca6ca46bf32764e8f5a42713c9dc98f9dae5404bbb7462865b103f80c1
MD5 2260b3c37f2856cbf57c3672f20e5cd7
BLAKE2b-256 6ed98fb108ea003480ba267d768b75ebb5c6893763696f649526b0948bbe8885

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