Skip to content

roderiano/lua-spa

lua-spa logo

LUA-SPA

Backend-first SPA framework in Python.

This project includes:

  • LuaTemplate file served by the backend
  • .lspa components (HTML + Python) with component import support
  • Client hydration at component level
  • DOM diff renderer inspired by React's virtual DOM flow
  • useState hook-style state management
  • Base app definitions isolated in lua_template/spa.config.json

Requirements

  • Python 3.10+
  • Poetry installed

How to use

Install locally (development)

poetry install

Create a new project

lua-spa create my_project
lua-spa create my_project ./apps

Run the application

poetry run lua-spa serve

Enable hot reload:

poetry run lua-spa serve --reload

Open in browser:

http://127.0.0.1:8000

Documentation

Docs are available in the docs/ directory:

Run locally:

cd docs
npx docusaurus start

Project Structure

lua-spa/
  pyproject.toml
  src/
    lua_spa/
      app.py
      framework.py
      main.py
  lua_template/
    index.lspa
    spa.config.json
    components/
  tests/

Tests

poetry run pytest

With coverage:

poetry run pytest --cov=src/lua_spa --cov-report=term

Component Format

Components are .lspa files composed of:

  • optional imports
  • <python> block (executed on backend)
  • <template> block (HTML)

About

Backend-first SPA framework in Python.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors