Skip to main content

Node.js Environment

Required Version

Node.js v20+ is required, with v22 recommended for production deployments.
Sunschool uses modern JavaScript features and is tested against Node 22. The production deployment on Railway uses Node 22 via NIXPACKS. From package.json:
{
  "name": "workspace",
  "version": "1.0.0",
  "engines": {
    "node": ">=20.0.0"
  }
}

Verify Your Installation

node --version
# Should output v20.x.x or higher (v22.x.x recommended)

npm --version
# Should output 8.x.x or higher

Installing Node.js

# Using NodeSource repository
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs

PostgreSQL Database

Required Version

PostgreSQL 12+ is required. Sunschool is tested with PostgreSQL 14 and 15.
The application uses:
  • JSONB columns for complex data (lesson specs, learner profiles)
  • Array types for concept tags
  • Drizzle ORM for migrations and queries
  • WebSocket connections (Neon serverless compatible)

Database Features Used

From the schema (shared/schema.ts):
// Enums
export const userRoleEnum = pgEnum("user_role", ["ADMIN", "PARENT", "LEARNER"]);
export const lessonStatusEnum = pgEnum("lesson_status", ["QUEUED", "ACTIVE", "DONE"]);

// JSONB columns for complex data
spec: json("spec").$type<EnhancedLessonSpec>(),
graph: json("graph").$type<{ nodes: any[], edges: any[] }>(),

// Array types for tagging
conceptTags: text("concept_tags").array(),

Installation Options

Package Manager

npm

Sunschool uses npm as the package manager. Minimum version 8.x required.
The project includes package.json with all dependencies. Key packages:
{
  "dependencies": {
    "express": "^5.1.0",
    "drizzle-orm": "^0.43.1",
    "react": "^19.1.0",
    "@tanstack/react-query": "^5.74.11",
    "jsonwebtoken": "^9.0.2",
    "axios": "^1.9.0"
  }
}
Installation:
npm install
# Installs ~70 packages

System Resources

Minimum Specifications

These are absolute minimums. Production deployments should exceed these.
ResourceMinimumRecommended
CPU1 vCPU2+ vCPUs
RAM512 MB2 GB
Storage1 GB10 GB+
Network10 Mbps100+ Mbps

Memory Considerations

  • Node.js process: 200-400 MB baseline
  • PostgreSQL: 128-256 MB minimum
  • AI processing: Temporary spikes during lesson generation
  • Concurrent users: +50MB per active session

Storage Breakdown

/sunschool/
├── node_modules/     ~300 MB  (dependencies)
├── client/dist/      ~15 MB   (built frontend)
├── server/dist/      ~5 MB    (compiled backend)
└── database/         variable (lesson data, images)
Lesson images (SVG) average 10-50 KB each. A typical database with 1000 lessons uses ~500 MB.

Network Requirements

Ports

Default port is 5000 (configurable via PORT environment variable).
# Development
http://localhost:5000

# Production (behind reverse proxy)
https://yourdomain.com proxy localhost:5000

Firewall Rules

Incoming:
  • Port 5000 (HTTP) - from reverse proxy or public
  • Port 5432 (PostgreSQL) - only if database is remote
Outgoing:
  • Port 443 (HTTPS) - for AI provider APIs:
    • api.openrouter.ai
    • api.perplexity.ai
    • archive.opentensor.ai (Bittensor, optional)

Operating System

Supported Platforms

Additional Tools (Optional)

Development Tools

# TypeScript (included in devDependencies)
npx tsc --version

# Build tools
npm run build      # Vite + TypeScript compilation
npm run migrate    # Database migrations
npm test           # Jest unit tests

Production Tools

For process management and auto-restart:
npm install -g pm2
pm2 start npm --name "sunschool" -- start
pm2 startup
pm2 save
For SSL termination and load balancing:
server {
  listen 443 ssl http2;
  server_name sunschool.example.com;
  
  location / {
    proxy_pass http://localhost:5000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
  }
}

Verification Checklist

Before proceeding to installation:
1

Node.js v20+

node --version
# ✅ v22.15.3 (or v20.x.x+)
2

npm v8+

npm --version
# ✅ 9.5.0 (or higher)
3

PostgreSQL accessible

psql -h localhost -U postgres -c "SELECT version();"
# ✅ PostgreSQL 15.x
4

Sufficient resources

free -h  # RAM
df -h    # Disk space
# ✅ 2GB RAM, 10GB disk available
Ready to proceed? Continue to Environment Configuration