Skip to content

Local setup

  • Node.js 20+ and npm
  • Git
  • Build tools for the better-sqlite3 native module if no prebuilt binary matches your platform (Xcode Command Line Tools on macOS, build-essential and python3 on Linux)
Terminal window
git clone https://github.com/chmedinap/pethealth.git
cd pethealth
# Terminal 1 — API on http://localhost:3001 (data in backend/data)
cd backend
npm install
JWT_SECRET=dev ALLOW_REGISTRATION=true npm run dev
# Terminal 2 — UI on http://localhost:5173
cd frontend
npm install
npm run dev

Open http://localhost:5173. The Vite dev server proxies /api and /uploads to the backend; set BACKEND_URL if the API runs elsewhere. npm run dev in the backend uses nodemon and restarts on changes.

The first start creates backend/data/pethealth.db, the admin / admin123 user and the demo pets. Delete backend/data/ to start over.

Terminal window
SEED_DEMO=false # start empty
LOGIN_RATE_LIMIT=0 # no login throttling
SMTP_HOST=localhost SMTP_PORT=1025 # e.g. with Mailpit/MailHog to see emails
TZ=America/New_York
Terminal window
cd frontend && npm run build # outputs frontend/dist
cp -r frontend/dist backend/public # the backend serves ./public as the SPA
cd backend && NODE_ENV=production JWT_SECRET=... node src/index.js

The Docker image does exactly this (see Building the image).