# lymphoaipath-backend
AI-powered patient care pathway platform focused on lymphoproliferative disorders (DLBCL) Backend

## Email Configuration (SendGrid)

To enable email functionality for sending doctor welcome emails, configure SendGrid in your `.env` file:

### SendGrid Setup

1. **Create SendGrid Account**
   - Sign up at: https://signup.sendgrid.com/ (Free tier: 100 emails/day)

2. **Verify Sender Email**
   - Go to: SendGrid Dashboard → Settings → Sender Authentication
   - Click "Single Sender Verification" → "Create New Sender"
   - Fill in details and verify via email
   - This email will be used as `EMAIL_FROM`

3. **Create API Key**
   - Go to: SendGrid Dashboard → Settings → API Keys
   - Click "Create API Key"
   - Name: "LymphoAI Backend"
   - Permissions: Full Access (or Mail Send only)
   - Copy the API key (starts with `SG.`)

4. **Update `.env` File**
```env
SENDGRID_API_KEY=SG.your-actual-api-key-here
EMAIL_FROM=your-verified-email@example.com
SENDGRID_FROM_NAME=LymphoAI Path
```

### Testing Email Configuration
```bash
npm run test-email
```

### Doctor Account Creation

When an admin creates a doctor account:
- A random 12-character password is automatically generated
- The password is hashed and stored in the database
- A welcome email is sent to the doctor with their login credentials
- The doctor can login using the password from the email
