# Mastermind MVP — Assistant Project Manager Dashboard

**Language:** JavaScript (Node.js)

**Stack:**
- Web/API: Node.js + Express + Passport (local + Google + Microsoft auth)
- Views: EJS (mobile-friendly)
- Worker: Node.js (stub for later ingestion/sync)
- Database: Postgres
- Deployment: Docker Compose

## What this MVP is
A portable, self-hosted dashboard that supports an Assistant PM workflow (starting with electrical contractor, expandable to GC). It focuses on:
- fast project setup
- inbox triage (manual import now, OAuth connectors later)
- auditable actions (audit log)
- draft-first workflows (no auto-sending)

## Features implemented (so far)
### Auth
- Local login (server sessions stored in Postgres)
- Optional Google OAuth (enabled when `GOOGLE_CLIENT_ID/SECRET` provided)
- Optional Microsoft OAuth (enabled when `MICROSOFT_CLIENT_ID/SECRET` provided)

### User Management (owner only)
- Create local users, reset local passwords, disable/enable, delete
- Pages:
  - `/admin/users`

### Audit Logs (owner only)
- Captures auth, admin actions, project changes, inbox imports/assignments
- Page:
  - `/admin/audit`

### Projects
- 2-minute project wizard
- Edit project profile + keywords for sorting
- Pages:
  - `/projects`
  - `/projects/:id`

### Inbox (no OAuth required yet)
- Upload `.eml` files (manual import)
- Unsorted queue
- Assign emails to projects
- Auto-assign on import when rules match
- Pages:
  - `/inbox`
  - `/inbox/:id`

### Email Connectors + Rules (owner only)
- Connector status exists for **gmail** and **microsoft** from day 1
- Rules engine to auto-sort/auto-assign
- Pages:
  - `/admin/email`
  - `/admin/email-rules`

## Quick start
See **INSTALL.md** (quick) or **INSTALL_MANUAL.md** (detailed).

## Manuals
- **USER_MANUAL.md** — day-to-day usage
- **ADMIN_MANUAL.md** — admin/owner operations
- **INSTALL_MANUAL.md** — install + deploy + backup

Common local commands:
- `npm test` — run the repo test suite
- `docker compose up -d --build` — start Postgres, web, and worker
- `docker compose logs -f web worker` — follow app logs
- `docker compose down` — stop the stack

## Repo layout
- `docker-compose.yml` — portable dev deploy
- `web/` — Express app + views
- `worker/` — background worker (stub)
- `data/` — persisted data volume (Postgres + uploads)

## Security notes (MVP)
- First run can bootstrap a local owner account from `BOOTSTRAP_OWNER_EMAIL` and `BOOTSTRAP_OWNER_PASSWORD`.
- OAuth secrets live in `.env` (do not commit)
- This MVP is intended to be run privately (LAN/Tailscale) until hardened.

## License
Internal MVP (no license declared yet).
