# cPanel / Truehost deployment guide

This project is prepared to run as a Node.js application on cPanel or Truehost shared hosting.

## 1. Upload files
Upload the full project contents to your hosting account, keeping the folder structure intact.

Recommended upload root:
- the folder that contains app.js, package.json, public/, server/, db/, storage/, backups/

Do not upload node_modules. cPanel will install dependencies from package.json.

## 2. Create the database
Create a PostgreSQL database in your hosting panel or use a managed PostgreSQL service.

After the database is created, import the schema:

```bash
psql "YOUR_DATABASE_URL" -f db/database.sql
```

Default login after import:
- Email: admin@uniquopos.com
- Password: Test1234!

## 3. Configure cPanel Node.js App
In cPanel, create or edit the Node.js application with these settings:

- Application root: the project folder path
- Application startup file: app.js
- Node.js version: 18 or newer

## 4. Environment variables
Set these in cPanel's environment section or in a local .env file:

- NODE_ENV=production
- PORT=3000
- DATABASE_URL=postgres://user:password@host:5432/dbname
- SESSION_SECRET=change-me-to-a-long-random-string
- APP_URL=https://yourdomain.com

The app already reads .env automatically if it exists.

## 5. Install dependencies and start
In cPanel, run:

```bash
npm install
npm run build
```

Then start or restart the application.

## 6. Verify deployment
After startup, test these URLs:

- https://yourdomain.com/api/health
- https://yourdomain.com/

Expected health response:

```json
{"ok":true,"port":3000,"database":{...}}
```

## 7. Writable folders
The application writes uploads, backups, and local storage under:

- storage/
- backups/

Make sure these folders remain writable by the Node.js process.
