Immigration Advisor App Development Guide
Development assistant for the Immigration Advisor application, a platform for managing immigration status (initially H1-B visas) with document storage, compliance tracking, and AI-powered chat assistance.
Project Overview
Full-stack immigration management application with:
User authentication & profile managementSecure document storage (MongoDB) & organizationImmigration status trackingTravel, address, employment historyNotification system for deadlines & complianceAI-powered chat assistance (LangChain, Pinecone)Analytics & reporting**Tech Stack:**
**Backend:** Python, FastAPI, PostgreSQL, MongoDB, Redis, Celery, JWT/OAuth2**Frontend:** React, TypeScript, Redux Toolkit, Material UI, Axios**AI:** Pinecone (vector DB), LangChain, OCRInstructions
1. Understanding the Codebase
When working with this application:
**Backend structure:** `app/` contains API endpoints (`api/`), core config/security (`core/`), database models (`db/`), Pydantic schemas (`schemas/`), business logic (`services/`), and AI components (`ai/`)**Frontend structure:** `src/` contains UI components (`components/`), application pages (`pages/`), Redux store (`store/`), API integration (`api/`), and utilities (`utils/`)**This is a new project under active development** — many features are planned but not yet implemented**MVP focus:** H1-B visa management as top priority**Security critical:** Immigration data is highly sensitive — always validate inputs, encrypt data at rest/in-transit, and follow OAuth2 best practices2. Development Environment Setup
**Backend:**
```bash
Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
Install dependencies
pip install -r requirements.txt
Run migrations (once implemented)
python -m scripts.db_migrations
Start server
uvicorn app.main:app --reload
```
**Frontend:**
```bash
cd frontend
npm install
npm run dev
```
**Local databases (Docker):**
```bash
PostgreSQL
docker run --name immigration-postgres -e POSTGRES_PASSWORD=password -p 5432:5432 -d postgres
MongoDB
docker run --name immigration-mongodb -p 27017:27017 -d mongo
Redis
docker run --name immigration-redis -p 6379:6379 -d redis
```
3. Testing
**Backend:**
```bash
pytest # All tests
pytest --cov=app # With coverage
pytest tests/test_auth.py # Specific file
```
**Frontend:**
```bash
cd frontend
npm test # All tests
npm test -- --coverage # With coverage
```
4. Development Guidelines
Follow RESTful API design from schema documentsImplement validation for all endpoints (Pydantic schemas)Prioritize security for sensitive immigration data: - Validate all inputs
- Encrypt data at rest and in transit
- Use JWT tokens with proper expiration
- Implement role-based access control
Maintain comprehensive test coverage (aim for >80%)Document new features and API endpointsUse TypeScript strict mode in frontendFollow Redux Toolkit patterns for state management5. Common Tasks
**Adding a new API endpoint:**
1. Define Pydantic schema in `app/schemas/`
2. Create database model in `app/db/`
3. Implement business logic in `app/services/`
4. Add endpoint in `app/api/`
5. Write tests in `tests/`
**Adding a new React component:**
1. Create component in `src/components/`
2. Define Redux slice if state is needed (`src/store/`)
3. Connect to API via `src/api/`
4. Add Material UI styling
5. Write tests
**Working with AI features:**
LangChain integration in `app/ai/`Pinecone vector store for semantic searchOCR processing for document uploadsAlways handle AI failures gracefully6. Deployment
**Development:**
```bash
npm run deploy:dev
```
**Production:**
```bash
npm run deploy:prod
```
7. Important Constraints
**Security first:** Immigration data is extremely sensitive**MVP scope:** Focus on H1-B visa features initially**Data privacy:** Comply with GDPR/privacy regulations**Performance:** Handle large document uploads efficiently**Reliability:** Notification system must be accurate (missed deadlines have legal consequences)8. Key Resources
Planning documents in repository rootRESTful API schema documentMVP development planDatabase schema designs9. When to Ask Questions
Ask the user for clarification when:
Immigration law requirements are ambiguousSecurity/privacy trade-offs need decisionsFeature scope extends beyond MVPDatabase schema changes impact multiple modulesAI behavior needs tuning (response tone, accuracy thresholds)---
Always prioritize security and accuracy when working with immigration data. When in doubt, err on the side of caution and ask the user.