Getting Started
Getting Started
Set up your CPI development environment and get the platform running locally.
Prerequisites
- Node.js >= 22.0.0
- pnpm 10+ (enabled via corepack)
- Docker and Docker Compose (for PostgreSQL, Redis, Mosquitto, MailHog)
- Git
Quick Start
Clone the repository
git clone https://github.com/lefteq/cpi.git
cd cpiEnable pnpm via corepack
corepack enable
corepack prepare pnpm@10 --activateInstall dependencies
pnpm installStart infrastructure
This starts PostgreSQL + TimescaleDB, Redis, Mosquitto MQTT broker, and MailHog.
pnpm docker:upCreate environment file
cp apps/api/.env.example apps/api/.envThe default .env values work out of the box with the Docker services.
Start the development servers
pnpm dev:appsStarts both API (:4410) and Admin (:4010).
pnpm dev:apiAPI server at http://localhost:4410.
pnpm dev:adminAdmin dashboard at http://localhost:4010.
pnpm dev:mobileExpo development server for iOS/Android.
Port Allocations
| Service | Port |
|---|---|
| API | 4410 |
| Admin Dashboard | 4010 |
| Documentation | 4020 |
| PostgreSQL + TimescaleDB | 5434 |
| Redis | 6381 |
| MQTT (internal) | 1883 |
| MQTT TLS (mTLS devices) | 8883 |
| MQTT TLS (JWT partner auth) | 8884 |
| MQTT WebSocket | 9001 |
| MailHog SMTP | 1027 |
| MailHog Web UI | 8027 |
Key Commands
pnpm build # Build all packages
pnpm lint # Lint all packages
pnpm typecheck # Type check all packages
pnpm orval # Generate API types from OpenAPI spec
pnpm docker:up # Start Docker services
pnpm docker:down # Stop Docker services
pnpm docker:logs # Tail Docker service logs
pnpm db:migrate # Run TypeORM migrationsNext Steps
- Architecture Overview — understand the system design
- Device Protocol — MQTT message formats
- Partner Integration — connect partner devices