# {{projectName}} / {{appName}}

Voltro backend scaffold (template: **api-backend-mail**).

## Boot

```bash
pnpm install                # at the repo root
pnpm --filter @{{projectName}}/{{appName}} dev
# → http://localhost:4000
# → ws://localhost:4000/ws
```

## What's in here

| File | Role |
|---|---|
| `app.config.ts`                          | App declaration + `mailPlugin` wired (`console` provider). |
| `database/schema.ts`                     | One example table (`notes`) with the `tenant()` mixin. |
| `queries/` + `mutations/`                | Streaming subscription + tenant-guarded mutation examples. |
| `emails/welcome.email.tsx`               | A React-Email welcome template (edit/replace freely). |
| `actions/sendWelcome.{rpc,handler}.ts`   | `mail.sendWelcome` — sends the welcome template. |

## Mail

Transactional email is wired out of the box via `@voltro/plugin-mail`:

- **Preview** templates in the dashboard's **Mail** tab (props box
  pre-fills from each template's `preview`).
- **Send** with the `mail.sendWelcome` action, or `yield* MailService`
  + `mail.send({ template: 'welcome', props })` from any handler.
- The default `console` provider just **logs** the mail (zero-config, no
  API key) and captures it in the dashboard outbox. For real delivery,
  switch `provider` in `app.config.ts` to `'resend'` / `'postmark'` /
  `'sendgrid'` / `'smtp'` and set the matching env var (e.g.
  `RESEND_API_KEY`).

Drop more `*.email.tsx`, `*.query.ts` + `*.query.server.ts`, `*.mutation.ts` + `*.mutation.server.ts`, `*.action.ts` + `*.action.server.ts`, or `*.stream.ts` + `*.stream.server.ts`, or `*.workflow.tsx`
files anywhere in this tree — discovery is by file convention.
