Skip to main content

MikiUI

Build beautiful web, desktop, and mobile apps — entirely in Python.

PyPI version Python License

Installation · Quick Start · Documentation · Examples


MikiUI is a Python-first UI framework that lets you build web applications, native desktop windows, and mobile-friendly interfaces from a single codebase. No JavaScript required for logic — just Python classes that map to HTML, with a modern component API, built-in security, and real-time capabilities.

Why MikiUI?

  • One codebase, every target — deploy as a website, a desktop app (pywebview), or a mobile-responsive PWA
  • Python-first — write routes, components, and state in pure Python; the framework handles HTML, CSS, and JS interop
  • 60+ components and widgets — from buttons and forms to data grids, IDE editors, chat UIs, and MDI workspaces
  • Real-time built in — WebSocket with rooms/channels, SSE, and auth integration
  • Secure by default — CSRF protection, security headers, CSP nonces, and plugin sandboxing
  • API-ready — auto-generated OpenAPI docs, type-coerced path params, and route groups
  • Theming — 4 built-in themes (light, dark, solarized, dracula) with custom theme support
  • Plugin ecosystem — extend with custom components, widgets, themes, and backend routes

Installation

From PyPI (recommended)

pip install mikiui

With Tailwind CSS support

pip install mikiui[tailwind]
npm install  # installs Tailwind + DaisyUI

For desktop apps

pip install mikiui[desktop]

Verify

mikiui --help

Quick Start

1. Create a new project

mikiui new myapp
cd myapp

2. Write your app

# app.py
from mikiui import MikiApp, Div, H1, P, Button

app = MikiApp(title="My App")

@app.route("/", title="Home")
def home():
    return Div(
        H1("Welcome to MikiUI!"),
        P("Build web, desktop, and mobile apps in Python."),
        Button("Get Started", class_="miki-btn-primary"),
        class="flex flex-col items-center justify-center h-screen gap-4",
    )

if __name__ == "__main__":
    app.run()           # web server
    # app.run(desktop=True)  # native window

3. Run it

mikiui dev            # development server with hot-reload
# or
python app.py         # direct execution

Open http://127.0.0.1:8000 in your browser.


What You Can Build

Target Command Description
Website mikiui dev FastAPI + HTMX dev server
Desktop App mikiui desktop Native pywebview window
Mobile PWA mikiui build --target web Installable progressive web app
Static Site mikiui build --target web Pre-rendered HTML for any host
API Backend create_app(app) FastAPI with OpenAPI docs

Features

Components & Widgets

All HTML elements as Python classes (Button, Input, Form, Table, Dialog, Tabs) plus high-level widgets (DataGrid, MediaPlayer, DockablePanel, IDEEditor, ChatUI, KanbanBoard, Calendar, Carousel, and more).

Routing

Type-coerled path params, route groups, pattern-matched lookup, and per-route auth:

@app.route("/users/{user_id:int}", summary="Get user", tags=["users"])
def get_user(ctx, user_id: int):
    return Div(f"User {user_id}")

Real-Time

WebSocket with rooms, channels, and auth integration:

manager = ConnectionManager()
manager.join_room(ws, "chat-room")
await manager.broadcast_to_room("chat-room", {"message": "Hello!"})

Security

CSRF by default, security headers, CSP nonces, rate limiting, and plugin sandboxing.

API Documentation

Auto-generated OpenAPI schema with Swagger UI and ReDoc at /docs and /redoc.

Theming

4 built-in themes with custom theme support. Switch at runtime:

app.set_theme("dark")

Styling

Tailwind CSS (with optional DaisyUI) or plain CSS — switch without changing app logic.


Commands

Command Description
mikiui new <name> Scaffold a new project
mikiui dev Development server with hot-reload
mikiui desktop Native desktop window
mikiui build --target web Static web build
mikiui build --target desktop Desktop package
mikiui tailwind dev Watch & rebuild Tailwind CSS
mikiui install tailwind Install Tailwind + npm deps

Documentation

Guide Description
Getting Started Installation, first app, CLI reference
API Reference Full method signatures and examples
Widget Catalog All 60+ widgets with examples
Router Guide Routing, groups, middleware
Security Guide CSRF, auth, headers, plugin security
Styling Guide Tailwind, plain CSS, themes
Plugin System Creating and publishing plugins
Deployment Production setup, static export
Themes Built-in and custom themes
Changelog Version history

Examples

API with docs

from mikiui import MikiApp
from mikiui.backend import create_app
from mikiui_app_plugins import APIPlugin, SessionPlugin

app = MikiApp(title="My API")
session = SessionPlugin(secret_key="change-me")
app.use(session)
app.use(APIPlugin(title="My API", version="1.0.0", session_plugin=session))

@app.get("/api/items", summary="List items", tags=["items"])
def list_items(ctx):
    return [{"id": 1, "name": "Widget"}]

@app.post("/api/items", summary="Create item", tags=["items"])
def create_item(ctx):
    return {"id": 2, "name": "New Item"}, 201

fastapi_app = create_app(app)
# OpenAPI docs at /docs, ReDoc at /redoc

WebSocket chat with rooms

from mikiui.backend.websocket import ConnectionManager, mount_websocket

manager = ConnectionManager(max_connections_per_user=5)

async def chat_handler(ws, manager):
    user_id = ws.state.mikiui_user_id
    manager.join_room(ws, "general")
    try:
        while True:
            data = await ws.receive_text()
            await manager.broadcast_to_room("general", {"user": user_id, "text": data})
    except WebSocketDisconnect:
        manager.disconnect(ws)

Development Setup (Contributors)

To set up the project for development:

git clone https://github.com/alainmiki/mikiUI.git
cd mikiUI
pip install -e ".[dev,build,desktop,tailwind]"
pip install pytest-playwright
playwright install --with-deps chromium

Run tests:

python -m pytest tests/ --ignore=tests/e2e    # unit + integration
python -m pytest tests/e2e/                    # browser e2e (needs Chromium)

Build and validate:

python -m build
mikiui build --target web
mikiui build --target desktop

Requirements

  • Python 3.14+
  • Node.js 18+ (only for Tailwind CSS)
  • pywebview (only for desktop mode, auto-installed with [desktop])

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mikiui-0.2.0.tar.gz (405.7 kB view details)

Uploaded Source

Built Distribution

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

mikiui-0.2.0-py3-none-any.whl (452.5 kB view details)

Uploaded Python 3

File details

Details for the file mikiui-0.2.0.tar.gz.

File metadata

  • Download URL: mikiui-0.2.0.tar.gz
  • Upload date:
  • Size: 405.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mikiui-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6852e483273f81181a9197333055246bab83ca56b0dbc8bda1c6269db412e3a6
MD5 4668beaa9f26a4d96ab0d10999864b7c
BLAKE2b-256 c1d3f50559441ce4df080bca85e6c342de0ce654d305313528058b41f8a4e439

See more details on using hashes here.

Provenance

The following attestation bundles were made for mikiui-0.2.0.tar.gz:

Publisher: release.yml on alainmiki/mikiUI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mikiui-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mikiui-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 452.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mikiui-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 775e50ab23457a082d8188e09a3378cc56c04a3ce413fe4e210d6293f8e4c259
MD5 97fc456fa8abb37f4568df302b7f3064
BLAKE2b-256 7415a898f4ca9a1f48fbd7a0eddc2d86e2d80e3aaaa4db4953a5bf2751e14036

See more details on using hashes here.

Provenance

The following attestation bundles were made for mikiui-0.2.0-py3-none-any.whl:

Publisher: release.yml on alainmiki/mikiUI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page