The Food Delivery App backend reads all runtime configuration from aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/bhavnesh7781/Food-Delivery-App/llms.txt
Use this file to discover all available pages before exploring further.
.env file located in the backend/ directory. This file is loaded at startup via the dotenv package (import 'dotenv/config' in server.js), making every key available as process.env.<KEY> throughout the application. You must create this file before starting the server — without it, the database connection, authentication, and payment processing will all fail to initialise.
.env Template
Create the filebackend/.env and populate it with the following values, replacing each placeholder with your real credentials:
backend/.env
Variable Reference
The MongoDB connection string used by Mongoose to connect to your database. Consumed in
backend/config/db.js via mongoose.connect(process.env.MONGODB_URI).- Local MongoDB:
mongodb://localhost:27017/food-delivery - MongoDB Atlas:
mongodb+srv://<user>:<password>@cluster.mongodb.net/food-delivery
The secret key used to sign and verify JSON Web Tokens. When a user logs in, the server signs a JWT with this key. On every subsequent authenticated request,
backend/middleware/auth.js calls jwt.verify(token, process.env.JWT_SECRET) to validate the token and extract the user’s ID.Choose a long, random, high-entropy string (at least 32 characters). Never reuse this value across environments.Your Stripe secret API key, used to create Stripe Checkout sessions when a customer places an order. Consumed in
backend/controllers/orderController.js where new Stripe(process.env.STRIPE_SECRET_KEY) initialises the Stripe client.- Development: use a test key prefixed with
sk_test_ - Production: use a live key prefixed with
sk_live_
The port number the Express HTTP server listens on. Defined in
server.js as const PORT = process.env.PORT || 4000, so this variable is optional — the server defaults to port 4000 when it is not set.Hard-coded Frontend URLs
The frontend and admin dashboard currently hard-code the backend base URL as
http://localhost:3000 in two files:frontend/src/context/StoreContext.jsx—const url = "http://localhost:3000"admin/src/App.jsx—const url = "http://localhost:3000"
https://api.yourdomain.com). Consider moving this value to a frontend .env file using a VITE_API_URL variable so it can be configured per environment without changing source code.