# Quickstart Guide

## Getting Started

### Prerequisites

- Node.js >= 18.0.0
- pnpm >= 8.0.0
- Docker (for local development services)
- Git

### Initial Setup

1. **Clone the repository**
   ```bash
   git clone <repository-url>
   cd the-order
   ```

2. **Install dependencies**
   ```bash
   pnpm install
   ```

3. **Start development services** (PostgreSQL, Redis, OpenSearch)
   ```bash
   docker-compose up -d
   ```

4. **Build all packages**
   ```bash
   pnpm build
   ```

5. **Start development servers**
   ```bash
   pnpm dev
   ```

### Development Workflow

1. **Work on a specific package**
   ```bash
   cd packages/ui
   pnpm dev
   ```

2. **Work on an app**
   ```bash
   cd apps/portal-public
   pnpm dev
   ```

3. **Work on a service**
   ```bash
   cd services/intake
   pnpm dev
   ```

### Running Tests

```bash
# Run all tests
pnpm test

# Run tests for a specific package
pnpm --filter @the-order/ui test

# Run tests in watch mode
pnpm --filter @the-order/ui test:watch
```

### Adding Git Submodules

To add external repositories as submodules:

```bash
./scripts/add-submodules.sh
```

Or manually:

```bash
git submodule add <repository-url> services/omnis-brand
git submodule update --init --recursive
```

### Environment Variables

1. Copy `.env.example` to `.env.local` in each workspace
2. Configure required environment variables
3. For secrets, use SOPS (see `docs/governance/SECURITY.md`)

### Building for Production

```bash
# Build all packages and apps
pnpm build

# Build specific workspace
pnpm --filter @the-order/portal-public build
```

### Deployment

See `infra/README.md` for infrastructure and deployment documentation.

## Next Steps

1. Review the [README.md](README.md) for detailed documentation
2. Read [CONTRIBUTING.md](docs/governance/CONTRIBUTING.md) for contribution guidelines
3. Check [SECURITY.md](docs/governance/SECURITY.md) for security policies
4. Explore the architecture in [docs/architecture/](docs/architecture/)

## Troubleshooting

### Issues with dependencies

```bash
# Clean and reinstall
pnpm clean
pnpm install
```

### Issues with Docker services

```bash
# Restart services
docker-compose restart

# View logs
docker-compose logs -f

# Reset services
docker-compose down -v
docker-compose up -d
```

### TypeScript errors

```bash
# Run type checking
pnpm type-check

# Clean build artifacts
pnpm clean
pnpm build
```

## Getting Help

- Check the [documentation](docs/)
- Open an [issue](.github/ISSUE_TEMPLATE/)
- Review [architecture decisions](docs/architecture/adrs/)

