# Default web app stack (Nease / site-launcher)

## Runtime

- **Node** ≥ 18  
- **Express** — API + `express.static(dist)` + SPA fallback to `index.html`  
- **MongoDB** — Mongoose models; `connect-mongo` session store in production  
- **Passport** — `passport-local`, bcrypt-hashed users  
- **React 18** — JSX via Webpack + Babel  

## NPM scripts (typical)

| Script | Use |
|--------|-----|
| `npm run start` | Production: `node app.js` |
| `npm run start:local` | Dev: parallel webpack watch + nodemon |
| `npm run build` / `build:prod` | Production webpack bundle → `dist/` |
| `heroku-postbuild` → `build:prod` | Dokku/Herokuish build phase |
| `npm run create-admin` | Bootstrap first user (when applicable) |

## Server files

- `app.js` — routes, session, passport, static, catch-all  
- `config/db-config.js` — `MONGO_URL`, pool options  
- `config/passport.js` — LocalStrategy  
- `middleware/auth.js` — `requireAuth`, `requireAdmin`  
- `db/db.js` — connect + load models  
- `Procfile` — `web: node app.js`  

## Dokku / production env

- `NODE_ENV=production`  
- `NPM_CONFIG_PRODUCTION=false` — **required** so webpack/babel stay available during build  
- `MONGO_URL` — set by `dokku mongo:link …`  
- `SESSION_SECRET` — long random string  
- `PORT` — assigned by Dokku (often 5000 in container)  

## Reference implementations

- **Full auth + React:** `nease/partypal`, `nease/group-schedule`, `nease/site-launcher-template`  
- **Lighter (tracker API only):** `nease/ambiesheet`  
