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

This version

2.0.7

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nexy-2.0.7.tar.gz
Algorithm Hash digest
SHA256 269415990a93898dfbbee812b45b8db4fd1753fd34d0579a12f11349db7ea326
MD5 a25e1e5265c10412d35c1eed5aa982cb
BLAKE2b-256 4d5b59141a1b6903b453dcecc9e6b6d0bf26123f64416e02f0f6c441e67f15b8

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nexy-2.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 5ea62b14e954b8d9e64fd2794771409f401b514a4fad69b3e83f7743792f85eb
MD5 89414886d63705dbd7f92a0d2e14872d
BLAKE2b-256 7bfd69b31d3eb09b54ef44dce211b0fdb818d987d0442335989929da61f4d179

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