Once a URL is posted to /api/queue, everything happens fully automatically:
-
Webhook → Queue: Twenty CRM posts to
/api/queue→ Company added to database withstatus: 'pending' -
Background Processor:
- Runs every 5 seconds automatically (starts with
pnpm start) - Picks up pending companies
- Executes all 4 steps automatically:
- ✅ Crawling (with Scrapy) - Extracts website content
- ✅ AI Processing (with Claude) - Analyzes and structures data
- ✅ CRM Sending (placeholder) - Posts back to Twenty CRM
- Updates status to 'completed' when done
- Runs every 5 seconds automatically (starts with
-
Resumable: If any step fails, it resumes from where it left off (no re-crawling)
Result: Zero manual intervention required. Post webhook → Get processed data back automatically.
- Node.js 18+ and pnpm
- Python 3.8+ with pip
- SQLite3
- 2GB+ RAM (for Scrapy + Claude processing)
- Default Port:
20080(configurable viaPORTenvironment variable) - Twenty Webhook URL:
http://your-server:20080/api/queue - Firewall: Ensure port 20080 is open for incoming connections
-
Local Network: If Twenty CRM is on same network, use local IP:
http://192.168.1.100:20080/api/queue -
Internet Access: Use port forwarding on your router:
- Forward external port → internal port 20080
- Use dynamic DNS service for stable URL
-
VPN/Tunnel (Alternative): Use ngrok for testing:
npx ngrok http 20080 # Use the generated https URL in Twenty CRM
# Install PM2 globally
npm install -g pm2
# Start the application
pm2 start dist/server.js --name "as-decoder"
# Save PM2 configuration
pm2 save
# Setup auto-restart on system reboot
pm2 startup
# Follow the displayed command
# Monitor logs
pm2 logs as-decoder
# Restart if needed
pm2 restart as-decoderCreate /etc/systemd/system/as-decoder.service:
[Unit]
Description=AS-Decoder Web Crawler
After=network.target
[Service]
Type=simple
User=your-username
WorkingDirectory=/path/to/as-decoder
ExecStart=/usr/bin/node dist/server.js
Restart=always
RestartSec=10
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.targetEnable and start:
sudo systemctl enable as-decoder
sudo systemctl start as-decoder
sudo systemctl status as-decoder
# View logs
sudo journalctl -u as-decoder -f# Start in screen session
screen -S as-decoder
pnpm start
# Ctrl+A, D to detach
# Reattach later
screen -r as-decoder# Health check
curl http://localhost:20080/health
# Check processing status
curl http://localhost:20080/api/queue/your-company-id- Application logs: Console output (captured by PM2/systemd)
- Database:
crawler.dbin project root - Process logs: Stored in database
process_logstable
- Port already in use: Change
PORTin.env - Scrapy fails: Check Python virtual environment in
scripts/scraper/venv - Claude API fails: Verify
ANTHROPIC_API_KEYin.env - Memory issues: Increase system RAM or reduce
CRAWL_MAX_PAGES
- Environment variables configured (
.env) - Port 20080 accessible from Twenty CRM
- Process manager configured (PM2/systemd)
- Auto-restart on system reboot enabled
- Log monitoring setup
- Database backup strategy (SQLite file)
- Twenty CRM webhook configured to your endpoint