f445aabcb4d2de27b71ce2ea2b31d8ee0fe2bab2
Group downloads and scraps by type in Entry and Release details Add FileViewer component for .txt, .nfo, image, and PDF previews Update download API to support inline view with correct MIME types Signed-off-by: Junie@lucy.xalior.com
Spectrum Next Explorer
A Next.js application for exploring the Spectrum Next ecosystem. It ships with:
- Register Explorer: parsed from
data/nextreg.txt, with real‑time search and deep links - ZXDB Explorer: a deep, cross‑linked browser for entries, labels, genres, languages, and machine types backed by a MySQL ZXDB instance
- Bootstrap 5 theme with light/dark support
Quick start
- Prerequisites: Node.js 20+, pnpm (recommended), access to a MySQL server for ZXDB (optional for Registers)
- Install dependencies:
pnpm install
- Run in development (Turbopack, port 4000):
pnpm devthen open http://localhost:4000
- Build and start (production):
pnpm buildpnpm start(defaults to http://localhost:3000)
- Lint:
pnpm lint
Project scripts (package.json)
dev:PORT=4000 next dev --turbopackbuild:next build --turbopackstart:next startdeploy: merge current branch intodeployand push toexplorer.specnext.devdeploy:branch: same asdeploy, but accepts a deploy branch argumentsetup:zxdb-local: configure local submodule excludes for ZXDB SQL filesdeploy-test: push totest.explorer.specnext.devdeploy-prod: push toexplorer.specnext.dev
Routes
/— Home/registers— Register Explorer/zxdb— ZXDB Explorer (hub)/zxdb/entries— Entries search + filters/zxdb/entries/[id]— Entry detail/zxdb/releases— Releases search + filters/zxdb/labelsand/zxdb/labels/[id]— Labels search and detail/zxdb/genresand/zxdb/genres/[id]— Genres list and entries/zxdb/languagesand/zxdb/languages/[id]— Languages list and entries/zxdb/machinetypesand/zxdb/machinetypes/[id]— Machine types list and entries/zxdb/magazinesand/zxdb/magazines/[id]— Magazines list and issues/zxdb/issues/[id]— Issue detail (contents and references)
ZXDB setup (database, env, and helper tables) The Registers section works without any database. The ZXDB Explorer requires a MySQL ZXDB database and one environment variable.
- Prepare the database (outside this app)
- Import ZXDB data into MySQL. If you want only structure, use
ZXDB/ZXDB_mysql_STRUCTURE_ONLY.sqlin this repo. For data, import ZXDB via your normal process. - Create the helper search tables (required for fast search):
- Run
ZXDB/scripts/ZXDB_help_search.sqlagainst your ZXDB database.
- Run
- Create a read‑only role/user (recommended):
- Example (see
bin/import_mysql.sh):- Create role
zxdb_readonly - Grant
SELECT, SHOW VIEWon databasezxdb
- Create role
- Example (see
- Configure environment
- Copy
.envfromexample.env. - Set
ZXDB_URLto a MySQL URL, e.g.mysql://zxdb_readonly:password@hostname:3306/zxdb. - On startup,
src/env.tsvalidates env vars (t3.gg pattern with Zod) and will fail fast if invalid.
- Run the app
pnpm dev→ open http://localhost:4000 and navigate to/zxdb.
- Keep the ZXDB submodule clean (recommended)
- Run
pnpm setup:zxdb-localonce after cloning. - This keeps
ZXDB/ZXDB_mysql.sqlandZXDB/ZXDB_mysql_STRUCTURE_ONLY.sqlavailable locally without appearing as untracked changes.
API (selected endpoints)
GET /api/zxdb/search?q=...&page=1&pageSize=20&genreId=...&languageId=...&machinetypeId=...&sort=title&facets=1GET /api/zxdb/entries/[id]GET /api/zxdb/releases/search?q=...&year=...&languageId=...&machinetypeId=...&sort=...GET /api/zxdb/labels/search?q=...GET /api/zxdb/labels/[id]?page=1&pageSize=20GET /api/zxdb/genresand/api/zxdb/genres/[id]?page=1GET /api/zxdb/languagesand/api/zxdb/languages/[id]?page=1GET /api/zxdb/machinetypesand/api/zxdb/machinetypes/[id]?page=1GET /api/zxdb/{availabletypes,casetypes,currencies,filetypes,roletypes,schemetypes,sourcetypes}
Implementation notes
- Next.js 15 dynamic params: pages and API routes that consume
paramsmust await it, e.g.export default async function Page({ params }: { params: Promise<{ id: string }> }) { const { id } = await params; } - ZXDB integration uses Drizzle ORM over
mysql2with a singleton pool atsrc/server/db.ts; API routes declareexport const runtime = "nodejs". - Entry and detail pages server‑render initial content and use ISR (
revalidate = 3600) for fast time‑to‑content; index pages avoid a blocking first client fetch. - Database Schema: Repository queries include graceful fallback checks (via
information_schema.tables) to remain functional even if optional tables (likereleasesordownloads) are missing from the connected MySQL instance.
Further reading
- ZXDB details and API usage:
docs/ZXDB.md - Agent/developer workflow and commit guidelines:
AGENTS.md
License
- See
LICENSE.txtfor details.
Description
Languages
TypeScript
77.3%
SCSS
11.6%
CSS
7.5%
JavaScript
2%
Dockerfile
1.4%
Other
0.2%