Node.js and Python starters

nodejs, python, express, fastify, next.js, flask, django, fastapi, starter, template · 0 found this helpful

A starter is a small working app that Apps sets up for you: the code, the packages and the address. Every starter answers a health check, so you know it's running before you change anything. This article lists what each one contains.

The starters

Starter Runtime Needs Health check Main file
Express Node.js 18 or newer /health app.js
Fastify Node.js 20 or newer /health app.js
Next.js Node.js 18 or newer / server.js from your build
Flask Python 3.9 or newer /health app.py
Django Python 3.10 or newer /health config/urls.py
FastAPI Python 3.9 or newer /health main.py
Your own code Either Any / The file you name

The wizard only offers starters your server has a version for, and picks the newest version by default.

The New app drawer with the starters listed

What's in each one

Express and Fastify

  • package.json with the framework.
  • app.js with a welcome page at / and {"ok": true} at /health.
  • NODE_ENV set to production.

Next.js

Next.js has no template. You upload a standalone build, and we start its server.js without installing or building anything. See Deploy a Next.js site.

Flask

  • app.py with the routes.
  • passenger_wsgi.py, the startup file the server runs.
  • requirements.txt with Flask.

Django

  • A project in config/ with production settings, SQLite, and the routes in config/urls.py.
  • manage.py and passenger_wsgi.py.
  • DJANGO_SECRET_KEY, a new random value for each app, and DJANGO_ALLOWED_HOSTS, your domain. Both live in the app's environment variables, not in the code.

FastAPI

  • main.py with the routes and API docs at /docs.
  • passenger_wsgi.py, which bridges FastAPI to the server with a2wsgi.
  • requirements.txt with FastAPI and a2wsgi.

Paths and APP_BASE_PATH

You can run an app on a whole domain (api.example.ca) or under a path (example.ca/orders). Under a path, we set APP_BASE_PATH to /orders. Every starter serves its routes both under that path and at /, so links work either way.

Next.js doesn't read APP_BASE_PATH. For a Next.js app under a path, set basePath: '/orders' in next.config.js before you build.

Grow it into your app

  1. Edit the files in the code folder with Files, SFTP or Git.
  2. Add packages to package.json or requirements.txt.
  3. In Apps, open the ⋯ menu on the app and click Install packages. The install runs in the background and restarts the app when it's done.
  4. After code changes that need no new packages, click Restart.

Keep the health check, or change it to something that proves your app works, such as a database query. The New app drawer waits for it to return OK when you create the app. After that, the app list checks that your app's address answers each time you open Apps.

If something goes wrong

Problem Fix
A starter isn't in the list Your server doesn't have a version it needs yet. Open a request and we'll check
"That folder already has files" Type a new Code folder path, such as apps/orders-2, or pick Your own code to run what's there
The health step doesn't finish Open Recent errors from the app's ⋯ menu

Was this helpful?

Still stuck? Ask us and we'll walk you through it.