A complete NestJS API service for automating ProConnect tax form filling with integrated bot service.
This is a standalone NestJS application that includes:
- ✅ Complete bot service - All tax-5 bot code integrated
- ✅ Mock mode support - Test without backend API
- ✅ Browser-based form mappers - Tools to scan ProConnect forms
- ✅ Environment-based configuration - No hardcoded credentials
- ✅ Clean architecture - Proper NestJS structure
- ✅ Progress tracking - Real-time form filling updates
- ✅ Error handling - Comprehensive error tracking
- ✅ CORS enabled - Ready for frontend integration
npm install
npx playwright install chromiumcp .env.example .envFor Development (Mock Mode - Default):
USE_MOCK_DATA=true
# No need to set BACKEND_API_URL in mock modeFor Production (Real API):
USE_MOCK_DATA=false
BACKEND_API_URL=https://your-backend-api.com# Development (with hot reload)
npm run start:dev
# Production
npm run build
npm run start:prodThe server will start at http://localhost:3000
Extract form field mappings directly from ProConnect in your browser!
Located in: src/proconnect/bot/dataFetcher/
For normal forms (W2, 1099NEC, 1099T, etc.)
Extracts:
- Input fields (text, number, email)
- Select dropdowns
- Textarea fields
- Field IDs, data-testid, XPaths
- Label associations
For table-based forms (1098E, 1099SSA, etc.)
Extracts:
- Table structure (columns/rows)
- Input fields within table cells
- Column headers
- XPath locations
Step 1: Open ProConnect form in browser Step 2: Open browser console (F12) Step 3: Copy & paste scanner code Step 4: Run:
generateMappingsFromElement('.main-content');Step 5: Downloads JSON file automatically!
📖 Detailed Guide: See FORM_MAPPING_GUIDE.md
Currently, the application always uses mock data from a local JSON file.
Mock Data Location:
src/proconnect/bot/dataFetcher/proconnect_dev.json
Benefits:
- ✅ No backend API required
- ✅ Instant responses
- ✅ Controlled test data
- ✅ Perfect for development and testing
To Switch to Real API (Future):
- Uncomment the real API code in
getData.ts - Add
preparationIdanddocumentIdsToExportback to DTO - Set
BACKEND_API_URLin environment variables
📖 Detailed Guide: See MOCK_MODE_GUIDE.md
Fill tax return forms in ProConnect using mock data.
Request:
curl -X POST http://localhost:3000/proconnect/fill-tax-return \
-H "Content-Type: application/json" \
-H "Authorization: Bearer test-token" \
-d '{
"autoNavigateToReturn": true
}'Parameters:
autoNavigateToReturn(optional, default: true): If false, assumes you manually navigated to the tax return
Note: Currently using mock data from proconnect_dev.json. Authorization token is kept for future API integration.
Response:
{
"success": true,
"message": "Tax forms filled successfully",
"failedFields": {
"W2": ["field1", "field2"],
"1099NEC": []
}
}Get real-time progress.
curl http://localhost:3000/proconnect/export-progressHealth check endpoint.
curl http://localhost:3000/health| Variable | Required | Description | Default |
|---|---|---|---|
| PORT | No | API server port | 3000 |
| NODE_ENV | No | Environment mode | development |
| USE_MOCK_DATA | Yes | Enable mock mode | true |
| BACKEND_API_URL | When mock=false | Backend API endpoint | - |
| BACKEND_API_TIMEOUT | No | API timeout (ms) | 300000 |
| PROCONNECT_URL | No | ProConnect URL | https://proconnect.intuit.com |
| UI_PORT | No | UI port for CORS | 4000 |
| LOG_LEVEL | No | Logging level | info |
.env # Local development (gitignored)
.env.example # Template
.env.production # Production settings
- W2, 1099NEC, 1099INT, 1099DIV, 1099B, 1099MISC
- 1098, 1098T, 1098E, 1099R, 1099G, 1099SSA
- Schedule C, Schedule E, Schedule F
- K1 (1065-page1)
1. Client sends request
↓
2. API checks USE_MOCK_DATA
↓
3a. If true: Load proconnect_dev.json
3b. If false: Call backend API
↓
4. Launch Playwright browser
↓
5. User logs in manually to ProConnect
↓
6. Bot navigates and fills forms
↓
7. Return results with progress
src/
├── proconnect/
│ ├── bot/ # Bot automation
│ │ ├── taxFormsFiller/ # Form filling logic
│ │ ├── auth/ # Authentication
│ │ ├── dataFetcher/ # Data fetching
│ │ │ ├── getData.ts # ✨ Mock/API switcher
│ │ │ ├── proconnect_dev.json # 📄 Mock data
│ │ │ ├── browserFormScanner.js # 🔧 Normal form mapper
│ │ │ └── browserTableScanner.js # 🔧 Table form mapper
│ │ ├── inputTypeHandlers/ # Field handlers
│ │ └── ...
│ ├── dto/ # Validation
│ ├── proconnect.controller.ts # API endpoints
│ ├── proconnect.service.ts # Business logic
│ └── proconnect.module.ts # Module
├── services/ # Browser services
├── utils/ # Utilities
└── config/ # Configuration
nano src/proconnect/bot/dataFetcher/proconnect_dev.jsonFor normal forms:
// In ProConnect browser console (F12)
// Paste browserFormScanner.js content, then run:
generateMappingsFromElement('.main-content');
// Downloads: input-form-data.jsonFor table forms:
// Paste browserTableScanner.js content, then run:
generateMappingsFromElement('.main-content');
// Downloads: table-mappings.json# Call real API and save response
curl -X POST https://api.com/app-integration/proconnect/preparation \
-H "Authorization: Bearer TOKEN" \
-d '{"preparationId":"123","documentIdsToExport":["doc1"]}' \
| jq '.documents' > src/proconnect/bot/dataFetcher/proconnect_dev.json- README.md - This file (overview & setup)
- QUICK_TEST.md - Quick testing guide
- FORM_MAPPING_GUIDE.md - How to use browser form scanners
- MOCK_MODE_GUIDE.md - Mock vs API mode details
Error:
❌ Error loading mock data: ENOENT: no such file or directory
Solution:
ls -la src/proconnect/bot/dataFetcher/proconnect_dev.json
# File must exist!Error:
Backend API URL is not configured
Solution:
Set both variables in .env:
USE_MOCK_DATA=false
BACKEND_API_URL=https://your-api.com# Enable mock mode
sed -i 's/USE_MOCK_DATA=false/USE_MOCK_DATA=true/' .env
# Enable API mode
sed -i 's/USE_MOCK_DATA=true/USE_MOCK_DATA=false/' .env
# Restart server
npm run start:dev- ✅ No hardcoded credentials
- ✅ Environment-based config
- ✅
.envgitignored - ✅ Bearer token authentication
- ✅ Input validation
-
Disable Mock Mode
USE_MOCK_DATA=false
-
Use HTTPS
BACKEND_API_URL=https://api.yourdomain.com
-
Set NODE_ENV
NODE_ENV=production
-
Use Secrets Manager
- AWS Secrets Manager
- HashiCorp Vault
- Azure Key Vault
# 1. Start server
npm run start:dev
# 2. Test endpoint
curl -X POST http://localhost:3000/proconnect/fill-tax-return \
-H "Content-Type: application/json" \
-H "Authorization: Bearer test-token" \
-d '{
"autoNavigateToReturn": true
}'Development:
USE_MOCK_DATA=true
NODE_ENV=developmentStaging:
USE_MOCK_DATA=false
BACKEND_API_URL=https://staging-api.com
NODE_ENV=stagingProduction:
USE_MOCK_DATA=false
BACKEND_API_URL=https://api.com
NODE_ENV=productionnpm run build
npm run start:prod- ✅ Install dependencies:
npm install - ✅ Configure
.env: SetUSE_MOCK_DATA=true - ✅ Start server:
npm run start:dev - ✅ Test with mock data
- ⏭️ Use browser scanners to map new forms
- ⏭️ Update mock data with your forms
- ⏭️ Test form filling manually
- ⏭️ Switch to API mode when ready
- ⏭️ Integrate with frontend
- ⏭️ Deploy to production
MIT
Version: 1.0.0 Created: 2026-01-26 NestJS: 10.0.0 Playwright: 1.49.1