# DIMAS — dist

This folder is the deployable build.

## Run

```bash
cp .env.example .env
# fill in ADMIN_PASSWORD and RAJAONGKIR_API_KEY
npm install --omit=dev     # optional SQLite driver (better-sqlite3)
npm start
```

- Node 18.17+ (20/22 LTS recommended)
- `npm install --omit=dev` enables SQLite. If the native module can't be installed, the app falls back to the JSON store so the demo still runs.
- Data is created at `data/dimas.sqlite` (or `data/db.json` in fallback mode); set `DIMAS_DATA_DIR` to an absolute path outside this folder if the app directory is replaced on deploy.
- Receipts live in `data/uploads/`.
- Serve the folder at the root of a domain/subdomain; the frontend uses root-absolute URLs.
- `public/` can also be extracted as a static frontend, but `/api/*` must point at this backend on the same origin (or be proxied).

## Shared hosting

Use a host with Node.js app support (cPanel Node.js Selector / CloudLinux Passenger, Plesk Node, etc.):

1. Upload this folder outside `public_html`.
2. Create the app with startup file `server.js` and Node 18/20/22.
3. Add `.env` and restart.
4. Set `DIMAS_DATA_DIR` if needed, and make sure it is writable.
5. Attach the domain/subdomain root and enable HTTPS.

PHP-only shared hosting cannot run this app as-is. Netlify/Vercel serverless are not suitable because the app needs a long-running server and persistent files.
