1
0
Fork 0
Web app for the Arma 3 unit Polaris Task Force. Uses Next.js for client- and server-side rendering, with a Postgres database and some other neat libraries. https://arma.onyxsimple.com
Find a file
Z8MB1E 7abca7185c feat(ai): add admin-configurable model connections
Every AI surface talked to the Unsloth box through env vars, so swapping
provider or model meant editing .env and restarting. A connection is now
a stored record: base URL, model id, key, structured-output mode, and a
reasoning toggle.

Three surfaces with their own selector (Compose, dialogue draft, line
rewrite), because they want different things from a model: a draft needs
strict schema adherence while a line rewrite only needs prose. Blank
means the env defaults, so an empty global behaves exactly as before.

The API key is write-only: field read access denies everyone, so it never
reaches the admin form, REST, GraphQL, or a populated relationship. Blank
submission means "unchanged" and `clearApiKey` is the only delete, which
avoids the masked-field-round-trips-empty bug. Backups still contain it;
a blank connection key falls back to UNSLOTH_API_KEY for that reason.

Structured output is no longer assumed to be json_schema. Some
OpenAI-compatible providers reject it, so a connection selects
json_schema, json_object or prompt, and the weaker modes serialise the
schema into the prompt and parse the reply. The Test button runs a plain
probe and a structured probe, because a provider that refuses json_schema
passes the first and fails every draft.

Compose keeps a single fixed dropdown entry: plugin config is built at
boot and cannot list database rows, so the handler resolves the selected
connection per request instead.

