> ## Documentation Index
> Fetch the complete documentation index at: https://docs.adhdsimple.co.uk/llms.txt
> Use this file to discover all available pages before exploring further.

# Development Setup

> How to set up and run the ADHD Simple platform for development

## Prerequisites

Before getting started, ensure you have the following installed:

* Node.js (>=18)
* npm or yarn
* Git

## Installation

Clone the repository and install dependencies:

```bash theme={null}
git clone <repository-url>
cd adhd-simple-turborepo
npm install --legacy-peer-deps
```

<Note>
  **Use `--legacy-peer-deps` flag to resolve any peer dependency conflicts in
  the monorepo**
</Note>

## Running Applications

You have two main options for running the applications during development:

### Option 1: Using Turbo (Recommended)

Turbo provides orchestrated development across the entire monorepo.

**Run all applications:**

```bash theme={null}
npm run dev
```

**Run specific applications:**

```bash theme={null}
# Clinical dashboard only
npm run dev:clinical

# Mobile app only
npm run dev:mobile

# Mobile app for web development
npm run dev:mobile:web

# Mobile app for Android development
npm run dev:mobile:android

# Mobile app for iOS development
npm run dev:mobile:ios
```

### Option 2: Running Apps Separately

If you prefer to run applications individually or encounter issues with Turbo:

#### Clinical Dashboard

```bash theme={null}
cd apps/clinical
npm run dev
```

The clinical dashboard will be available at `http://localhost:5173`

**Alternative start command:**

```bash theme={null}
cd apps/clinical
npm start
```

#### Mobile Application

```bash theme={null}
cd apps/mobile
npx expo start
```

**Alternative start command:**

```bash theme={null}
cd apps/mobile
npm start
```

**Platform-specific development:**

```bash theme={null}
cd apps/mobile

# Web development
npx expo start --web

# Android development (requires Android Studio/emulator)
npx expo start --android

# iOS development (requires Xcode - macOS only)
npx expo start --ios
```

## Application URLs

When running successfully, applications will be available at:

* **Clinical Dashboard**: `http://localhost:5173`
* **Mobile App (Web)**: `http://localhost:8081` (via Expo)
* **Documentation**: `http://localhost:3000` (when running documentation app)

## Troubleshooting

### Common Issues

**Peer dependency conflicts:**

```bash theme={null}
# Clear node_modules and reinstall
rm -rf node_modules package-lock.json
npm install --legacy-peer-deps
```

**Turbo cache issues:**

```bash theme={null}
# Clear Turbo cache
npx turbo clean
```

**Mobile app not starting:**

```bash theme={null}
cd apps/mobile
# Clear Expo cache
npx expo start --clear
```

### Environment Variables

Make sure you have the required environment variables set up:

* Create `.env` files in each app directory as needed
* Check with your team for the required environment variables

### Development Tools

**Recommended VS Code extensions:**

* TypeScript and JavaScript Language Features
* Expo Tools
* Prettier - Code formatter
* ESLint

## Next Steps

Once your development environment is running:

1. **Clinical Dashboard**: Visit the [Clinical User Guides](/user-guides/clinical/login) to understand the application flow
2. **Mobile App**: Check the [Mobile Architecture](/technical/mobile/mobile-app-architecture) documentation
3. **Backend**: Review the [Edge Functions Architecture](/technical/general/edge-functions-architecture) for API development

<CardGroup cols={2}>
  <Card title="Clinical User Guides" icon="stethoscope" href="/user-guides/clinical/login">
    Learn how to use the clinical dashboard
  </Card>

  <Card title="Technical Architecture" icon="code" href="/technical/general/frontend-architecture">
    Understand the system architecture
  </Card>

  <Card title="Mobile Development" icon="mobile" href="/technical/mobile/mobile-app-architecture">
    Mobile app development guide
  </Card>

  <Card title="Database Schema" icon="database" href="/technical/general/database-schema">
    Backend database structure
  </Card>
</CardGroup>
