Skip to main content
Documentation

Development Setup

Set up your local development environment to contribute to Dits. This guide covers everything from cloning the repo to running tests.

Prerequisites

Required
  • Node.js 18+ - JavaScript runtime
  • npm 9+ - Package manager
  • Git 2.30+ - Version control
Recommended
  • VS Code - Editor with extensions
  • Docker - For integration tests
  • PostgreSQL - Local database

Initial Setup

1. Clone the Repository

# Clone your fork
git clone https://github.com/YOUR_USERNAME/dits.git
cd dits

# Add upstream remote
git remote add upstream https://github.com/byronwade/dits.git

# Fetch all branches
git fetch --all

2. Install Dependencies

# Install all dependencies
npm install

# This will install dependencies for:
# - Root workspace
# - All packages/*
# - All apps/*

3. Build the Project

# Build all packages
npm run build

# Or build specific package
npm run build -w @dits/core
npm run build -w @dits/cli

Project Structure

dits/
├── apps/
│   ├── web/          # Documentation website (Next.js)
│   └── cli/          # Command-line interface
├── packages/
│   ├── core/         # Core library
│   ├── storage/      # Storage backends
│   ├── network/      # Network protocols
│   └── shared/       # Shared utilities
├── tests/
│   ├── unit/         # Unit tests
│   ├── integration/  # Integration tests
│   └── e2e/          # End-to-end tests
└── docs/             # Additional documentation

Development Commands

Common Commands
npm run devStart development mode
npm run buildBuild all packages
npm run lintRun linting
npm run formatFormat code
npm run cleanClean build artifacts

VS Code Setup

Recommended Extensions

{
  "recommendations": [
    "dbaeumer.vscode-eslint",
    "esbenp.prettier-vscode",
    "bradlc.vscode-tailwindcss",
    "prisma.prisma",
    "ms-vscode.vscode-typescript-next"
  ]
}

Workspace Settings

{
  "editor.formatOnSave": true,
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  "typescript.tsdk": "node_modules/typescript/lib"
}

Debugging

VS Code Launch Configuration

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Debug CLI",
      "program": "${workspaceFolder}/apps/cli/src/index.ts",
      "args": ["status"],
      "runtimeArgs": ["-r", "ts-node/register"],
      "console": "integratedTerminal"
    },
    {
      "type": "node",
      "request": "launch",
      "name": "Debug Tests",
      "program": "${workspaceFolder}/node_modules/vitest/vitest.mjs",
      "args": ["run", "--reporter=verbose"],
      "console": "integratedTerminal"
    }
  ]
}

Troubleshooting

Common Issues

Build fails with TypeScript errors

Try running npm run clean && npm run build to clear caches.

Dependencies not found

Run npm install from the root directory to install all workspace dependencies.

Tests timing out

Some integration tests require Docker. Ensure Docker is running.