feat: enhance README with detailed environment variables and build scripts for local, test, and production deployments

This commit is contained in:
azeeee05
2026-09-07 20:13:36 +05:30
parent ec24991998
commit df40832753
+57 -6
View File
@@ -52,13 +52,64 @@ Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/bui
This project is configured with multiple environments for seamless deployments and testing.
### Environment Variables
- `.env` / `.env.local`: Used for local development (default points to `http://localhost:5173`).
- `.env.test`: Used for test environments (points to `http://localhost:5173`).
- `.env.production`: Used for the live production build (points to `https://app.docqube.com/login`).
- `.env`: Used by `npm run local` and points to `http://localhost:5173/login`.
- `.env.test`: Used by `npm run test` and `npm run build:test`; points to `https://docqubeapp-test.maskantech.in/login`.
- `.env.production`: Used by `npm run build:production` and `npm run prod`; points to `https://app.docqube.com/login`.
**Note:** Environment files (`.env*`) are ignored in Git to keep variables secure. Make sure you create them locally if you clone this repository.
### Build Scripts
- `npm run dev`: Starts the local development server (uses `.env` / `.env.local`).
- `npm run build:test`: Uses `dotenv-cli` to load `.env.test` and runs the Next.js build.
- `npm run build:production`: Uses `dotenv-cli` to load `.env.production` and runs the Next.js build.
- `npm run local`: Starts the local development server using `.env`.
- `npm run test`: Starts the development server using `.env.test`.
- `npm run build:local`: Builds the application using `.env`.
- `npm run build:test`: Builds the application using `.env.test`.
- `npm run build:production`: Builds the application using `.env.production`.
- `npm run prod`: Starts the production server using `.env.production`.
### Production Deployment Artifact
The Next.js configuration uses standalone output. Build the production artifact with:
```bash
npm ci
npm run build:production
```
The deployment must include:
Prepare the standalone artifact after building:
```bash
cp -r public .next/standalone/
cp -r .next/static .next/standalone/.next/
```
On Windows PowerShell, use this equivalent sequence because `cp` does not merge existing directories:
```powershell
Remove-Item -Recurse -Force .next\standalone\public -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force .next\standalone\.next\static -ErrorAction SilentlyContinue
Copy-Item public .next\standalone\public -Recurse
Copy-Item .next\static .next\standalone\.next\static -Recurse
```
Start the standalone server with:
```bash
node .next/standalone/server.js
```
On Windows PowerShell:
```powershell
$env:PORT = "3000"
$env:HOSTNAME = "127.0.0.1"
node .next\standalone\server.js
```
For Nginx deployment, run the server on an internal port and reverse proxy to it:
```bash
PORT=3000 HOSTNAME=127.0.0.1 node .next/standalone/server.js
```