Ninoo

Ninoo Builder

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 backend: Python by default, or Java or Node if you ask for it. One app can even have a few, in different languages.

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.

An app has one main backend, in one language, and can have up to 2 more if you ask (see Several backends). The web page itself is always React, whichever backend it talks to.

Java (Spring Boot)

Ask for it by name, for example “build the API in Java with Spring Boot”, or import a project that already has one. Ninoo then writes a Spring Boot 4.1.2 app on Java 21, built with Maven, in the same api/ folder and under the same /api routes.

Your project
api/
  pom.xml                                   # Spring Boot, Java 21, dependencies
  src/main/java/...                         # controllers under /api, plus GET /api/health
  src/main/resources/application.properties # reads .env, H2 database settings
  data/                                     # H2 database files, if the app keeps data
.env                                        # secrets
  • Web, validation, JPA, H2, DevTools and the test starters are already downloaded; anything else is fetched on the next build.
  • The first start compiles the app and takes longer than Python. After that, a change is compiled and the app restarts in a few seconds.
  • A workspace with a Java backend gets 2 GB of memory.
  • Maven only for now: no Gradle and no Kotlin.

Node (Express)

Ask for it by name, for example “write the server in Node with Express”. Ninoo then writes an Express app in plain JavaScript on Node 22, in the same api/ folder and under the same /api routes. It has its own packages, separate from the web page's.

Your project
api/
  package.json       # the backend's own packages (Express and anything else)
  server.js          # routes under /api, plus GET /api/health
  data/app.db        # SQLite file (better-sqlite3), if the app keeps data
.env                 # secrets, read from process.env
  • It restarts by itself a moment after a change, like the Python one.
  • A workspace with a Node backend gets 1.5 GB of memory.
  • A workspace made on an older Node moves to Node 22 the next time it starts after a pause, and rebuilds the backend's packages for it once. Your files stay as they are.
  • JavaScript only on the server for now: no TypeScript there.

Several backends

Sometimes one part of an app is best in one language and another part in a different one, for example the number crunching in Python and the payments in Java. Ask for it, and Ninoo keeps the main backend in api/ and adds up to 2 more in services/, each named after its job and in its own language.

Your project
api/                 # the main backend: /api/...
services/
  ml/                # Python: /api/ml/...
  pay/               # Java: /api/pay/...
.env                 # one set of secrets, shared by all of them
  • Each one answers its own part of the address: /api/pay/… goes to services/pay, everything else under /api to the main one, /api/payments included. The web page calls them the same way, with relative addresses.
  • At most 2 besides the main one. A further one isn't run in the preview, and publishing takes it offline if it was live before.
  • They all read the same .env. They don't call each other: the web page calls each one.
  • When you publish, each goes online on its own, with the limits below. Payment webhooks stay in the main backend.
  • The workspace gets the memory each needs added together, up to 4 GB.

Most apps need only one. More backends mean more to look after, so Ninoo adds them only when you ask.

Keeping data

Data that should survive a restart goes in a database file: SQLite in api/data.db for Python, H2 in api/data/ for Java, SQLite in api/data/app.db for Node. In the workspace it's kept with the rest of your project, and the published backend starts from a copy of it.

On the published site, files can reset

The live backend runs on demand, and files it writes, the database file 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 the backend's code (python-dotenv, Spring's settings for Java, process.env for Node). 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/… (and an extra one at /api/its-name/…). Before the new version goes live, Ninoo checks /api/health (/api/its-name/health). If one doesn't answer within 90 seconds, or anything else in the publish fails, every backend of the app keeps the version it had.

It runs on demand, so the first request after a quiet spell can take a few seconds; a Java backend takes longer to wake than a Python one, often five to ten seconds. Each backend has these limits of its own:

Memory1 GB
Time per request30 seconds
Requests handled at once5
Extra packages (Python), the built app (Java) or the app with its packages (Node)Up 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. An app with several backends counts them together: one free allowance, one cap.

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.