Ninoo

Ninoo Builder

Python backends and data

Most apps run entirely in the browser. When yours needs a server, to keep shared data, hide an API key or do heavy work, Ninoo adds a small Python backend.

When you need one

  • Several people should see the same data, like bookings or a shared list.
  • The app calls a paid API with a secret key that must not be in the web page.
  • It fetches data from another site on a schedule or on request.
  • It does calculations that are too heavy for a phone.

Just ask: “save the bookings on a server so everyone sees them”. Ninoo adds the backend only when the app needs one, so you never have to set it up yourself.

How it's set up

The backend is a FastAPI app in the api/ folder, written in Python 3.11. Every route lives under /api, and the web page calls it with a relative address like fetch("/api/bookings").

Your project
api/
  main.py            # app = FastAPI(); routes under /api, plus GET /api/health
  requirements.txt   # extra Python packages, one per line
  data.db            # SQLite file, if the app keeps data
.env                 # secrets, read with python-dotenv

Common packages are already installed: fastapi, uvicorn, pydantic, httpx, requests, python-dotenv, python-multipart, pandas, numpy, scipy, yfinance and sqlmodel. Ninoo adds anything else to requirements.txt.

Keeping data

Data that should survive a restart goes in a SQLite database file, api/data.db. In the workspace it's kept with the rest of your project.

On the published site, files can reset

The live backend runs on demand, and files it writes, SQLite included, are temporary for now. They can be wiped at any time. Don't rely on the published app to keep data you can't lose.

Secret keys

Put API keys in the .env file at the top of the project, for example WEATHER_API_KEY=…. Ninoo reads them in Python. Never give a secret a VITE_ name: those are built into the web page, where anyone can read them.

  • Viewers on a shared project can't open .env.
  • When you publish, the .env values become the live backend's settings. Names starting with VITE_ or AWS_ are left out, and the total is limited to 4 KB.
  • Push to GitHub never includes .env. Download .zip does, so keep that file to yourself. See Export.

When you publish

Publish puts the backend online too, at your-app-1a2b.ninoo.app/api/…. Before the new version goes live, Ninoo checks /api/health. If it doesn't answer within 90 seconds, the previous version keeps running.

It runs on demand, so the first request after a quiet spell can take a few seconds.

Memory1 GB
Time per request30 seconds
Requests handled at once5
Extra packagesUp to 250 MB
.env settingsUp to 4 KB in total
More, then Backend: the backend's status, this month's requests and cost, and the monthly cap
More → Backend shows its status, this month's use and the cap.

What it costs

The published backend is paid by the project owner, from their credits.

FreeThe first 100,000 requests and 20,000 GB-seconds of run time
Requests after that$3 per million
Run time after that$0.00002 per GB-second (one second at 1 GB of memory)

A monthly cap protects you from surprises. It starts at $5, and the owner can raise it up to $500 under More → Backend.

RunningYour live site's /api calls are answered.
Paused: monthly cap reachedRaise the cap and it starts again within a few minutes.
Paused: owner out of creditsIt starts again by itself a few minutes after a top-up.

Building and testing the backend in the workspace costs nothing extra beyond normal workspace time.