# Tech Stack & Build System ## Stack | Layer | Technology | |-------|-----------| | Backend | Node.js 18+, Express 5 | | Database | SQLite3 (file: `backend/cve_database.db`) | | Auth | bcryptjs, cookie-based sessions (httpOnly, 24h expiry) | | File uploads | Multer 2 (10MB limit) | | Frontend | React 19 (Create React App / react-scripts 5) | | UI Icons | lucide-react | | Charts | recharts | | Spreadsheet parsing | xlsx (frontend), pandas + openpyxl (backend Python scripts) | | Markdown rendering | react-markdown | | Diagrams | mermaid | ## Common Commands ### Backend ```bash cd backend node setup.js # Initialize DB, tables, indexes, default admin user node server.js # Start backend on port 3001 ``` ### Frontend ```bash cd frontend npm install # Install dependencies npm start # Dev server on port 3000 npm run build # Production build npm test # Run tests (react-scripts test) ``` ### Both servers (from project root) ```bash ./start-servers.sh # Start backend + frontend in background ./stop-servers.sh # Stop all servers ``` ### Database Migrations (run from `backend/` in order) ```bash node migrations/add_knowledge_base_table.js node migrations/add_archer_tickets_table.js node migrations/add_ivanti_sync_table.js node migrations/add_ivanti_findings_tables.js node migrations/add_ivanti_todo_queue_table.js node migrations/add_card_workflow_type.js node migrations/add_todo_queue_ip_address.js node migrations/add_compliance_tables.js ``` ### Python Scripts (from `backend/scripts/`) ```bash # Compliance xlsx parsing (called automatically by upload flow) python3 parse_compliance_xlsx.py # Bulk notes import python3 import_notes_from_csv.py input.csv --dry-run python3 import_notes_from_csv.py input.csv ``` Python dependencies: `pandas>=2.0.0`, `openpyxl>=3.0.0` (install via apt or venv). ## Environment Configuration - `backend/.env` — PORT, CORS_ORIGINS, SESSION_SECRET, NVD_API_KEY, Ivanti API credentials - `frontend/.env` — REACT_APP_API_BASE, REACT_APP_API_HOST - Both `.env` files are gitignored; see `.env.example` files for templates. - React caches env vars at build/start time — restart the frontend process after changes. ## Default Ports | Service | URL | |---------|-----| | Frontend | http://localhost:3000 | | Backend API | http://localhost:3001 |