KingdomsX is a Minecraft plugin similar to Factions, with more advanced core features and additional mechanics such as turrets, structures, and invasions.
This repository contains the public website for the project. It is built with Astro and deployed on Cloudflare.
- Astro - static site framework
- Cloudflare Workers - request routing, API handlers, scheduled cron
- Cloudflare D1 - SQLite database for server listings
- TypeScript - worker code under
worker/
- Node.js 24
- npm
src/pages/- Astro page entrypointssrc/components/- reusable Astro componentssrc/assets/- bundled styles, scripts, and imported mediasrc/data/- content/data modules used by the sitepublic/- files copied directly to the site rootworker/- Cloudflare Worker source and local development assetswrangler.jsonc- production Cloudflare configurationwrangler.local.jsonc- local preview configuration
Contributions are appreciated and always welcome through pull requests.
Clone the repository:
git clone https://github.com/CryptoMorin/KingdomsX-Web.git
cd KingdomsX-WebInstall dependencies:
npm ciCopy the example local environment file:
cp .dev.vars.example .dev.varsThe checked-in example values are enough for the local Worker preview. Real credentials are only needed for OAuth-specific testing.
After setup, use one of these development workflows depending on what you're working on:
Use this for quick frontend work. It skips the Worker and serves pages directly via Astro's dev server.
npm run devUse this when working on routing, API handlers, D1 queries, or server listings. It builds the Astro site and serves it through the local Cloudflare Worker on port 8787, backed by local D1 data and secrets from .dev.vars.
Run the local setup before the first preview, after pulling or adding D1 migrations, or whenever you need to refresh local preview data:
npm run worker:setup:localThen start the preview:
npm run previewPlease run these before opening a pull request.
Run the Cloudflare Worker and D1 test suite after changing Worker behavior, API handlers, migrations, or server-directory logic:
npm run worker:testType-check Worker code after changing anything under worker/:
npm run worker:typecheckRegenerate Worker type bindings after changing bindings or Wrangler config:
npm run worker:types:checkRun a deploy dry-run after changing Worker routing, bindings, or Cloudflare configuration:
npm run worker:deploy:checkRun the production build before all pull requests:
npm run build