Files

2.6 KiB

OSDB — Obstsortendatenbank

A full-stack fruit-variety database (Go + Vue 3).

Features

  • Users can view a "Hello, OSDB!" landing page that confirms the backend is reachable via the Vite proxy.
  • Users can create, view, edit, and delete fruit varieties, including managing synonyms and uploading images.
  • Administrators can bulk-import the legacy fruit database from XML using scripts/import_fruits.py, and then import all publications (cover images, linked fruits, PDFs, fruit images) using scripts/import_publications.py.
  • Users can search fruits by name or synonym (case-insensitive, debounced) and filter by type or combined-type alias (e.g. "Birnen- und Quittensorten") from the fruit list.
  • Users can manage publications (books, catalogues) with cover images, linked fruits, per-fruit PDF descriptions, and fruit images; fruit detail pages show publication descriptions and images.
  • Maintainers can log in with a username and password to access data-modifying operations; all write API endpoints and admin controls are protected behind JWT authentication.

Quick Start

cp .env.example .env                      # set credentials
cp backend/.env.example backend/.env      # set JWT_SECRET and USERS_FILE
cp users.env.example users.env            # create user file (see below)
./scripts/create_user.sh admin secret >> users.env   # add a user (restart backend to reload)
make dev-db                               # start Postgres (waits until healthy)
make migrate-up                           # apply schema migrations
make run-backend                          # Echo API on :3000
make run-frontend                         # Vite dev server on :5000

Importing Legacy Data

Prerequisites: Postgres running and migrated, psycopg2 installed (pip install psycopg2-binary), 03-data/ present at repo root.

Scripts must be run in order — publications depend on fruits being present.

1. Import fruits

DATABASE_URL=postgres://osdb:osdb@localhost:5432/osdb?sslmode=disable python3 scripts/import_fruits.py

Imports fruits, synonyms, and fruit images from 03-data/obstsorten.xml. Idempotent: upserts by osdb_number.

2. Import publications

DATABASE_URL=postgres://osdb:osdb@localhost:5432/osdb?sslmode=disable python3 scripts/import_publications.py

Imports publications from 03-data/osws.xml. For each publication: upserts the row, loads cover image, links fruits, and imports PDFs and fruit images. Idempotent: clears and re-inserts linked data on re-run.

Managing Users

Add a user and restart the backend to reload:

./scripts/create_user.sh <username> <password> >> users.env

Testing

make test