From Source

This page documents ElastOS v1 (PC2), the proof of concept. ElastOS v2 is the current system. To install it, see Install ElastOS. To see how the stages fit together, see ElastOS in stages.

Build and run PC2 from source code for development or maximum control.

For most users, the one-line install is easier. Use this guide for development or customization.

Prerequisites

  • Node.js 20+ (v23 recommended for best performance)
  • npm (comes with Node.js)
  • Git
node --version  # Should be v20.0.0 or higher
npm --version   # Should be 10.0.0 or higher
git --version

Installation

Clone Repository

git clone https://github.com/Elacity/pc2.net
cd pc2.net

Install Root Dependencies

npm install --legacy-peer-deps --ignore-scripts
⚠️

The --legacy-peer-deps flag is required due to some package conflicts. The --ignore-scripts flag skips the husky git hooks setup.

Install PC2 Node Dependencies

cd pc2-node
npm install --legacy-peer-deps

Build Everything

npm run build

This builds both frontend and backend.

Start the Server

npm start

Your PC2 node is now running at http://localhost:4200

Project Structure

pc2.net/
├── src/gui/               # Frontend (desktop UI)
│   └── src/               # Source files
├── pc2-node/              # Backend server
│   ├── src/               # TypeScript source
│   │   ├── api/           # REST API endpoints
│   │   ├── services/      # Business logic (AI, IPFS, etc.)
│   │   └── storage/       # Database & file storage
│   ├── frontend/          # Built frontend (generated)
│   ├── data/              # User data & database
│   └── config/            # Configuration files
├── packages/              # Shared packages
│   └── particle-auth/     # Wallet integration
└── scripts/               # Utility scripts

Development Commands

Run these from the pc2-node/ directory:

CommandDescription
npm startStart production server
npm run devDevelopment mode (auto-restart on changes)
npm run buildBuild frontend and backend
npm run build:frontendBuild frontend only
npm run build:backendBuild backend (TypeScript) only

Development Mode

For active development with hot reloading:

cd pc2-node
npm run dev

This uses tsx watch to automatically restart when you change files.

Building for Production

cd pc2-node
npm run build

This runs:

  1. build:frontend - Compiles GUI and copies to frontend/
  2. build:backend - Compiles TypeScript to dist/

Configuration

Config file: pc2-node/config/config.json

{
  "port": 4200,
  "owner": "0xYourWalletAddress",
  "ipfs": {
    "mode": "hybrid"
  }
}

See Configuration Reference for all options.

Running as a Service

For production, use PM2:

# Install PM2 globally
npm install -g pm2
 
# Start with PM2 (from pc2-node directory)
cd pc2-node
pm2 start npm --name "pc2" -- start
 
# Save for auto-restart on reboot
pm2 save
pm2 startup

Or use systemd - see VPS Guide.

Common Issues

Port Already in Use

# Find process using port
lsof -i :4200
 
# Kill it
kill -9 <PID>

Build Errors

# Clean and rebuild
cd pc2-node
rm -rf dist node_modules
npm install --legacy-peer-deps
npm run build

Missing Frontend

If you see “index.html not found”:

cd pc2-node
npm run build:frontend

TypeScript Errors

Make sure dev dependencies are installed:

npm install --legacy-peer-deps --include=dev

→ Ready to deploy publicly? See VPS Deployment

© 2026 Elacity Labs. ELASTOS® is a registered trademark of Elastos DAO. ElastOS is open source under the MIT licence.