Skip to content

Build from source

For working on Vulniverse itself. To just run it, start with the quick starts instead.

This runs the standalone application: the Flask backend plus the Vue frontend, talking to each other over /api/v1.

Prerequisites

  • Node.js 22.18 or newer (Node 24.12+ is also supported) and npm
  • Python 3.12
  • uv

1. Install and start the backend

cd backend
uv sync
cp .env.example .env
python3 -c "import secrets; print(secrets.token_hex(32))"   # paste into .env's SECRET_KEY=
uv run python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"   # paste into .env's CNA_CREDENTIAL_ENCRYPTION_KEY=
uv run flask --app vulniverse_api db upgrade
uv run flask --app vulniverse_api init-local-user
uv run flask --app vulniverse_api run --debug

create_app() requires both SECRET_KEY and CNA_CREDENTIAL_ENCRYPTION_KEY to be set (via .env or the real environment) and fails fast with a clear error if either isn't — see Configuration and Running in production.

init-local-user is a separate, one-time step db upgrade doesn't do for you: it creates the internal user that local mode ([server] mode = "local" in config/vulniverse.toml, the default — see Configuration) auto-authenticates every request as. Without it, every request gets "Authentication required" even though the deployment is genuinely in local mode, since db upgrade only creates the user table, not this row.

The API listens on http://127.0.0.1:5000 by default. The SQLite database lives in the Flask instance directory (backend/src/instance/), created automatically on first run.

CPE vendor/product autocomplete (in the Affected-products editor) needs its own local catalog synced before it returns anything:

uv run flask --app vulniverse_api cpe sync

Without this, the app still works fine — vendor/product search just silently returns no results until it's run. See Architecture.

2. Install and start the frontend

In another terminal:

cd frontend
npm ci
npm run dev

Open http://localhost:5173. During development, Vite proxies /api requests to the Flask server at http://127.0.0.1:5000 (configured in frontend/vite.config.ts) — the backend from step 1 must already be running for the editor to load or save anything.

Development checks

# Frontend type-check and production build
cd frontend
npm run build

# Frontend lint (applies safe fixes)
npm run lint

# Backend tests
cd ../backend
uv run pytest

# Backend lint and type-check
uv run ruff check .
uv run mypy .

Building the embeddable editor

To produce the self-contained <vulniverse-editor> Web Component instead of (or in addition to) the standalone app:

cd frontend
npm run build:element

This writes a single file, frontend/dist/element/vulniverse-editor.js, with its CSS and images inlined. See Architecture for what to do with it, and Embedding: Vulnerability-Lookup for a worked example.

Warning

npm run build (the standalone app) clears all of frontend/dist/ on start, including frontend/dist/element/; npm run build:element only clears frontend/dist/element/. If you need both outputs, run build:element last — running the standalone build afterwards deletes the element bundle it just produced.