Draft provenance records the connection label, so a stored conversation
still names the provider that produced it.
2026-11-24 13:04:39 -05:00
.archived chore(repo): archive local scripts and update housekeeping 2026-08-20 19:57:29 -04:00
.todo chore(repo): archive local scripts and update housekeeping 2026-08-20 19:57:29 -04:00
.vscode feat: initial payload scaffolding 2025-10-24 02:07:13 -04:00
docs feat(ai): add admin-configurable model connections 2026-11-24 13:04:39 -05:00
patches fix(db): chunk drizzle json_build_array under postgres argument cap 2026-10-21 10:31:11 -04:00
public feat(arma): extract the marker catalog from game files 2026-10-04 02:53:15 -04:00
scripts chore(payload): regenerate types and schema, harden sequence reset 2026-10-03 03:30:43 -04:00
src feat(ai): add admin-configurable model connections 2026-11-24 13:04:39 -05:00
tests feat(ai): add admin-configurable model connections 2026-11-24 13:04:39 -05:00
Writerside feat: application staging deployment (ensure better commits after this) 2025-12-15 01:14:30 -05:00
.dockerignore chore(repo): archive local scripts and update housekeeping 2026-08-20 19:57:29 -04:00
.env.development chore: add ARMA_BRIDGE_API_KEY to dev env and /backups/ to gitignore 2026-08-31 12:27:12 -04:00
.env.example feat(arena): websocket match replication for Ordnance Disposal 2026-10-19 12:27:17 -04:00
.gitignore test(vitest): parallel forks with per-worker database clones 2026-10-21 10:41:57 -04:00
.npmrc feat: initial commit 2025-10-15 14:03:31 -04:00
.prettierrc.json feat: initial payload scaffolding 2025-10-24 02:07:13 -04:00
.yarnrc feat: initial commit 2025-10-15 14:03:31 -04:00
AGENTS.md fix(npc-dialogue): style the draft dialog for the admin panel 2026-11-22 23:34:12 -05:00
bun.lock feat(wiki): replace textarea overlay with a CodeMirror markdown editor 2026-11-18 15:12:22 -05:00
bunfig.toml feat: add LAST_UPDATED environment variable, update VersionOverlay to display last updated timestamp, and introduce patch script 2025-12-22 16:41:29 -05:00
CHANGELOG.md docs: add v0.16.9 changelog entry 2026-11-24 11:10:16 -05:00
components.json feat: application staging deployment (ensure better commits after this) 2025-12-15 01:14:30 -05:00
DEPLOYMENT.md feat(arena): websocket match replication for Ordnance Disposal 2026-10-19 12:27:17 -04:00
DESIGN.md feat(poker): redesign felt as diegetic oval with toolbar and viewer cards 2026-09-11 17:07:28 -04:00
docker-compose.yml feat(arena): websocket match replication for Ordnance Disposal 2026-10-19 12:27:17 -04:00
docker-entrypoint.sh fix(deploy): supervise the Discord bot in the entrypoint 2026-10-10 16:07:26 -04:00
Dockerfile fix(docker): pass NEXT_PUBLIC_ARENA_URL into the production build 2026-10-19 14:05:43 -04:00
drizzle.config.ts feat: application staging deployment (ensure better commits after this) 2025-12-15 01:14:30 -05:00
eslint.config.mjs feat: initial payload scaffolding 2025-10-24 02:07:13 -04:00
LESSONS.md docs: record frontend page padding convention in LESSONS.md 2026-10-13 16:43:16 -04:00
next.config.mjs fix(dev): allow LAN hosts in allowedDevOrigins so the dev server hydrates on other devices 2026-10-07 01:48:01 -04:00
package.json v0.16.9 - restyle tech tree note nodes 2026-11-24 11:28:28 -05:00
playwright.config.ts test(analytics): add collector, rollup, retention integration suite and e2e smoke 2026-10-14 12:13:01 -04:00
pnpm-lock.yaml.bk chore(deps): drop pnpm lockfile in favor of bun 2026-08-11 23:25:00 -04:00
postcss.config.mjs feat: application staging deployment (ensure better commits after this) 2025-12-15 01:14:30 -05:00
README.md docs: restrict release version bumps and tags to main deploys 2026-09-08 12:18:43 -04:00
reset-seq.sql chore(payload): regenerate types and schema, harden sequence reset 2026-10-03 03:30:43 -04:00
review_summary.md docs: update roadmap progress and add sidebar review summary 2026-08-23 18:52:27 -04:00
test.env feat: initial commit 2025-10-15 14:03:31 -04:00
TODO.md feat(personnel): add npc contacts directory and statistics pages 2026-09-06 01:24:14 -04:00
tsconfig.json feat: switch to Bun, add fonts and styling, update components and UI, add basic front-end 2025-12-16 23:26:52 -05:00
vitest.config.mts test(vitest): isolate:false shared forks with per-pid template clones + memoized payload boot 2026-10-21 12:54:30 -04:00
vitest.setup.ts test(vitest): isolate:false shared forks with per-pid template clones + memoized payload boot 2026-10-21 12:54:30 -04:00

Polaris Task Force

Web operations and administration hub for the Arma 3 unit Polaris Task Force. Dark-themed dashboard built with Next.js, Payload CMS, and PostgreSQL.

Tech stack

  • Framework: Next.js 16 (App Router, webpack)
  • CMS / Admin: Payload CMS 3.88.0 (@payloadcms/db-postgres + Drizzle)
  • Database: PostgreSQL
  • Styling: Tailwind CSS v4 (CSS-based, no config file) + shadcn/ui (New York style)
  • Package manager: Bun (bun.lock, bunfig.toml). The package.json scripts use cross-env and reference pnpm — run everything via bun run.

Features

  • Unit roster with org chart, ranks, assignments, and qualifications
  • Missions, campaigns, and factions with intel gating by assignment
  • Logistics: structures with storage grids and whitelist rules, resources, vehicles, shipments with distance and fuel tracking, automated game tick
  • Banking system: personal and treasury/faction accounts with full transaction ledger
  • Trading marketplace with NPC vendors, haggling negotiations, patience meters, and buyer-to-seller offers
  • Player lockers with loadouts, equipment, and wardrobe
  • Profiles with rank progression, XP, awards, and qualifications
  • In-app notification inbox (market offers, deal outcomes)
  • Real-time event log tied to structures and game entities, SSE updates from game ticks
  • Narrative event flowchart editor (React Flow) for GMs
  • Full Payload admin panel for content and configuration management

