Skip to content

Repository files navigation

Day One Inc.

A browser-based, dashboard-only economic simulation for entrepreneurs: start with ₭ 400,000, build production chains across eleven world regions, dig raw goods out of the ground where the ground actually has them, trade on a bot-made global market, ship the goods to where they sell, market your shops past their share of a town, sell back what you overbuilt at a haircut, grow an industrial group. 1 game year = 1,008 ticks = 3.5 real days at the default interval.

Setup

pnpm install
pnpm dev        # API on :3001, web on :5173 (append ?dev=1 for the dev bar)

Everything else is automatic: the SQLite database creates itself under apps/server/data/, schema migrations apply themselves at boot, and the first account (@founder1, "Day One Inc.") is created on a fresh database.

pnpm test runs all suites, pnpm typecheck type-checks every package, pnpm balance runs the §9 economy harness (see BALANCE_REPORT.md). Production deploys via Railway (railway.json) against Neon Postgres, one service serving both the API and the web build — DEPLOY.md is the checklist, including which variables must stay unset.

Mail. Six transactional notices (incorporation, reset, dissolution, the away digest, insolvency, profile amendments) go out through Resend, styled as company stationery. It is inert unless RESEND_API_KEY is set. Safe to arm once sign-in is configured, because an account's address is then the identity provider's verified one rather than whatever a client typed — without sign-in it should stay unset on any public deploy. See DEPLOY.md.

Sign-in. Authentication is Neon Auth (Neon's managed Better Auth), reached from the browser through @neondatabase/neon-js. The browser signs in against that service directly and never sends a password here; the API gets a short-lived JWT and verifies it locally against the service's published keys, so this server stores no credential of any kind — just the token's subject on the account row.

Set both NEON_AUTH_URL (server) and VITE_NEON_AUTH_URL (web) to the project's Auth URL from the Neon console. With them set, a verified token is the only way to name an account and the x-user-id header stops meaning anything; with them unset there is no login at all, which is the local-SQLite development mode — and a NODE_ENV=production server refuses to start that way, because an unauthenticated public server looks perfectly healthy. A database played before sign-in existed keeps its worlds, unreachable until an operator hands one over with pnpm --filter @dayone/server link-account <handle> <subject>.

Users. One account owns one company and one independent world — including its own bot market — and one clock ticks all of them. Signed in, one identity owns exactly one company and the server resolves it from the token. Without sign-in, the browser names its account with an x-user-id header remembered in localStorage, so two tabs can play two companies, and the dev bar (?dev=1) switches accounts and adds new ones with generic names. Either way the user switcher's "New company" opens the incorporation flow, and the office menu's masthead opens the profile, where the handle, email and the company's name and logo live.

Regions. A company operates in up to eleven regions, each with its own wage level, its own consumer town, its own warehouse and its own geology; the wholesale book is global but the goods always sit somewhere, and moving them between regions costs freight and burns fuel. A raw good can only be extracted where it occurs — there is no oil under Rotterdam, and Western Europe, the default home, has no cotton and the map's thinnest iron either — so trade is not optional. Incorporating picks a home region, which starts with a free, already-active office and warehouse — enough to operate from day one. Every other region has to be entered by building an office there first.

Docs: ECONOMY.md is the working model of the map and both markets — the global wholesale bot market and each region's consumer market, marketing included — plus the calibration (what the money is worth, how a size level scales, and why every price, wage, capex and opex is the number it is); read it before touching any of them. REGIONS.md is the regions/logistics spec reconciled with what was built. DECISIONS.md records the design and engine decisions.

About

Dayone Game

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages