# Laravel Development Plan

## Rule

Build VejalNai as a Laravel-first application. Avoid creating a separate TypeScript monorepo unless there is a specific future need.

## Near-Term Sequence

1. Install Composer and Laravel dependencies. Completed.
2. Add authentication and dashboard shell. Completed.
3. Add organizations and memberships. Completed.
4. Configure PostgreSQL and Redis. Completed.
5. Add contacts, conversations, and messages. Completed.
6. Add intent and response tables. Completed.
7. Add bot matching services. Completed: first approved phrase matcher and incoming message processor.
8. Add unknown question and human handoff flows. Completed.
9. Add callback requests. Completed.
10. Expand dashboard pages in Blade. Completed.
11. Upgrade support UI to a Crisp-inspired shared inbox. Completed.
12. Add production readiness configuration and scoped dashboard write authorization. Completed.
13. Add website chat widget embed code, public script, and message API. Completed.
14. Add Android, iOS, Flutter, React Native, and REST SDK implementation support. Completed.

## Laravel Boundaries

- Controllers handle HTTP.
- Form requests validate input.
- Services/actions contain business logic.
- Jobs handle async work.
- Policies enforce authorization.
- Migrations define schema.
- Blade renders dashboard and public pages.

## Bot Rules

- Known FAQs are answered from database records.
- Medium-confidence matches ask clarification.
- Low-confidence messages go to human handoff.
- Human takeover pauses bot replies.
- Callback mobile number is requested only when missing.