Quickstart

  1. bun install
  2. cp .env.example .env
  3. Edit .env: the DATABASE_URI line in .env.example is outdated (MongoDB). Replace it with a PostgreSQL connection string:
    DATABASE_URI=postgres://user:password@localhost:5432/your_database
    
    Set PAYLOAD_SECRET, APP_URL (default http://localhost:3000), and GAME_TICK_NOTIFY_SECRET.
  4. bun run dev — starts the dev server at http://localhost:3000.
    • Use bun run devsafe to wipe the .next cache before starting.

Dev credentials: dev / Test123 (if seed data has been applied).

Commands

Command Description
bun run dev Dev server (webpack, localhost:3000)
bun run devsafe Clear .next cache then start dev
bun run devturbo Dev server with Turbopack
bun run build Production build (webpack, increases memory limit)
bun run start Run the production build
bun run staging Start with NODE_ENV=test
bun run test Run integration tests then E2E tests
bun run test:int Vitest integration tests (requires live PostgreSQL)
bun run test:e2e Playwright E2E tests (auto-starts dev server)
bun run db Drizzle-kit wrapper (e.g. bun run db migrate)
bun run generate:types Regenerate payload-types.ts
bun run generate:importmap Regenerate admin import map
bun run payload <bin> Run Payload binaries
bun run payload game-tick Process shipment arrivals and fuel consumption
bun run payload market-tick Expire listings and refresh NPC vendor stock
bun run payload mission-tick Auto-complete missions whose scheduled day has passed
bun run payload server-tick Mark game servers without a recent heartbeat offline
bun run deploy Bump patch version and build; push to deploy via Coolify
bun run version:bump -- --base <sha> --head <sha> Choose and apply a patch/minor bump from a git range

Note: game-tick and market-tick are Payload bins registered in payload.config.ts, not npm scripts. Run via bun run payload.

All five bin scripts also log to daily files under logs/<bin-key>/ (e.g. logs/game-tick/2026-08-24.log) so tick output can be tracked over time. Override the directory with the BIN_LOG_DIR env var.

For an Arma 3 unit deployment we self-host on Coolify with one container per environment (dev / stg / prod), a Coolify-managed PostgreSQL service per environment, a persistent volume for /app/media, and docker exec scheduled jobs for the game tick. The Dockerfile is Bun-based (multi-stage, Next.js standalone runtime + Payload CLI kept at runtime), and docker-compose.yml mirrors the same shape for local full-stack dev.

CI version bumps

Run bun run version:bump -- --base "$CI_PREVIOUS_SHA" --head "$CI_SHA" before the production build. The script bumps minor for product changes under src/app, src/components/frontend, src/lib, src/collections, src/bot, src/hooks, src/migrations, or src/utils, and patch for other deployable changes. Use --dry-run to inspect the decision. Commit the changed package.json back to the deployment branch (for example, with a [skip ci] commit if your CI provider supports it); the existing generate:version-info build step will publish the new version to the app. Version tags (vX.Y.Z) ship only on main deploys: never bump versions or push release tags from feature branches, because parallel bumps desync package.json from the tags that actually deploy.

For the full setup — per-env Postgres provisioning, env vars, scheduled jobs, persistent media volume, SSE single-instance caveat, rollbacks, troubleshooting — see DEPLOYMENT.md.

Project structure

  • src/app/(frontend)/ — public-facing app pages (dashboard, logistics, banking, market)
  • src/app/(payload)/ — Payload admin panel and API routes
  • src/collections/ — Payload collections organized by domain (users, logistics, banking, market, game, etc.)
  • src/lib/ — shared utilities (storage rules, banking, shipping, market logic, realtime bus)
  • src/components/frontend/ — app UI components
  • src/components/ui/ — shadcn/ui primitives
  • src/tools/seed/ — seed scripts for initial data
  • src/scripts/ — game tick and utility scripts
  • tests/int/ — Vitest integration tests
  • tests/e2e/ — Playwright E2E tests

For full development notes (auth flow, access control, storage rules, event system, gotchas), see AGENTS.md.