Skip to main content

The Modern Fullstack Python Meta-Framework: Build high-performance web apps .

Project description

Nexy

Nexy is a modular, full-stack meta-framework designed to bridge the gap between FastAPI backends and Vite-powered frontend ecosystems such as React, Vue, Svelte, and Solid.js. Built on Python 3.10+, it enables the development of rich, interactive applications within a unified environment.


Getting Started

Nexy leverages a streamlined workflow. The use of uv is recommended for optimal performance and dependency management.

1. Initialize Project

mkdir my_project && cd my_project
uv init && uv venv

2. Install and Initialize Nexy

uv add nexy && nexy init
# Alternative: pip install nexy && nexy init

3. Launch Development Server

nexy dev

The .nexy Format (Server Components)

A .nexy or .mdx file serves as a Server Component. Internally, Nexy transforms these files into Python functions where the header contains the logic and the body defines the template.

---
# Python Logic Layer
title : prop[str] = "Nexy Component"

from "@/components/Card.nexy" import Card
from "@/components/Chart.tsx" import Chart
from "@/assets/data.json" as config
---
<!-- Jinja2 Template Layer (Server-Side Rendered) -->
<div class="p-6 bg-white rounded-xl shadow-lg">
    <h1>{{ title }}</h1>
    
    <!-- Nexy Server Component -->
    <Card content="Server-side rendered content" />
    
    <!-- Frontend Island (React/Vue/Svelte) -->
    <Chart data="{{ config }}" />
</div>

Core Features

  • Typed Props: Properties are defined using the name : prop[type] syntax.
  • Polyglot Imports: Direct import support for .nexy, .vue, .tsx, .svelte, .mdx, .py, .json, and image assets within the component header.
  • Function Mapping: A file named users.nexy is automatically mapped to a Python function named Users().

Routing Systems

Nexy provides two distinct routing strategies to accommodate different architectural requirements.

1. File-Based Routing

The directory structure within src/routes/ automatically generates the application's URL schema. This system supports .nexy, .mdx, and .py files.

File Path URL Resource Type
index.nexy / HTML Page
about.mdx /about Markdown Page
blog/[slug].nexy /blog/:slug Dynamic Page
api/users.py /api/users API Endpoint

API Route Definitions (.py)

API routes are defined by standard Python functions corresponding to HTTP methods:

def GET(slug: str):
    return {"message": f"Hello, {slug}"}

def POST():
    return {"status": "success"}

Dynamic Patterns

  • [slug]: Standard dynamic parameter.
  • [...slug]: Catch-all segments for deep nesting.
  • name-[slug]: Prefixed dynamic parameters.
  • (group): Organizational folders that do not affect the URL path.

2. Module-Based Routing

For enterprise-level architectures, Nexy offers a decorator-based approach inspired by modular frameworks like NestJS.

from nexy.decorators import Module, Controller

@Controller()
class AppController:
    def GET(self):
        return "Hello from Controller"

@Module()
class AppModule:
    controllers = [AppController]
    providers = []
    imports = []

Nexy CLI (nx)

The nexy command-line interface (also accessible via the nx alias) manages the application lifecycle:

  • nexy init: Initializes the project configuration, including framework selection and Tailwind CSS integration.
  • nexy dev: Starts the development server with Hot Module Replacement (HMR) for both FastAPI and Vite.
  • nexy build: Compiles and optimizes assets for production deployment.
  • nexy start: Launches the production server.

Technical Specifications

  • Requirement: Python 3.10+ and Node.js environment.
  • Backend: Built on FastAPI and Pydantic for high-performance data validation.
  • Frontend: Powered by Vite for near-instant builds and modern ecosystem compatibility.
  • Security: Automatic Jinja2 escaping and Pydantic-based prop validation to ensure architectural integrity.

License

Distributed under the MIT License.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

nexy-2.0.9.tar.gz (11.1 MB view details)

Uploaded Source

Built Distribution

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

nexy-2.0.9-py3-none-any.whl (11.2 MB view details)

Uploaded Python 3

File details

Details for the file nexy-2.0.9.tar.gz.

File metadata

  • Download URL: nexy-2.0.9.tar.gz
  • Upload date:
  • Size: 11.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.17

File hashes

Hashes for nexy-2.0.9.tar.gz
Algorithm Hash digest
SHA256 e10c80ca156880f4e81ab5a771db820371a7990c676962938f3e88f22e85e58d
MD5 2b855f7f4c72d7438b3ace63db5cd1ca
BLAKE2b-256 7fb539c5f8989430ba1f56db18f25c1411deef358be20bb7a948328031d42f74

See more details on using hashes here.

File details

Details for the file nexy-2.0.9-py3-none-any.whl.

File metadata

  • Download URL: nexy-2.0.9-py3-none-any.whl
  • Upload date:
  • Size: 11.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.17

File hashes

Hashes for nexy-2.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 594e47116ff9304d279a203406c7edb38aaa3cc912e7256ddf76bc9c778a1cda
MD5 fe00241e9299f75a86d80dc4645526a7
BLAKE2b-256 e328afaef94d7e5e3508d292ebbd6570e0ada86dff7ec447f3e312ed425d3ed3

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