thechat.online — cPanel + MySQL build

1. This is a Next.js/Node.js application. Your cPanel account must support Setup Node.js App (PHP-only hosting is not sufficient). Use Node.js 22 where available.
2. Create a MySQL database and database user in cPanel, then grant the user ALL PRIVILEGES on that database.
3. Upload/extract the ZIP outside public_html when possible. Create a Node.js app with production mode and set its root to this project directory.
4. Configure environment variables in cPanel: DATABASE_URL, AUTH_SECRET (at least 32 random characters), APP_URL=https://thechat.online, NEXTAUTH_URL=https://thechat.online, ADMIN_EMAIL, and provider/payment credentials you intend to enable. Do not put real secrets in source code.
5. In the app root run: npm install; npx prisma generate; npx prisma db push; npm run db:seed; npm run build.
6. Set startup file to app-start.cjs and restart the application. If your host requires Passenger-specific setup, follow the host's instructions.
7. Verify https://thechat.online/api/health returns status=ok and database=up. Then test signup/login, a real AI provider, admin permissions and payment sandbox/webhooks.

Important: db push creates/updates schema; it does not migrate data from an old SQLite database. Back up data before schema changes. Never use --accept-data-loss on production. AI and payment features require valid credentials and provider configuration. Run npm run cpanel:check to check basic deployment prerequisites.


8. Developer API: sign in and open Dashboard → Developer API. Create a key and copy the secret immediately; the full secret is shown only once. Do not embed keys in client-side/browser code. Revoke leaked keys from the same panel. The API endpoint is POST /api/v1/chat and currently supports non-streaming OpenAI-compatible chat completions. It enforces the account plan/model access and quotas.
9. Conversation exports are available in the chat interface (Markdown/JSON); the authenticated export endpoint is GET /api/conversations/{id}/export?format=md or format=txt.
10. After changing prisma/schema.prisma, run `npx prisma generate` and then `npx prisma db push` after backing up production data. New schema additions include DeveloperApiKey. Do not run schema changes against production without a current backup.
11. cPanel must support a persistent Node.js app (Node.js 22 recommended), and your provider must allow long-running requests for AI chat. PHP-only hosting cannot run this Next.js app. See official cPanel Node.js setup guidance: https://docs.cpanel.net/knowledge-base/web-services/how-to-install-a-node.js-application/


Dependency conflict fix (important): next-auth v4 requires the Nodemailer 6.x peer line. This release sets nodemailer to ^6.10.1 and @types/nodemailer to ^6.4.17. If installing over an earlier failed attempt, remove node_modules and package-lock.json before running npm install again. Do not use npm install --force to bypass this conflict.
