🔐 Restricted Access
This content is private. Enter the password to continue.
❌ Incorrect password. Try again.
💻 What to Host on Localhost for Health Trend Seller Project
Summary: Host These Components on Your Laptop
| Component | Host on Localhost? | Port | Purpose |
|---|---|---|---|
Backend API (src/) |
✅ YES | 3000 | REST API, business logic, WebSocket server |
| Frontend (Next.js) | ✅ YES | 3000 (same) | Dashboard UI, CEO Pulse interface |
| Temporal Worker | ✅ YES | 7233 | Background workflows (patient monitor, trend analysis) |
| PostgreSQL Database | ✅ YES | 5432 | Persistent data storage |
| IPFS Node | ⚠️ OPTIONAL | 5001 | Immutable storage (can skip for local testing) |
| Redis Cache | ⚠️ OPTIONAL | 6379 | Rate limiting, session storage |
| Mobile App | ❌ NO (use Expo Go) | 8081 | Runs on physical phone or emulator |
| Terraform/Ansible | ❌ NO | N/A | Cloud provisioning (not needed locally) |
Complete Setup for Local Development
Run the following commands in separate terminal windows.
Terminal 1: Database (PostgreSQL)
# Install and start PostgreSQL
sudo service postgresql start
# or
docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword postgres:15
Terminal 2: Backend API + Frontend
cd health-trend-seller
npm install
cp .env.example .env
# Edit .env with your database credentials
npm run dev
# ✅ Server runs at http://localhost:3000
Terminal 3: Temporal Worker
cd health-trend-seller
npm run worker
# ✅ Worker connects to Temporal server (local or cloud)
Terminal 4: IPFS (Optional)
ipfs daemon
# ✅ IPFS node runs at http://localhost:5001
Terminal 5: Mobile App (Optional)
cd health-trend-seller/mobile-app
npm install
npm start
# Scan QR code with Expo Go app on your phone
What You WILL Host on Localhost
1. Backend API (Port 3000) — Express.js server, REST endpoints, WebSocket server, serves frontend.
2. PostgreSQL Database (Port 5432) — Stores users, trends, strikes, consent records. Prisma ORM connects to it.
3. Temporal Worker — Runs workflows from
immortal-core/temporal-workflows/.4. Redis (Port 6379) – Optional — Rate limiting, session cache, WebSocket pub/sub.
What You Do NOT Host on Localhost
| Component | Why Not | Alternative |
|---|---|---|
| Terraform | Cloud infrastructure provisioning | Run only when deploying to AWS/GCP |
| Ansible | Server configuration management | Run only when provisioning remote servers |
| Docker/K8s manifests | Not needed for local dev | Use npm run dev instead |
| Mobile App | Runs on phone/emulator | Use Expo Go app |
| Production secrets | Never store on local machine | Use .env with local values |
📋 Localhost URLs After Setup
| Service | URL | Status |
|---|---|---|
| API + Frontend | http://localhost:3000 |
✅ Should respond |
| API Health Check | http://localhost:3000/health |
✅ Should return {"status":"ok"} |
| WebSocket | ws://localhost:3000/ws |
✅ Should connect |
| PostgreSQL | postgresql://localhost:5432/health_trend |
✅ Should connect |
| IPFS (optional) | http://localhost:5001 |
✅ If IPFS running |
| Redis (optional) | redis://localhost:6379 |
✅ If Redis running |
Quick Start Command (One-Liner)
# After cloning and installing dependencies
npm run dev & npm run worker
# Then open http://localhost:3000
Bottom Line
You host on localhost: Backend API, Frontend, Database, Temporal Worker, Redis, IPFS (optional)
You do NOT host on localhost: Terraform, Ansible, Production secrets, Mobile app (runs on phone)
The Health Trend Seller system is designed to run entirely on your laptop for development, with cloud deployment handled separately via Terraform/Ansible. 🕵️
No comments:
Post a Comment