Source: https://www.hype-stack.dev/docs/development/commands

# Commands

All commands run from the monorepo root using pnpm. Nx handles dependency ordering, so `pnpm dev` starts services in the
right sequence.

## Everyday commands

| Command          | What it does                                                         |
| ---------------- | -------------------------------------------------------------------- |
| `pnpm dev`       | Start every dev server: backend, frontend, admin, extension, Metro   |
| `pnpm build`     | Production build for all apps                                        |
| `pnpm typecheck` | Run TypeScript checks across the whole repo                          |
| `pnpm lint`      | Lint all apps and packages with oxlint                               |
| `pnpm format`    | Format all apps and packages with oxfmt                              |
| `pnpm test`      | Run every Vitest suite, one project at a time                        |
| `pnpm generate`  | Regenerate Prisma client, Paraglide messages, and the exported types |

Run `pnpm generate` after changing backend routes, socket events, or shared enums so the frontend, admin, and mobile
apps pick up the new types.

## Per-app commands

Target a specific app with `--filter`, or run an Nx target for one project:

```bash
# Backend only
pnpm nx serve @hype-stack/backend
pnpm --filter @hype-stack/backend typecheck
pnpm --filter @hype-stack/backend test

# Frontend only
pnpm --filter @hype-stack/frontend serve
pnpm --filter @hype-stack/frontend typecheck
pnpm --filter @hype-stack/frontend test
```

The backend's serve target is defined in its `package.json` under `nx`, not as a script, which is why it goes through
`pnpm nx serve`.

## Database commands

The backend owns the Prisma scripts. Names are `migration:*`, not `prisma:*`:

```bash
# Create a migration from schema changes and apply it locally (prisma migrate dev)
pnpm --filter @hype-stack/backend migration:create

# Apply committed migrations without prompting (prisma migrate deploy). CI and production
pnpm --filter @hype-stack/backend migration:latest

# Mark the last migration rolled back (prisma migrate resolve --rolled-back)
pnpm --filter @hype-stack/backend migration:down

# Drop and recreate the local database from the migrations (prisma migrate reset)
pnpm --filter @hype-stack/backend migration:reset

# Regenerate the Prisma client and message types after a schema change
pnpm --filter @hype-stack/backend generate

# Open Prisma Studio (visual DB browser)
pnpm --filter @hype-stack/backend exec prisma studio
```

The backend tests run against their own Postgres on a separate port. Set it up once with
`pnpm --filter @hype-stack/backend test:setup`, which starts `docker-compose.test.yml`, migrates it, and generates the
client. `create` does this for you when you say yes to migrations.

## Mobile app

The Expo app is `apps/mobile`. `pnpm dev` starts Metro with the other serve targets. To run it alone:

```bash
pnpm --filter @hype-stack/mobile serve
pnpm --filter @hype-stack/mobile ios
pnpm --filter @hype-stack/mobile android
pnpm --filter @hype-stack/mobile test
```

On a physical iPhone, install Expo Go from [sign.expo.dev](https://sign.expo.dev/), not the App Store. Full walkthrough:
[Mobile](/docs/mobile).

## Desktop app

```bash
# Start the Electron app with hot reload
pnpm --filter @hype-stack/frontend start:app

# Package it for the current platform
pnpm --filter @hype-stack/frontend package:app
```

## Browser extension

```bash
pnpm --filter @hype-stack/extension serve
pnpm --filter @hype-stack/extension build           # Chrome and Edge (MV3)
pnpm --filter @hype-stack/extension build:firefox
```

## Docker

The compose file lives next to the backend:

```bash
cd apps/backend

# Start Postgres, Valkey, and RustFS
docker compose up -d

# Stop services
docker compose down
```
