Mandi Trading by Kharchify

Setup

  1. Copy .env.example at the project root to .env. Paste your own values. Do not commit .env. Do not reuse a secret that was typed in a chat.
  2. Use the same variable names you already have: DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD, DB_SSLMODE, JWT_SECRET, and optional GEMINI_API_KEY and CLOUDINARY_URL. Set DB_SCHEMA=mandi_trading (default).
  3. Copy the same .env into server/ and website/, or start both from the root after copying.
  4. The live site and API are at https://mandi.kharchify.in. The app uses that address for every API route. You can still change it in Settings or with a fallback URL.
  5. Your Postgres can stay on localhost:5432 in resto_db. This project only creates objects inside the mandi_trading schema. It never touches the public schema used by your other software.
  6. In server/ run npm install then npm start. The API creates the schema and tables on first start (or run npm run migrate).
  7. In website/ run npm install then npm run dev (or npm run build and npm start).
  8. Open /admin, log in as the seeded superadmin (md@kharchify.in once your .env is in place), change the password if asked, and generate license keys (lifetime or an end date).
  9. Install the APK from /download. Allow unknown apps if you sideload. After install, use Try Demo or log in with email and password (or a new key if the email is new).

Optional: run server/sql/002_optional_role.sql as a superuser to create a database role that can use only the mandi_trading schema. Then point DB_USER at that role.

Architecture: the Android app talks only to the Node.js API (or this website's remote-config URL). It never opens Postgres. Razorpay, Groq, and Gemini keys stay on the server.