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 --versionInstallation
Clone Repository
git clone https://github.com/Elacity/pc2.net
cd pc2.netInstall Root Dependencies
npm install --legacy-peer-deps --ignore-scriptsThe --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-depsBuild Everything
npm run buildThis builds both frontend and backend.
Start the Server
npm startYour 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 scriptsDevelopment Commands
Run these from the pc2-node/ directory:
| Command | Description |
|---|---|
npm start | Start production server |
npm run dev | Development mode (auto-restart on changes) |
npm run build | Build frontend and backend |
npm run build:frontend | Build frontend only |
npm run build:backend | Build backend (TypeScript) only |
Development Mode
For active development with hot reloading:
cd pc2-node
npm run devThis uses tsx watch to automatically restart when you change files.
Building for Production
cd pc2-node
npm run buildThis runs:
build:frontend- Compiles GUI and copies tofrontend/build:backend- Compiles TypeScript todist/
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 startupOr 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 buildMissing Frontend
If you see “index.html not found”:
cd pc2-node
npm run build:frontendTypeScript Errors
Make sure dev dependencies are installed:
npm install --legacy-peer-deps --include=dev→ Ready to deploy publicly? See VPS Deployment