# Deployment Checklist for license.getstacklogic.com

## Hosting

Recommended simple options:

- Render Web Service plus managed PostgreSQL
- Railway service plus PostgreSQL
- Fly.io app plus managed Postgres
- DigitalOcean App Platform plus managed PostgreSQL

For cPanel hosting, use cPanel's Node.js App / Application Manager with:

```text
Application URL: license.getstacklogic.com
Application root: StackLogic-License-Server
Startup file: app.js
Application mode: Production
```

This repository includes an `app.js` Passenger startup wrapper.

## cPanel Web Installer

For a guided cPanel install, upload the project and temporarily keep the `install/` folder. Visit:

```text
https://license.getstacklogic.com/install/
```

The installer writes `.env`, runs dependency installation, builds the app, and applies Prisma migrations. Create the PostgreSQL database and user in cPanel first; the installer expects a working `DATABASE_URL`.

After a successful install:

1. Restart the Node.js app in cPanel.
2. Confirm `/health` returns `{ "ok": true }`.
3. Open `/admin`.
4. Delete the `install/` folder from the server.

Do not leave the installer publicly accessible after setup.

Set the service command:

```bash
npm start
```

Set the build command:

```bash
npm ci && npm run prisma:generate && npm run build
```

Run migrations during deployment:

```bash
npm run prisma:migrate
```

## DNS and HTTPS

Create a DNS record:

```text
license.getstacklogic.com -> your hosting provider target
```

Enable HTTPS/SSL from the hosting provider before configuring Stripe live webhooks.

## Stripe

Webhook endpoint:

```text
https://license.getstacklogic.com/stripe/webhook
```

Event:

```text
checkout.session.completed
```

Configure:

- `STRIPE_SECRET_KEY`
- `STRIPE_WEBHOOK_SECRET`
- `STACKLOGIC_PRODUCT_ID`
- `STACKLOGIC_PRICE_ID`

Use the real Price ID for the `$29.99` one-time StackLogic Professional Payment Link.

## Email

Recommended:

- Postmark for production transactional email.
- Resend as a good simpler alternative.

Required:

- Authenticate `getstacklogic.com` SPF/DKIM with the provider.
- Use a sender such as `StackLogic <support@getstacklogic.com>`.
- Set `STACKLOGIC_DOWNLOAD_URL` to the official download page.

## Backups

Back up PostgreSQL daily. Retain at least:

- 7 daily backups
- 4 weekly backups
- 3 monthly backups

Before deployment updates:

1. Confirm latest backup is healthy.
2. Run migrations on staging or a copy first when possible.
3. Deploy.
4. Check `/health`.
5. Confirm `/admin/licenses` loads.
6. Send a Stripe test purchase through test mode.

## Updating the Server

1. Pull/copy the updated private server project.
2. Run `npm ci`.
3. Run `npm run prisma:generate`.
4. Run `npm run build`.
5. Run `npm run prisma:migrate`.
6. Restart the service.
7. Check logs for webhook/email errors.
