Skip to main content

Natural Frontend Logo

From backend to frontend with one line
Don't waste hours generating a frontend for your users.

NF Usage

https://github.com/axelpey/natural-frontend/assets/1381992/dbef93fa-6313-4122-902b-9109961abeec

Features

Coming soon:

  • Save your generated frontends to modify them later.
  • Use local models instead of OpenAI.

Usage

⬇️ Installation

With pip: pip install natural-frontend

➕ Add to your code

With FastAPI

Just add one-line to your api project:

from fastapi import FastAPI
from natural_frontend import NaturalFrontend

openai_key = "sk-..."

app = FastAPI()
app = NaturalFrontend(app, openai_key)

@app.get("/books")
async def get_books():
    return books_db


@app.post("/books")
async def add_book(book: Book):
    books_db.append(book.dict())
    return {"message": "Book added successfully"}

class Book(BaseModel):
    id: int
    title: str
    author: str
    genre: str

With Flask

It's the same!

from flask import Flask
from natural_frontend import NaturalFrontend

openai_key = "sk-..."

app = Flask(__name__)
app = NaturalFrontend(app, openai_key)

⚙️ Options

You can provide options to customize your Natural Frontend:

nf_options = NaturalFrontendOptions(
   colors={"primary": "lightblue", "secondary": "purple"},
   personas=[{"Bookworm": "Loves to look for new books"}],
   cache_expiry_time=600,
   frontend_endpoint="frontend",
)

app = NaturalFrontend(app, openai_key, nf_options)

Documentation of options:

  • colors: Customize the color themes of the frontend. Use two keys: "primary" and "secondary".
  • personas: Add custom personas for your frontend. NF will guess more until there's a total of 5 personas.
  • cache_expiry_time: Set the time in seconds before the generation cache expires.
  • frontend_endpoint: Change the endpoint of the frontend.

Development

We're happy to get contributors working with us! Follow the instructions below to quickly setup your local environment.

Running the Application

  1. (Optional) Use virtualenv to quickly setup your environment: virtualenv venv && source venv/bin/activate

  2. Install the required packages: pip install -r requirements.txt

  3. Run one of the example applications: uvicorn example.APP.main:app --reload where APP is one in the examples directory.

(With Docker)

  1. Make sure you have Docker installed

  2. Run docker compose up --build

Metadata

Release files for natural-frontend 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for natural-frontend 0.1.1
File Size Uploaded
natural_frontend-0.1.1.tar.gz 235.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for natural-frontend 0.1.1
File Interpreter ABI Platform
natural_frontend-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 464.6 kB

Release files / natural_frontend-0.1.1.tar.gz

Download URL natural_frontend-0.1.1.tar.gz
Size 235.6 kB
Tags Source
SHA-256 checksum
How to use checksums
779939f5a18ff906fb39f52657f95f0a90909d9abbbc65f0d0043bf58d5d663e
BLAKE2b-256 checksum
How to use checksums
95283cf29f727a30fda8b1317e91f671f93f686a76601e01db54a04a46046b09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / natural_frontend-0.1.1-py3-none-any.whl

Download URL natural_frontend-0.1.1-py3-none-any.whl
Size 229.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d76bff98b09eb41307b0756c319926f26a5a0866d4cd39bd854e84856618a9b2
BLAKE2b-256 checksum
How to use checksums
d8173c77c8c6bc1eeecf11439048ba1b45773fe1179bef952c3147cc9f5e962f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.2

2 release files

0.0.1

2 release 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