# Hosting Personal Photoshoot Studio™ on your own server (cPanel / AWS / Google Cloud)

This is the complete source code. The app needs **Node.js 20+** to run, because
plan generation, saving, the prompt library and PDF export all run server-side.
Plain static file hosting is **not** enough.

## Option A — cPanel with "Setup Node.js App"

Most cPanel hosts (CloudLinux / LiteSpeed) include **Setup Node.js App**. If your
host does not have it, use Option B instead.

1. Upload and extract this ZIP into a folder outside `public_html`,
   e.g. `/home/USER/photoshoot-studio`.
2. In cPanel → **Setup Node.js App** → *Create Application*
   - Node.js version: **20** or newer
   - Application root: `photoshoot-studio`
   - Application URL: your domain or subdomain
   - Application startup file: `.output/server/index.mjs`
3. Add the environment variables listed below in the same screen.
4. Open the app's terminal ("Run NPM Install" button, or SSH) and run:
   ```bash
   npm install
   npm run build
   ```
5. Click **Restart**. Your site is live on the chosen domain.

### Build target
`vite.config.ts` builds for Cloudflare by default. For a normal Node server,
change it to:

```ts
import { defineConfig } from "@lovable.dev/vite-tanstack-config";

export default defineConfig({
  tanstackStart: { server: { entry: "server" } },
  nitro: { preset: "node-server" },   // <- add this line
});
```
Then `npm run build` produces `.output/server/index.mjs`.

## Option B — Docker (AWS App Runner / ECS, Google Cloud Run)

```dockerfile
FROM node:20-alpine AS build
WORKDIR /app
COPY . .
RUN npm install && npm run build

FROM node:20-alpine
WORKDIR /app
COPY --from=build /app/.output ./.output
ENV PORT=3000
EXPOSE 3000
CMD ["node", ".output/server/index.mjs"]
```

## Environment variables

Copy `.env.example` to `.env` and fill in real values:

| Variable | Purpose |
|---|---|
| `VITE_SUPABASE_URL` / `SUPABASE_URL` | your database + auth URL |
| `VITE_SUPABASE_PUBLISHABLE_KEY` / `SUPABASE_PUBLISHABLE_KEY` | public key, safe in the browser |
| `VITE_SUPABASE_PROJECT_ID` / `SUPABASE_PROJECT_ID` | project id |
| `SUPABASE_SERVICE_ROLE_KEY` | server only — never expose |
| `LOVABLE_API_KEY` | AI generation. Swap for your own Gemini/OpenAI key and update the fetch URL in `src/lib/photoshoot.functions.ts` if you leave Lovable |

The real keys are **not** included in this ZIP on purpose. You can read your
current values from the project settings, or point the app at your own database.

## Database

All tables, policies and functions live in `supabase/migrations/`.
Apply them to your own Postgres/Supabase with `supabase db push`, or run the
`.sql` files directly with `psql`.

## Domain and SSL
Handled by cPanel (AutoSSL) or your cloud provider's load balancer.
