opr-army-db
v2.0.3
Published
Static army book data for One Page Rules game systems — no runtime API calls
Downloads
907
Maintainers
Readme
OPR Army Database
TypeScript package and sync script to extract structured JSON data from One Page Rules' Army Forge.
Features
- Full TypeScript interfaces for OPR data structures (
OprArmyBook,OprUnit,OprWeapon,OprRule) - Programmatic API Client (
OprApiClient) for live official and community lists - Local file Client (
OprLocalClient) for rapid, offline JSON reads - CLI Script to sync full official game system catalogues to local JSON
Supported Systems
grimdark-future(ID: 2)grimdark-future-firefight(ID: 3)age-of-fantasy(ID: 4)age-of-fantasy-skirmish(ID: 5)
Usage
Local JSON Client (Recommended)
Use this if you have synced the data locally. ```ts import { OprLocalClient } from 'opr-army-db';
const client = new OprLocalClient('./data'); // path is optional, defaults to internal /data dir
// Reads directory contents locally const books = await client.getArmyBooks('grimdark-future');
// Parses specific JSON file const details = await client.getArmyBookDetails('w7qor7b2kuifcyvk', 2, 'grimdark-future'); ```
API Client
Directly calls OPR APIs for live data. ```ts import { OprApiClient } from 'opr-army-db';
const client = new OprApiClient();
// Fetch list of Grimdark Future army books via API const books = await client.getArmyBooks('grimdark-future');
// Fetch a specific book details via API const details = await client.getArmyBookDetails('w7qor7b2kuifcyvk', 2, 'grimdark-future'); ```
Syncing Database Locally
Sync all game systems to local JSON: ```bash npm run sync ```
Sync a specific game system: ```bash npm run sync -- grimdark-future npm run sync -- age-of-fantasy-skirmish ```
The data will be stored as raw JSON structured under ./data/<game_system_slug>/<book_id>.json.
