# Frameworks and livops.json

> Which frameworks Livops detects, and how to control commands with a livops.json file in your repository.

Source: https://livops.dev/en/docs/frameworks

Before deploying, Livops reads your repository and detects the framework. That determines the install, build and start commands. You can change them in the cabinet or in a `livops.json` file.

## Detected frameworks

| Language | Frameworks |
| --- | --- |
| JavaScript / TypeScript | Next.js, Nuxt, Astro, SvelteKit, Remix, React Router, TanStack Start, SolidStart, Qwik, Gatsby, Docusaurus, VitePress, Vite, Create React App, Angular, Vue CLI, Eleventy, Hexo, Node.js server, Telegram bot (Node) |
| Python | Python app (FastAPI, Django, Flask and others), Python Telegram bot, MkDocs |
| PHP | Laravel, plain PHP |
| Ruby | Rails, Jekyll |
| Go, Rust | Go, Rust |
| Java | Maven, Gradle |
| Other | Hugo, `Dockerfile`, plain HTML |

If the repository has a `Dockerfile`, it is used. If nothing is detected, the folder is served as a static site.

Livops also reads these files: `livops.json`, `Procfile`, `Dockerfile`, `.python-version`, `runtime.txt`, `.nvmrc`, `.node-version`.

## Django

For a project laid out the way `startproject` lays it out, Livops:

- runs `python manage.py migrate --noinput` before every start, so the tables exist (the build has no database, so migrate never runs there);
- runs `python manage.py collectstatic --noinput` during the build, if the project has `django.contrib.staticfiles` and `STATIC_ROOT` is set;
- sets the `ALLOWED_HOSTS` variable to the project's addresses, comma-separated, unless you set it yourself.

Django does not read `ALLOWED_HOSTS` from the environment on its own. In `settings.py`:

```python
import os
ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", "").split(",")
```

With `DEBUG = False` Django serves no static files. Add [whitenoise](https://whitenoise.readthedocs.io/): `pip install whitenoise`, put `"whitenoise.middleware.WhiteNoiseMiddleware"` right after `SecurityMiddleware` in `MIDDLEWARE`, and set `STATIC_ROOT = BASE_DIR / "staticfiles"`.

## livops.json

Put `livops.json` in the repository root (or the project folder). **Every field is optional**: anything you leave out comes from the detected value.

```json
{
  "kind": "web",
  "install": "npm ci",
  "build": "npm run build",
  "start": "node dist/server.js",
  "healthPath": "/healthz",
  "memory": 512
}
```

| Field | Meaning |
| --- | --- |
| `kind` | Service type: `site`, `web`, `bot`, `worker` or `cron`. |
| `install` | Command that installs dependencies. |
| `build` | Build command. |
| `output` | Build output folder for a static site (for example `dist`). |
| `start` | Start command. |
| `healthPath` | Path that checks the app is alive; starts with `/`. |
| `schedule` | Schedule for `cron`; see [Cron and workers](https://livops.dev/en/docs/cron-workers). |
| `memory` | Memory in MiB: `256`, `512`, `1024` or `2048`. |
| `builder` | `dockerfile` or `preset`: which one builds a project that has a `Dockerfile`. Read when the project is created. By default the `Dockerfile` is used when no framework was recognised. |

### Types

- `site` — static site: the build output is served as files. Free.
- `web` — a server app that answers HTTP requests. It must listen on the port in the `PORT` variable.
- `bot` — Telegram bot: always running, no public URL needed.
- `worker` — background process: queue, subscriber, etc. No public URL.
- `cron` — a command that runs on a schedule.

### Rules

- The file is read on **every deploy**, from the commit being built. While it names a field, the file wins over the cabinet; take the field out and the cabinet's (or the detected) value is back on the next deploy.
- Applied on every deploy: `install`, `build`, `output`, `healthPath` and `schedule`.
- `kind`, `memory` and `start` are applied when the project is created. After that they are changed in the project's settings — the type and the memory tier are what you pay for. If the file says something else, the build log says so.
- If the JSON is invalid, the whole file is ignored and the deploy continues with the project's settings.
- An unknown `kind`, a disallowed `memory`, a `healthPath` that is not a path or a `schedule` on a service that is not `cron` is dropped with a note in the build log; the other fields are used.
- `healthPath` is a path only, not a host or `https://`: `/healthz`, `/api/ping?full=1`.
- If `memory` is omitted, the type's default is used.
