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.8.tar.gz (11.0 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.8-py3-none-any.whl (11.2 MB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nexy-2.0.8.tar.gz
Algorithm Hash digest
SHA256 420406fd2cdc5953e47b8e5ff0de46d8040f2e6d0a7fa615dfca5b2cf87da5f9
MD5 c58f8277f1c25779d9511e2a3e0e9789
BLAKE2b-256 4738961a03e4dee56966ce80c329913b39b718c5187b0b52c99f9c65bb3d1272

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nexy-2.0.8-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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 ccd7cf5c29bccfe5fe26ee2bd74f0e4630963ae0956cca6470aadffc38798990
MD5 863c4199e85346c57dc2ed3a1405d498
BLAKE2b-256 cdba0fa22f344bcf2e2c577b835e826999cd34f5b16dd4721beb18faf96636ed

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