🔐 Restricted Access
This content is private. Enter the password to continue.
❌ Incorrect password. Try again.
Health Trend Seller: Script Execution & Environment Setup Guide
Complete guide for setting up and running the Health Trend Seller Ghost Unit platform.
🚀 Health Trend Seller: Script Execution & Environment Setup Guide
1. Prerequisites Matrix
| Prerequisite | Minimum Version | Recommended Version | Verification Command |
|---|---|---|---|
| Node.js | 18.0.0 | 20.x LTS | node --version |
| npm | 9.0.0 | 10.x | npm --version |
| Git | 2.30.0 | Latest | git --version |
| Docker (optional) | 20.10.0 | Latest | docker --version |
| Rust (for WASM) | 1.70.0 | Latest | rustc --version |
| Temporal CLI | 1.0.0 | Latest | temporal --version |
| IPFS CLI | 0.20.0 | Latest | ipfs --version |
| PostgreSQL | 14.0 | 15.x | psql --version |
2. Installation Commands by Operating System
| OS | Command to Install Node.js 20 |
|---|---|
| macOS | brew install node@20 |
| Ubuntu/Debian | curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt install -y nodejs |
| Fedora | sudo dnf install nodejs |
| Windows | Download from https://nodejs.org or winget install OpenJS.NodeJS
|
| All (via nvm) | nvm install 20 && nvm use 20 |
3. Where to Run Each Script
| Script | Execution Directory | Absolute Path | Dependencies Required |
|---|---|---|---|
npm install |
Project root | /health-trend-seller/ |
Node.js, npm |
npm run dev |
Project root | /health-trend-seller/ |
All dependencies installed |
npm start |
Project root | /health-trend-seller/ |
Built assets, production env |
npm run build |
Project root | /health-trend-seller/ |
Next.js dependencies |
npm run worker |
Project root | /health-trend-seller/ |
Temporal server running |
npm run db:migrate |
Project root | /health-trend-seller/ |
PostgreSQL running, DATABASE_URL set |
4. Terminal/Shell Selection by OS
| OS | Recommended Terminal | Shell | Command to Open |
|---|---|---|---|
| macOS | Terminal.app or iTerm2 | zsh (default) |
Cmd+Space → "Terminal"
|
| Windows | PowerShell / Windows Terminal | PowerShell or WSL2 Bash |
Win+R → powershell
|
| Linux (Ubuntu) | GNOME Terminal | bash | Ctrl+Alt+T |
| VS Code | Integrated Terminal | Any | Ctrl+` |
5. Step-by-Step Execution Workflow
┌─────────────────────────────────────────────────────────────────────────────┐
│ HEALTH TREND SELLER EXECUTION WORKFLOW │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ STEP 1: Clone Repository │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ $ git clone https://github.com/health-trend-seller/health-trend-seller.git│
│ │ $ cd health-trend-seller │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ ↓ │
│ STEP 2: Install Dependencies │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ $ npm install │ │
│ │ # Wait 2-5 minutes for dependency installation │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ ↓ │
│ STEP 3: Configure Environment │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ $ cp .env.example .env │ │
│ │ $ nano .env # Edit with your values │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ ↓ │
│ STEP 4: Start Dependencies (Separate Terminals) │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ Terminal 1: PostgreSQL │ $ sudo service postgresql start │ │
│ │ Terminal 2: Temporal │ $ temporal server start-dev │ │
│ │ Terminal 3: IPFS │ $ ipfs daemon │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ ↓ │
│ STEP 5: Run Database Migrations │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ $ npm run db:migrate │ │
│ │ $ npm run db:seed │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ ↓ │
│ STEP 6: Start Application │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ Terminal 4: $ npm run dev # Development server │ │
│ │ Terminal 5: $ npm run worker # Temporal worker (background) │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
6. Script-Specific Execution Details
| Script | Command | Expected Output | Success Indicator |
|---|---|---|---|
npm install |
npm install |
Package tree + added X packages
|
Exit code 0 |
npm run dev |
npm run dev |
✅ Server running at http://localhost:3000 |
Server listening |
npm start |
npm start |
✅ Server running at http://localhost:3000 |
Server listening |
npm run build |
npm run build |
.next/ directory created
|
Build manifest generated |
npm run worker |
npm run worker |
Worker listening on task queue |
Worker registered |
npm test |
npm test |
Tests: X passed, X failed |
All tests passing |
npm run lint |
npm run lint |
No errors or warnings | Exit code 0 |
npm run db:migrate |
npm run db:migrate |
Database migrated to latest version |
Migration applied |
npm run db:seed |
npm run db:seed |
Seeding completed successfully |
Data inserted |
7. Execution Environment Matrix
| Script | Development | Staging | Production | CI/CD |
|---|---|---|---|---|
npm install |
✅ Yes | ✅ Yes | ✅ Yes | ✅ npm ci
|
npm run dev |
✅ Yes | ❌ No | ❌ No | ❌ No |
npm start |
✅ Yes | ✅ Yes | ✅ Yes | ❌ No |
npm run build |
✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
npm run worker |
✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes (systemd) |
npm test |
✅ Yes | ✅ Yes | ❌ No | ✅ Yes |
npm run lint |
✅ Yes | ✅ Yes | ❌ No | ✅ Yes |
npm run db:migrate |
✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
8. Port Allocation During Execution
| Service | Port | Script Responsible | Conflict Resolution |
|---|---|---|---|
| Express API | 3000 |
npm run dev / npm start
|
Change PORT in .env
|
| Next.js (dev) | 3000 | Uses same as Express | N/A (integrated) |
| Next.js (prod) | 3000 | npm start |
Same as above |
| WebSocket | 3001 | Socket.io server | Change WS_PORT in .env
|
| Temporal | 7233 | npm run worker |
Change Temporal address in .env
|
| IPFS | 5001 | External daemon | Change IPFS_API_URL
|
9. Required Directory Structure
health-trend-seller/
├── src/
│ ├── index.js # Entry point
│ └── server.js # Express server
├── immortal-core/
│ └── temporal-workflows/
│ └── worker.js # Temporal worker
├── prisma/
│ └── schema.prisma # Database schema
├── scripts/
│ └── deploy-wasm.sh # WASM deployment script
├── .env.example # Template for .env
└── package.json # Must be valid JSON
10. Troubleshooting Execution Errors
| Error | Symptom | Root Cause | Solution |
|---|---|---|---|
command not found: node |
npm commands fail | Node.js not installed | Install Node.js 18+ |
EADDRINUSE: address already in use |
Port 3000 already occupied | Another process on port 3000 |
npx kill-port 3000 or change PORT
|
Error: Cannot find module |
Module import fails | Dependencies not installed | rm -rf node_modules && npm install |
Connection refused: temporal |
Worker fails to start | Temporal server not running | Start Temporal: temporal server start-dev
|
PrismaClientInitializationError |
DB migration fails | Database not reachable | Verify DATABASE_URL in .env
|
Permission denied: scripts/deploy-wasm.sh |
WASM deployment fails | Missing execute permission | chmod +x scripts/deploy-wasm.sh |
npm ERR! code EINTEGRITY |
npm install fails | Cache corruption | npm cache clean --force && npm install |
Execution Tips & Best Practices
• Always run
• Use
• Run
• Run
• Run
• Use
• Set
npm install before any other script — it creates the node_modules/ directory.• Use
npm ci in CI/CD environments — faster and strictly follows package-lock.json.• Run
npm run dev in development — auto-restarts when files change.• Run
npm start in production — optimized for performance, no auto-restart.• Run
npm run worker in a separate terminal or as a background service — it blocks the terminal.• Use
npx for one-off commands — npx prisma studio opens database GUI.• Set
NODE_ENV=production before npm start — enables optimizations.12. Quick Reference Card
┌─────────────────────────────────────────────────────────────────────────────┐
│ QUICK REFERENCE: HEALTH TREND SELLER │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ 📦 First Time Setup │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ git clone <repo> && cd health-trend-seller │ │
│ │ cp .env.example .env && nano .env │ │
│ │ npm install │ │
│ │ npm run db:migrate && npm run db:seed │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
│ 🚀 Start Development │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ Terminal 1: npm run dev │ │
│ │ Terminal 2: npm run worker │ │
│ │ → Open http://localhost:3000 │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
│ 🏭 Build for Production │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ npm run build │ │
│ │ NODE_ENV=production npm start │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
│ 🧪 Testing & Quality │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ npm run lint # Check code style │ │
│ │ npm test # Run unit tests │ │
│ │ npm run format # Auto-format code │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
📌 Summary: Follow this guide to set up the Health Trend Seller Ghost Unit platform. Install prerequisites, clone the repository, install dependencies, configure environment variables, start supporting services, run database migrations, and launch the application. Use the quick reference card for common operations.
No comments:
Post a Comment