Skip to content

Getting Started

Prerequisites

ToolMinimum version
Node≥ 18
pnpm≥ 8
MongoDBany running instance

Installation

Clone the repository and install all dependencies from the monorepo root:

bash
git clone https://github.com/your-org/my-app.git
cd my-app
pnpm install

pnpm workspaces ensures every package under apps/ and packages/ is installed in one step.


Environment Variables

Backend — apps/backend/.env

bash
# Server
NODE_ENV=development
PORT=3500

# Database
MONGODB_URI=mongodb://localhost:27017/myapp

# Auth
JWT_SECRET=your-jwt-secret-here
JWT_REFRESH_SECRET=your-refresh-secret-here

# AWS (SES email)
A_ACCESS_KEY_ID=your-access-key
A_SECRET_ACCESS_KEY=your-secret-key
SOURCE_EMAIL=noreply@yourdomain.com

See apps/backend/.env.example for the full template.

Frontend — apps/frontend/.env

bash
VITE_API_BASE_URL=http://localhost:3500
VITE_APP_ENV=development

Vite resolves env files in priority order: .env.local.env.[mode].local.env.[mode].env.


Running in Development

Run all apps simultaneously:

bash
pnpm dev

Run a single app:

bash
pnpm --filter @my-app/frontend dev
pnpm --filter @my-app/backend dev

The backend starts on port 3500 (configurable via PORT). The frontend Vite dev server starts on port 5173 by default.


Building

Build all packages in the correct dependency order:

bash
pnpm build

Turborepo ensures @my-app/config@my-app/shared → both apps.

Build only the shared package:

bash
pnpm --filter @my-app/shared build

Build frontend only:

bash
pnpm --filter @my-app/frontend build

Code Quality

Linting

bash
pnpm lint           # lint all packages
pnpm lint:fix       # lint + auto-fix

Each package has its own .eslintrc.js extending @my-app/config/eslint.

Type checking

bash
pnpm type-check

Tests

bash
pnpm test

Backend uses Jest with Supertest. Test files live in apps/backend/src/__tests__/.


Pre-Commit Hook

Husky v9 + lint-staged runs eslint --fix automatically on every staged file before commit:

bash
# .husky/pre-commit
pnpm exec lint-staged

No manual lint step needed before committing.


Documentation (this site)

bash
pnpm docs:dev      # start VitePress dev server (http://localhost:5173)
pnpm docs:build    # build static docs to docs/.vitepress/dist/
pnpm docs:preview  # preview the built docs locally

Intecog Logistech IoT Monitoring Platform