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

# Local Development

> Running FindU components locally

# Local Development

This guide covers running FindU components on your local machine.

## Running Components

### Web Dashboard

```bash theme={null}
cd ~/findu/web_app
npm install
npm run dev
```

* **URL**: [http://localhost:5173](http://localhost:5173)
* **Hot Reload**: Yes
* **Environment**: Uses `.env.local` settings

### iOS App

```bash theme={null}
cd ~/findu/ios_app
pod install
open ios_app.xcodeproj
```

* **Simulator**: iPhone 15 Pro recommended
* **Device**: Requires developer certificate
* **Backend**: Points to dev Supabase

### ML Engine

```bash theme={null}
cd ~/findu/matching-algorithm
source venv/bin/activate
python api_v2/main.py
```

* **URL**: [http://localhost:8000](http://localhost:8000)
* **API Docs**: [http://localhost:8000/docs](http://localhost:8000/docs)
* **Requirements**: Python 3.9+

### Database Management

Access your Supabase project through the web dashboard:

* **Dashboard**: [https://supabase.com/dashboard](https://supabase.com/dashboard)
* **SQL Editor**: Run queries and migrations
* **Table Editor**: Visual data management
* **Auth**: Manage users and permissions

## Common Development Tasks

### Managing Environments

Environment configuration is managed through `.env` files in each repository:

* **Development**: Use development Supabase URL and keys
* **Production**: Use production Supabase URL and keys

To switch environments, update your `.env` file with the appropriate credentials. Get these from your team lead or Supabase dashboard.

### Code Quality Checks

<Tabs>
  <Tab title="Web App">
    ```bash theme={null}
    cd ~/findu/web_app
    npm run lint          # Check code style
    npm run typecheck     # Verify TypeScript types
    npm run build         # Verify it builds
    ```
  </Tab>

  <Tab title="iOS App">
    ```bash theme={null}
    cd ~/findu/ios_app
    # Build in Xcode to check for errors
    # Command+B or Product → Build
    ```
  </Tab>

  <Tab title="ML Engine">
    ```bash theme={null}
    cd ~/findu/matching-algorithm
    flake8 .              # Check Python style
    python -m py_compile main.py  # Verify syntax
    ```
  </Tab>
</Tabs>

### Database Tasks

Use the Supabase dashboard for database management:

1. **Create Migrations**:
   * Go to SQL Editor in Supabase dashboard
   * Write your SQL migration
   * Save it in your repository for version control

2. **Apply Migrations**:
   * Run SQL directly in the dashboard
   * Or include in PR for team review

3. **View Data**:
   * Use Table Editor for visual inspection
   * SQL Editor for complex queries

## Debugging

### Web Dashboard

1. **Chrome DevTools**: Best for React debugging
2. **React DevTools**: Install browser extension
3. **Network Tab**: Monitor Supabase calls

### iOS App

1. **Xcode Debugger**: Breakpoints and variable inspection
2. **Console Logs**: View in Xcode console
3. **Network Debugging**: Use Proxyman or Charles

### Database

1. **Supabase Dashboard**: SQL editor and logs
2. **Table Editor**: Visual data inspection
3. **Logs Explorer**: Real-time query logs

## Tips & Tricks

<CardGroup cols={2}>
  <Card title="Use Multiple Terminals" icon="terminal">
    Run each service in its own terminal for easy monitoring
  </Card>

  <Card title="Watch the Logs" icon="scroll">
    Keep logs visible to catch errors early
  </Card>

  <Card title="Test on Real Devices" icon="mobile">
    iOS simulator doesn't catch all issues
  </Card>

  <Card title="Use Dev Data" icon="database">
    Never test with production data locally
  </Card>
</CardGroup>

## Troubleshooting

<Accordion title="Port Already in Use">
  Kill the process using the port:

  ```bash theme={null}
  # Find process
  lsof -i :5173  # or :8000, :54321

  # Kill it
  kill -9 [PID]
  ```
</Accordion>

<Accordion title="Module Not Found">
  Clear caches and reinstall:

  ```bash theme={null}
  # Web app
  rm -rf node_modules package-lock.json
  npm install

  # Python
  pip install -r requirements.txt --force-reinstall
  ```
</Accordion>

<Accordion title="Supabase Connection Failed">
  1. Verify credentials in your `.env` file
  2. Check Supabase dashboard status
  3. Ensure you're using the correct environment keys
  4. Test with a simple query in the dashboard
</Accordion>

## Next Steps

* Review [workflow guide](/developer/workflow-guide) for git practices
* Check [architecture](/architecture) to understand component interactions
* Browse [contributing guide](/contributing) for coding standards
