Setup
- Copy
.env.exampleat the project root to.env. Paste your own values. Do not commit.env. Do not reuse a secret that was typed in a chat. - Use the same variable names you already have:
DB_HOST,DB_PORT,DB_NAME,DB_USER,DB_PASSWORD,DB_SSLMODE,JWT_SECRET, and optionalGEMINI_API_KEYandCLOUDINARY_URL. SetDB_SCHEMA=mandi_trading(default). - Copy the same
.envintoserver/andwebsite/, or start both from the root after copying. - 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. - Your Postgres can stay on
localhost:5432inresto_db. This project only creates objects inside themandi_tradingschema. It never touches thepublicschema used by your other software. - In
server/runnpm installthennpm start. The API creates the schema and tables on first start (or runnpm run migrate). - In
website/runnpm installthennpm run dev(ornpm run buildandnpm start). - Open
/admin, log in as the seeded superadmin (md@kharchify.inonce your.envis in place), change the password if asked, and generate license keys (lifetime or an end date). - 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.
