Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/wtyler2505/ProtoPulse/llms.txt

Use this file to discover all available pages before exploring further.

ProtoPulse runs as a single Node.js process that serves both the React frontend (via Vite’s dev middleware) and the Express 5 REST API on port 5000. This guide walks through everything you need to get a local instance running from scratch.

Prerequisites

Before you start, make sure you have the following installed:
  • Node.js 20+ — check with node --version
  • PostgreSQL 14+ — check with psql --version
No global npm packages are required beyond Node.js itself.

Setup

1

Clone the repository

git clone https://github.com/wtyler2505/ProtoPulse.git
cd ProtoPulse
2

Install dependencies

npm install
This installs all runtime and dev dependencies, including Vite 7, Express 5, Drizzle ORM, Vitest, and the full shadcn/ui component set.
3

Configure environment variables

Copy the example file and fill in the required values:
cp .env.example .env
At minimum you must set DATABASE_URL. A typical local value looks like:
DATABASE_URL=postgresql://protopulse:protopulse@localhost:5432/protopulse
Create the database and role in psql first if they don’t exist:
CREATE ROLE protopulse WITH LOGIN PASSWORD 'protopulse';
CREATE DATABASE protopulse OWNER protopulse;
See the Environment variables table below for all available options.
4

Push the database schema

npm run db:push
This runs drizzle-kit push, which introspects shared/schema.ts and applies any missing tables or column changes directly to your PostgreSQL database. No migration files are generated — this is the recommended flow for local development.
npm run db:push is destructive for column removals. In production, use npm run db:migrate instead, which applies the versioned SQL files under migrations/.
5

Start the dev server

npm run dev
The app will be available at http://localhost:5000.
The dev server runs both the Vite HMR frontend and the Express 5 backend on port 5000 as a single process (tsx server/index.ts). There is no separate frontend dev server to start — Vite is registered as Express middleware and handles all client/ requests, while Express handles /api/* routes. The npm run dev:client script starts Vite alone (useful only when running the backend separately).

Environment variables

These variables are read from .env at startup. The server validates required variables on boot and will refuse to start if they are missing.
VariableRequiredDefaultDescription
DATABASE_URLYesPostgreSQL connection string, e.g. postgresql://user:pass@host:5432/db
API_KEY_ENCRYPTION_KEYProduction onlyRandom per-boot32-byte hex string for AES-256-GCM encryption of stored AI provider API keys. A random key is generated each boot in development, which invalidates any stored keys on restart.
PORTNo5000Server listen port
NODE_ENVNodevelopmentdevelopment | production | test
LOG_LEVELNoinfoerror | warn | info | debug
TRUST_PROXYNo0Number of trusted reverse-proxy hops (set to 1 behind a single proxy)
STREAM_TIMEOUT_MSNo120000Inactivity timeout in milliseconds for SSE AI chat streams
ADMIN_API_KEYNoShared secret for /api/admin/* and /api/backup/* maintenance routes
DB_POOL_MAXNoProfile defaultMaximum PostgreSQL connection pool size
CACHE_MAXNoProfile defaultMaximum entries in the server-side LRU cache
RATE_LIMIT_MAXNo300Maximum requests per 15-minute window per IP
DISABLE_AI_FALLBACKNo0Set to 1 to disable automatic fallback between AI providers
PARTS_CATALOG_V2NofalseSet to true to enable the unified parts catalog (ADR 0010) read paths
ARDUINO_CLI_PATHNoPATH lookupAbsolute path to the arduino-cli binary
ARDUINO_DATA_DIRNoArduino CLI data directory
ARDUINO_SKETCH_ROOTNoRoot directory for Arduino sketch files

NPM scripts reference

ScriptCommandDescription
npm run devNODE_ENV=development tsx server/index.tsStart the development server (Express + Vite HMR) on port 5000
npm run dev:clientvite dev --port 5000Start Vite alone (no Express backend)
npm run buildtsx scripts/build.tsProduction build — esbuild bundles the backend, Vite builds the frontend into dist/
npm run startNODE_ENV=production node dist/index.cjsRun the production build
npm run checktscTypeScript type check — must pass with zero errors before merging
npm run db:pushdrizzle-kit pushSync shared/schema.ts to PostgreSQL (development)
npm run db:generatedrizzle-kit generateGenerate SQL migration files from schema diff
npm run db:migratedrizzle-kit migrateApply pending SQL migrations (production)
npm run db:studiodrizzle-kit studioOpen Drizzle Studio database browser
npm testvitest runRun the full test suite across all workspace projects
npm run test:watchvitestInteractive test watch mode
npm run test:coveragevitest run --coverageRun tests and generate a coverage report (v8 provider)
npm run test:e2eplaywright testRun Playwright end-to-end tests
npm run test:a11yplaywright test e2e/p1-a11y-scan.spec.tsAccessibility audit via axe-core
npm run types:generatetsx scripts/generate-api-types.tsRegenerate shared/api-types.generated.ts
npm run genkit:devgenkit start -- npm run devStart the dev server with the Genkit developer UI
npm run tauri:devtauri devStart the Tauri desktop shell in development mode
npm run tauri:buildtauri buildBuild the Tauri desktop application

Running tests

ProtoPulse uses Vitest with a workspace configuration that covers both the server and client code in separate projects.
# Run all tests once
npm test

# Watch mode for active development
npm run test:watch

# Coverage report (output to coverage/)
npm run test:coverage
Tests are co-located with the code they test in __tests__/ directories. The test suite includes unit tests for the wire router, ERC engine, constraint solver, diff engines, and all context providers.

TypeScript check

Before opening a pull request, run the TypeScript compiler in check-only mode:
npm run check
This must pass with zero errors. The project uses TypeScript 5.6 with strict mode and strictTypeChecked ESLint rules.

Linting and formatting

# Lint all files
npx eslint .

# Format all files in-place
npx prettier --write .
ESLint is configured in eslint.config.js using the flat config format with typescript-eslint, eslint-plugin-react, eslint-plugin-react-hooks, eslint-plugin-jsx-a11y, and eslint-import-resolver-typescript.

Build docs developers (and LLMs) love