Skip to content
dateoPublic

About

anketa runs questionnaires and audit catalogs that are defined as YAML data.

Topics

Resources

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

191 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

anketa by dateo

anketa

anketa runs questionnaires and audit catalogs that are defined as YAML data. A catalog is a YAML file with sections, questions, answer options, validation rules and small formulas. The formulas decide which parts of the catalog are shown, based on earlier answers.

The main example is the German BSI IT-Grundschutz-Kompendium 2023. You answer in the index which of its 111 modules apply to you, and only those modules appear, with their 5,616 requirements in total.

anketa has three parts: a TypeScript library with the catalog model, a web UI, and a small backend that stores answers.

The name

Anketa (анкета) means questionnaire in Russian, Ukrainian, Bulgarian and Serbian. Polish has ankieta for a survey. The word comes from the French enquête, an inquiry.

Try it

You need Node.js 22.12 or newer.

npm ci
npm run dev

Open http://localhost:3000. The BSI catalog loads. Without a backend, the app runs in demo mode: there is no sign-in, and answers are saved in your browser only. ?catalog=test in the address bar opens a small test catalog instead.

Documentation

The documentation covers how-to guides (trying anketa, running the backend, writing a catalog, rebuilding the BSI catalog), the architecture (catalog model, formulas, security), the developer guide and a glossary.

Repository layout

Path Contents
anketa-core catalog model, question types, validation, translations, formulas
anketa-ui web UI, built with React, OpenSearch OUI and Vite
anketa-backend API for answers, sign-in settings for the UI, metrics; serves the UI
catalogs catalogs as YAML
anketa-bsi Python script that builds catalogs/bsi2023.yml from the BSI sources

Catalogs

A catalog is a tree. Sections (volume, chapter, sub-chapter) contain groups, rows, matrices and questions. Each item has an id of letters and digits, joined by single - or _, at most 36 characters long. An item is addressed by the ids on its path, for example index.prozesse.ISMS.anforderungen.ISMS_1.

Question types:

  • free text, optionally checked as e-mail address, name, URL, IPv4 address, CIDR range, private network, VLAN, MAC address, phone number or Markdown
  • number, date
  • single choice, including yes/no and Likert scales
  • multiple choice
  • free text with suggestions
  • structured values: a link, a person or a location

Titles and option labels can carry one text per language. The UI switches between German and English.

Formulas

A formula is written in braces:

visible: '{index.prozesse.ISMS.anforderungen.ISMS_1.value > 0}'

The syntax is a subset of JavaScript expressions. anketa parses formulas with jsep and evaluates them itself; it never runs them as JavaScript. A formula can read answers (<path>.value) but cannot reach prototypes or global objects. When formulas depend on each other, they are evaluated in order.

Loading a catalog in code

import { catalogFromYaml } from 'anketa-core';

const catalog = catalogFromYaml(yamlText);
const data = catalog.save(); // the same structure, ready to store

Rebuilding the BSI catalog

The BSI's Word files are not in the repository: download the Word edition 2023 into anketa-bsi/Edition_2023_Word/ first, as described in How do I rebuild the BSI catalog?.

cd anketa-bsi
pip install -r requirements.txt
python create_catalog.py   # writes ../catalogs/bsi2023.yml

Backend

npm run build
ANKETA_ALLOW_ANONYMOUS=true node anketa-backend/dist/index.js

The backend listens on port 3001 and serves the built UI as well.

Endpoint Purpose
GET, PUT, DELETE /api/facts/:path read, store and delete the answer for an item
GET /api/keycloak.json Keycloak settings for the UI
GET /healthz health check
GET /metrics Prometheus metrics

Answers are kept in memory for now and are lost on restart.

Configuration

Variable Effect
PORT port, default 3001
KEYCLOAK_URL, KEYCLOAK_REALM, KEYCLOAK_CLIENT_ID users sign in with Keycloak, and /api/facts requires their token. Unset: the UI runs in demo mode
ANKETA_ALLOW_ANONYMOUS true allows /api/facts without Keycloak. Use it for demos only. Otherwise the API answers 503
UI_DIR directory of the built UI, default anketa-ui/dist
SENTRY_DSN send errors to Sentry
TLS_KEY_FILE, TLS_CERT_FILE serve HTTPS directly instead of behind a proxy

The UI reads these at build time:

Variable Effect
VITE_DEFAULT_CATALOG catalog to open first, default bsi2023
VITE_SENTRY_DSN send browser errors to Sentry
VITE_PLANTUML_URL PlantUML server for diagrams in texts. Unset: diagrams are shown as code and nothing is sent anywhere

npm run dev forwards /api to http://localhost:3001; set ANKETA_BACKEND_URL to use another address.

Docker

docker build -t anketa .
docker run -p 3001:3001 -e ANKETA_ALLOW_ANONYMOUS=true anketa

Development

npm test            # tests of all packages (Vitest)
npm run lint        # ESLint
npm run typecheck   # TypeScript
npm run format      # Prettier
npm run check       # all of the above, as in CI
npm run hooks       # once per clone: the commit hooks

Commit messages, pull and merge requests and tracked files carry no tooling attribution; the hooks and CI check it (scripts/check-attribution.sh, see the developer guide).

GitHub Actions runs npm run check on Node 22 and 24 for every push and pull request. It also builds the UI, the backend and the Docker image, and checks the production dependencies for known vulnerabilities.

Status

anketa is at an early stage.

Working now:

  • catalogs with sections, matrices, all question types listed above, validation and translations
  • formulas, evaluated in dependency order
  • the BSI 2023 catalog, covered by tests
  • the web UI with the catalog tree and an editor for each question type
  • demo mode without a backend
  • the backend API with Keycloak sign-in

Planned:

  • a database for answers
  • saving answers from the UI to the backend
  • catalogs for more standards, such as ISO/IEC 27001 and TISAX
  • maturity levels, protection requirements, responsibilities and roles
  • assets, documents with versions and expiry dates, and risk management

License

Apache License 2.0

About

anketa runs questionnaires and audit catalogs that are defined as YAML data.

Topics

Resources

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages