Testing
The template uses Vitest on both sides. Tests sit next to the code they cover. The goal is confidence in your features, not snapshots of framework behavior.
Backend
Backend tests live under apps/backend next to features and routes. They run against a real Postgres from
apps/backend/docker-compose.test.yml, on its own port so it never collides with your dev database. create prepares
it when you say yes to migrations; otherwise run it once yourself:
pnpm --filter @hype-stack/backend test:setupPrefer integration-style tests that hit real modules and that database over mocking the query layer.
Conventions from the repo rules:
- Throw typed errors; do not assert on swallowed
try/catchpaths that the error middleware would handle - Keep mutations and queries tested through the feature modules when practical
- Use the shared testing helpers under
apps/backend/src/testing/
Run:
pnpm --filter @hype-stack/backend testFrontend
Frontend tests use Testing Library and HyperFetch setMock on SDK requests. That keeps hooks and components real while
controlling the network boundary.
pnpm --filter @hype-stack/frontend testDo not mock @hyper-fetch/react, the router, or internal hooks unless there is no other way. Prefer setMock on
sdk.* requests and clean mocks in afterEach.
Mobile
Mobile tests use Vitest with vitest-native and Testing Library for React Native.
pnpm --filter @hype-stack/mobile testTo run the app on a phone or simulator, see Mobile.
Playwright / E2E
Browser E2E coverage depends on what your project generated and which packs you installed. If Playwright is present in the workspace, treat auth, org onboarding, and billing checkout as the high-value paths. Pack and registry sandboxes also exercise combinations outside your app; that is for pack authors, not day-to-day app work.
What not to test
- Pure re-exports and config objects
- Framework behavior (Hono routing, React rendering with no assertions)
- Third-party dashboard UIs (Stripe Checkout, WorkOS hosted screens)
Related
Every purchase and sponsorship funds my 8+ years of work on open source given freely to the community. It keeps the lights on, funds new packs, and keeps the ecosystem alive. Even a small tier means a lot. Thank you!
