This guide walks through deploying Blockchain Drive to a production environment. It assumes you have already verified the app works locally in development (mock mode). The key differences in production are: real smart contracts are deployed to a live network,Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ankit-bista/Final-Project/llms.txt
Use this file to discover all available pages before exploring further.
USE_REAL_CONTRACTS=true is set, and both the backend and frontend are built for production use.
System requirements
Before you begin, make sure the following are available on your server or infrastructure:Node.js 18+
The Express API and Next.js frontend both require Node.js 18 or later. Run
node --version to check.IPFS Kubo daemon
A running Kubo node reachable at a stable address. The backend proxies all file operations through it.
MongoDB
A running MongoDB instance. The backend connects via
MONGO_URI (default: mongodb://127.0.0.1:27017) and uses the database specified by MONGO_DB_NAME or DB_NAME (default: ipfs_app).Ethereum RPC endpoint
A JSON-RPC endpoint for your target network — Polygon Mumbai, mainnet via Infura or Alchemy, or a self-hosted node.
Deploy the smart contracts
Install dependencies
Install project dependencies in the backend directory before running the deployment script.
Run the deployment script
Deploy both contracts to your chosen network using Hardhat. Replace The script prints the deployed contract addresses to stdout. Save these — you will need them in the next step.
<network> with the network name defined in your hardhat.config.js (for example, mumbai, mainnet, or localhost).Configure environment variables
With the contracts deployed, update the remaining production-critical variables in your.env file.
Enable real contract mode
Set
USE_REAL_CONTRACTS to true. When this is false (the development default), all contract calls are mocked and the addresses above are ignored.Set the RPC URL and admin private key
Point the backend at your Ethereum RPC endpoint and supply the private key of the wallet that will sign on-chain transactions.
Set the main admin wallet
Set
MAIN_ADMIN_WALLET to the Ethereum address that should receive admin rights on its first login. This is typically the address corresponding to ADMIN_PRIVATE_KEY, but it can be any wallet address.Set remaining server variables
Configure the session secret, Node environment, database credentials, and IPFS URLs. See the environment variables reference for the full list.
Start the backend
Thestart script in package.json runs node server.js directly.
In production, run the backend under a process manager such as PM2 or systemd so it restarts automatically on failure. Example with PM2:
pm2 start server.js --name blockchain-drive-api.Start the frontend
The Next.js frontend lives in thefront end subdirectory (note the space in the name).
npm run build compiles the Next.js application. npm start serves it on port 3000 by default. Place a reverse proxy (Nginx, Caddy, or a load balancer) in front of both services if you need custom ports or TLS termination.
Verify the deployment
Once both processes are running, confirm the backend is healthy by calling the/health endpoint:
"database": "error" and an error message. Check your DB_* environment variables and confirm the database server is reachable from the backend host.