# MaxCredit

Next.js website for maxcredit.sg.

## Requirements

- Node.js 24
- pnpm 10

## Local setup

```bash
pnpm install
cp .env.example .env.local
pnpm dev
```

With the default `.env.example` values, the site runs locally without any external services. Enquiries are accepted but not sent anywhere.

## Environment variables

Set these in `.env.local` for local use, or in your hosting provider's environment settings for production.

### Contact form (required in production)

| Variable | Value |
| --- | --- |
| `CONTACT_MODE` | `live` in production, `mock` for local testing |
| `SITE_URL` | Public site address, e.g. `https://maxcredit.sg` |
| `FIREBASE_PROJECT_ID` | Firebase project ID |
| `FIREBASE_REGION` | `asia-southeast1` |
| `FIREBASE_CLIENT_EMAIL` | Firebase service account email |
| `FIREBASE_PRIVATE_KEY` | Firebase service account private key |
| `RESEND_API_KEY` | Resend API key, used to send email |
| `RESEND_FROM_EMAIL` | Sender address (must be verified in Resend) |
| `CONTACT_NOTIFICATION_EMAIL` | Inbox that receives enquiries |
| `TURNSTILE_SITE_KEY` | Cloudflare Turnstile site key |
| `TURNSTILE_SECRET_KEY` | Cloudflare Turnstile secret key |
| `RATE_LIMIT_HMAC_SECRET` | Random string, at least 32 characters |

### Optional

| Variable | Value |
| --- | --- |
| `GOOGLE_PLACES_API_KEY` | Google Places API key for the live review rating |
| `APPLICATION_MODE` | Leave as `disabled` |
| `MYINFO_MODE` | Leave as `disabled` |

Other variables in `.env.example` can stay blank while the two modes above are `disabled`.

## Production

```bash
pnpm install
pnpm build
pnpm start
```

On Vercel, import the repository, add the environment variables above, and deploy.

Deploy `firestore.rules` and `storage.rules` to the Firebase project with the Firebase CLI:

```bash
firebase deploy --only firestore:rules,storage
```
