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

Uploaded Python 3

File details

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

File metadata

  • Download URL: z8ter-0.1.5.tar.gz
  • Upload date:
  • Size: 16.9 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.5.tar.gz
Algorithm Hash digest
SHA256 6a5bbcaeb3ab02a79c4e8b503694818f25fadf0e78b0397f2a7b7a10960e7be0
MD5 264d44ba7ebdac19fad960a601881a4a
BLAKE2b-256 99fef6389c678f41e441134e5c78333d8b3aa3f483baaad8a570c735953cc811

See more details on using hashes here.

File details

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

File metadata

  • Download URL: z8ter-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 21.4 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 636dba571ed870e561c7bf890afc20470fd180b068a0bc3db1ac2acc27f5a02d
MD5 a3fa610d1c467da704f47a399a5eea64
BLAKE2b-256 db53343b387b5c19ee9a4d9fa26fc57288015a3f57e41af6b373936b192c726b

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