This repo contains the current browser version of Virtual Farmer: a progression-based farming clicker with cloud sync and leaderboard support.
The website is currently in a playable and mostly stable state.
What is working right now:
- Core gameplay loop: farm, collect plants, and sell inventory for money.
- Progression systems: hoes, fertilizers, upgrades, XP, and prestige.
- Auto Farm mode: runs in the background at reduced yield and resumes after reload.
- Offline Auto Farm catch-up: applies missed gains after returning (capped at 24 hours).
- Authentication pages: email/password sign up and login with live password checks.
- Cloud save: game state syncs to Supabase when the user is signed in.
- Leaderboards: top players by total plants, balance, and XP.
Current page structure:
index.html: main game interfacelogin.html: sign-in pagesignup.html: account creation page
- Vanilla HTML, CSS, and JavaScript
- Supabase Auth + Postgres (via
@supabase/supabase-jsCDN) - LocalStorage fallback/save layer
- Serve the project as a static website (recommended):
python -m http.server 8080- then open
http://localhost:8080
- Open
signup.htmlto create an account, orlogin.htmlif you already have one. - After login, continue to
index.htmlto play.
Supabase is already wired in supabase/config.js.
Database setup checklist:
- Open Supabase SQL Editor.
- Run
supabase/001_progress_schema.sql. - In Supabase Auth, enable Email sign-in.
- If email confirmation is enabled, confirm the account before logging in.
- Local save key:
virtualFarmerSave - Auto Farm state key:
autoFarmState - Supabase config cache key:
virtualFarmerSupabaseConfig - Local save happens during gameplay actions and also every 30 seconds.
- Cloud saves are queued/debounced and flushed during important actions (for example sign-out).
- On load, the app compares local and cloud timestamps and keeps the newer state.
- If Supabase config is present and the user is not authenticated,
index.htmlredirects to login. - If Supabase config is missing, the game can still run in local-only mode.
- The app is frontend-only (no Node backend in this repo).
- Branding is currently mixed between "Farm Simulator" and "Virtual Farmer" in different pages.
- No automated test suite is included yet.
data.js: plant, hoe, fertilizer, upgrade, and achievement datagame.js: gameplay logic, save/load, cloud sync, auto-farm, and prestigeui.js: rendering, navigation, event handlers, leaderboard UIauth.js: login/sign-up validation and auth flowauth.css,styles.css: page stylingsupabase/client.js: Supabase wrapper and cloud operationssupabase/001_progress_schema.sql: schema, RLS policies, and leaderboard view