# Deployment Notes

## Recommended production topology

```text
https://ai.munshiji.pk
        |
   Reverse proxy / SSL
        |
   Node.js :3000
        |
   MySQL/MariaDB
        |
   Ollama :11434 (private)
```

Keep Ollama bound to localhost/private network. Do not expose port 11434 publicly.

## cPanel / Node app
- Node: 24.x
- Startup file: `src/server.js`
- Application URL: `https://ai.munshiji.pk`
- Environment variables: copy `.env.example` to `.env` and set production values.
- Use the hosting provider's Node application/PM2 mechanism to keep the process alive.

## Database
Run:

```bash
npm install
npm run db:init
```

## Ollama
Install Ollama on the AI server, then pull the selected model. Example:

```bash
ollama pull llama3.2:3b
```

For stronger models, increase RAM/VRAM first. A 3B/4B-class model is a reasonable low-resource starting point, not a hard product requirement.

## First organization/key

```bash
npm run org:create -- "Munshi Ji Demo" munshi-ji-demo
npm run key:create -- 1 "Munshi Ji Production"
```

Save the printed API key securely.
