Files

1 line
2.7 KiB
JSON

{"repo": "alvianzf/tiketq-bosbiller", "files": {"README.md": {"50644a04caf7aa65a005ad43b25bde4bfb2d3000": {"t": 1785674437.6226938, "n": 2471, "h": "c55ea4710603f30d", "c": "# TiketQ Bosbiller (Backend API)\n\nThe Node.js/Express backend that powers all TiketQ services. It integrates with a third-party flight provider API, the Sindo Ferry API, and DANA for payments (via DANA's SNAP Payment Gateway API). It manages the PostgreSQL database via Prisma ORM, uses Redis for trip and route caching, generates PDF e-tickets with PDFKit, sends transactional emails via Nodemailer, and serves an OpenAI-compatible LLM agentic chatbot over Socket.io. This README covers the full dependency list, all required environment variables with descriptions, and the exact commands to bootstrap and run the server.\n\n## Tech Stack\n- **Runtime:** Node.js v18+\n- **Framework:** Express.js `~4.16.1`\n- **Database:** PostgreSQL (Managed via `@prisma/client ^6.19.2`)\n- **Real-Time:** `socket.io ^4.8.3`\n- **Caching/Session:** `redis ^4.6.14`, `node-cache ^5.1.2`\n- **Payment Gateway:** `dana-node ^2.1.10`\n- **PDF Generation:** `pdfkit ^0.18.0`, `svg-to-pdfkit ^0.1.8`\n- **AI/LLM:** `openai ^6.39.0`\n\n## Required Environment Variables (`.env`)\nBefore starting the server, ensure the following variables are strictly defined in `.env`:\n\n```env\n# Database\nDATABASE_URL=\"postgresql://user:password@localhost:5432/tiketq\"\nREDIS_URL=\"redis://localhost:6379\"\n\n# Security\nJWT_SECRET=\"your_jwt_secret\"\n\n# DANA Payment Gateway (SNAP) — see docs/DANA_INTEGRATION.md\nDANA_ENV=\"sandbox\"\nDANA_API_BASE_URL=\"https://api.sandbox.dana.id\"\nDANA_MERCHANT_ID=\"...\"\nDANA_CLIENT_ID=\"...\" # aka X-PARTNER-ID / partnerId\nDANA_PRIVATE_KEY=\"...\" # our RSA private key — signs every outbound request\nDANA_PUBLIC_KEY=\"...\" # our RSA public key, registered with DANA\n# Optional: DANA_STORE_ID (only for registered shops/QRIS), DANA_WEBHOOK_PUBLIC_KEY,\n# DANA_NOTIFY_URL, DANA_ORIGIN\n\n# Providers\nSINDO_FERRY_API_KEY=\"api_key\"\nLION_AIR_API_KEY=\"api_key\"\n\n# AI Chatbot (OpenAI-compatible endpoint, not api.openai.com)\nSUMOPOD_API_KEY=\"sk-...\" # NOT OPENAI_API_KEY\nAI_BASE_URL=\"https://...\" # custom OpenAI-compatible base URL\nAI_MODEL=\"gemini/gemini-2.5-flash-lite\"\n```\n\n> `scripts/dana-preflight.js` runs automatically before `npm run start` (via the `prestart` script) and fails fast if the DANA vars are missing or the private key can't sign.\n\n## Setup & Run\n\n1. **Install dependencies:**\n ```bash\n npm install\n ```\n\n2. **Generate Prisma Client:**\n ```bash\n npx prisma generate\n ```\n\n3. **Start the server:**\n ```bash\n npm run start\n ```\n"}}}}