# Dev Setup

## First-Time Setup

### 1. Backend API (lalaji-api)

```bash
cd lalaji-api
cp .env.example .env
composer install
php artisan key:generate
php artisan migrate --seed
```

Or use the shortcut:

```bash
composer setup
```

### 2. Platform Site (lalaji)

```bash
cd lalaji
cp .env.example .env
# Set LALAJI_API_URL, LALAJI_API_TOKEN, LALAJI_ADMIN_PANEL_URL in .env
composer setup
```

### 3. Admin Panel (lalaji-app)

```bash
cd lalaji-app
cp .env.example .env
# Set VITE_API_BASE_URL in .env
npm install
```

***

## Daily Development

Run each in a separate terminal:

```bash
# Terminal 1 — Backend API
cd lalaji-api && composer dev

# Terminal 2 — Platform Site
cd lalaji && composer dev

# Terminal 3 — Admin Panel
cd lalaji-app && npm run dev
```

***

## Environment Variables

### lalaji-api `.env`

```env
APP_URL=http://localhost:8000
DB_CONNECTION=sqlite          # or mysql for production
```

### lalaji `.env`

```env
LALAJI_API_URL=http://localhost:8000/api
LALAJI_API_TOKEN=             # Generate via artisan or seeder
LALAJI_ADMIN_PANEL_URL=http://localhost:5173
```

### lalaji-app `.env`

```env
VITE_API_BASE_URL=http://localhost:8000/api
```

***

## Running Tests

```bash
# Backend API
cd lalaji-api && composer test

# Platform Site
cd lalaji && composer test

# Admin Panel
cd lalaji-app && npm run test
```

***

## Common Ports

| App        | Port |
| ---------- | ---- |
| lalaji-api | 8000 |
| lalaji     | 8001 |
| lalaji-app | 5173 |

***

## Login Flow

1. Go to `http://localhost:8001` (platform)
2. Register or login
3. Create a tenant and assign a subscription
4. Click "Open Admin Panel" — SSO redirects to `http://localhost:5173`
5. You are now in the ERP admin panel


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.comprogtech.com/lalaji-erp/setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
