Developer
Local Setup
Guide to running the Twin platform locally for development.
Prerequisites
| Tool | Version | Notes |
|---|---|---|
| Node.js | 20+ | LTS recommended |
| PostgreSQL | 15 | Local instance |
| Git | Latest |
Database Setup
Create the development database:
Code
Default connection string:
Code
Backend
Code
{% hint style="warning" %}
Always run both build and build:types for each package. Skipping build:types leaves stale type declarations -- you will see Property X does not exist on type Y errors in consumers.
{% endhint %}
Dashboard Frontend
Code
{% hint style="info" %}
VITE_WALLET_CONNECT_PROJECT_ID can be set to development locally. WalletConnect features will show a console warning but function for testing. For production-like behavior, get a project ID from cloud.reown.com.
{% endhint %}
Platform Frontend
Code
Test User
After running seeds, a test user is available:
| Field | Value |
|---|---|
test@example.com | |
| Password | SecurePassword123! |
| Account | Acme Corp |
| Role | Admin |
Troubleshooting
| Problem | Cause | Solution |
|---|---|---|
Property X does not exist on type Y | Stale .d.ts in dist | Run npm run build:types for the affected package |
Cannot find module '@twin/database' | Packages not built | Run the full build pipeline in order |
ECONNREFUSED :5432 | PostgreSQL not running | Start PostgreSQL service |
relation "X" does not exist | Migrations not run | Run npm run migrate in packages/database |
ProjectNotFound code 3000 | Invalid WalletConnect project ID | Set VITE_WALLET_CONNECT_PROJECT_ID in .env |
403 Forbidden on new endpoint | Route not in permissions | Add to routes-permissions.ts in shared |
import { Knex } error in migration | CJS/ESM mismatch | Use import type { Knex } instead |
| Cron job not running | Not registered in all 3 places | Check cron-keys.ts, manager.ts, cron-handlers.ts |
Last modified on