Environment Setup
Required Tools
Section titled “Required Tools”- Node.js 20+ and npm — runs all three projects
- Git — version control
- MongoDB — either installed locally or accessed via SSH tunnel to the remote instance
Setup Steps
Section titled “Setup Steps”-
Clone the repo and navigate into it:
Terminal window git clone <repo-url>cd backend -
Create
news-server/.envwith the values below. -
Create
news-client/.envwith the values below. -
Install dependencies in each project:
Terminal window cd news-server && npm installcd ../news-client && npm install
news-server/.env
Section titled “news-server/.env”PORT=4000MONGODB_URI=mongodb://localhost:27017/newsJWT_SECRET=replace-with-a-long-random-stringAPI_KEY=replace-with-your-api-keyAWS_ACCESS_KEY_ID=your-aws-key-idAWS_SECRET_ACCESS_KEY=your-aws-secretAWS_REGION=eu-north-1S3_BUCKET=your-bucket-nameS3_ENDPOINT=https://s3.amazonaws.com| Variable | Required | Format | Purpose |
|---|---|---|---|
PORT | Yes | Number | HTTP port for Express server |
MONGODB_URI | Yes | MongoDB URI | Database connection string |
JWT_SECRET | Yes | Long random string | Signs JWT tokens |
API_KEY | Yes | Opaque token | Auth for child-site API requests |
AWS_ACCESS_KEY_ID | For uploads | AWS key ID | S3 signed URL auth |
AWS_SECRET_ACCESS_KEY | For uploads | AWS secret | S3 signed URL auth |
AWS_REGION | For uploads | Region string | S3 region |
S3_BUCKET | For uploads | Bucket name | Upload destination |
S3_ENDPOINT | Optional | URL | Custom S3 endpoint override |
news-client/.env
Section titled “news-client/.env”VITE_API_BASE_URL=http://localhost:4000/api/v1VITE_UPLOAD_URL=http://localhost:4000/api/v1/sign-s3| Variable | Required | Format | Purpose |
|---|---|---|---|
VITE_API_BASE_URL | Yes | URL | Base path for all dashboard API calls |
VITE_UPLOAD_URL | Yes | URL | Endpoint that returns signed S3 upload URLs |
VITE_JWT_STORAGE_KEY | Optional | String | localStorage key name for the JWT token |
VITE_S3_ENDPOINT | Optional | URL | Client-side S3 endpoint |
VITE_S3_BUCKET | Optional | String | Client-side S3 bucket name |
VITE_S3_REGION | Optional | String | Client-side S3 region |
VITE_S3_ACCESS_KEY_ID | Optional | String | Client-side S3 access key |
VITE_S3_SECRET_ACCESS_KEY | Optional | String | Client-side S3 secret |