Session 125 — Redis Integration, Railway Consolidation, E2B/Browserless, Remaining Roadmap
Documentation for Sessions
Session 125 Summary
What Was Accomplished
1. Redis Integration — All 4 APIs (Session 122, completed in 125)
Created a shared RedisModule in @libs-api/backend-core and integrated it into all 4 backend APIs:
- RedisService: ioredis wrapper with
family: 0for Railway dual-stack networking, graceful in-memory fallback, 60s reconnection - RedisThrottlerStorage:
@nestjs/throttlerv6 storage backed by RedisINCR+PEXPIRE, with in-memory fallback - RedisIoAdapter: Socket.IO Redis adapter for cross-instance WebSocket broadcasting via
@socket.io/redis-adapter - setupRedisIoAdapter(): Factory function called in each API's
main.ts
Files created:
libs/libs-api/backend-core/src/lib/redis/redis.service.tslibs/libs-api/backend-core/src/lib/redis/redis.module.tslibs/libs-api/backend-core/src/lib/redis/redis-throttler-storage.tslibs/libs-api/backend-core/src/lib/redis/redis-io-adapter.tslibs/libs-api/backend-core/src/lib/redis/redis.constants.tslibs/libs-api/backend-core/src/lib/redis/index.ts
Integration:
backend-api:REDIS_URL→ Redis db 1backend-ai-api:REDIS_URL→ Redis db 2 (DistributedLockService refactored to shared Redis)backend-docs-api:REDIS_URL→ Redis db 3backend-vitto-api:VITTO_REDIS_URL→ Redis db 0 (BullMQ + rate limiting)
2. Railway Project Consolidation (Session 122-125)
Four separate Railway projects merged into one consolidated project:
| Field | Value |
|---|---|
| Project ID | 3990549d-4313-47e4-9682-d17b382bdba2 |
| Environment ID | 1d438b60-52d5-4c89-ba8f-45fff0df308f |
| Dashboard | https://railway.com/project/3990549d-4313-47e4-9682-d17b382bdba2 |
Service IDs:
- backend-api:
1ad0b79a-b722-4c69-920c-5dcb35978f0d - backend-ai-api:
fa00811a-db8e-4232-a23f-2becd96615c7 - backend-docs-api:
0f7af191-d7a4-4366-82b6-312c4ab8fa7e - backend-vitto-api:
072352ed-2e34-468e-bec9-03f6d299f867 - Redis: shared, online, private networking
3. Deployment Script Reorganization (Session 125)
Cleaned up scattered deployment scripts:
- Moved
tools/scripts/deployment/todeployment/cli/ - Moved
tools/scripts/deploy-*.shtodeployment/cloudflare/ - Updated all
package.jsonscript paths - Updated
deployment-config.jswith new consolidated project/service IDs - Updated
.railway/projects.json, alldeploy.sh, allrailway.tomlcomments - Updated 15+ documentation files with new project IDs
4. E2B + Browserless Configuration (Session 125)
- Fixed env var mismatch:
BROWSERLESS_API_KEYrenamed toBROWSERLESS_TOKENin.env.local - Added
ENABLE_SANDBOX=trueto.env.local - Installed
cheeriofor HTTP-based scraping (free, no concurrent limits) - Updated
BrowserAgentServicewith hybrid scraping:- HTTP fetch + cheerio (primary, free)
- Browserless (fallback for SPAs)
- Browser agent handoff created for Railway env var setup
5. Bug Fixes
- Fixed
Channel.channelTypeMongoose@Prop()type error (union types needtype: String) - Fixed
TwilioServiceas consttype mismatch - Fixed
ADMIN_ROLES.includes()TypeScript error in backend-docs-api
Current Infrastructure State
All 4 APIs are healthy in production:
- https://api.gograb.space/api/health
- https://ai-api.gograb.space/ai-api/health
- https://docs-api.gograb.space/docs-api/health
- https://vitto-api.gograb.space/vitto-api/health
Redis: Online (shared across all APIs via private networking)
Environment Variables Added
| Variable | API | Purpose |
|---|---|---|
REDIS_URL |
backend-api, backend-ai-api, backend-docs-api | Redis db 1/2/3 for rate limiting, Socket.IO, locks |
VITTO_REDIS_URL |
backend-vitto-api | Redis db 0 for BullMQ task queue |
E2B_API_KEY |
backend-vitto-api | Code sandbox execution |
ENABLE_SANDBOX |
backend-vitto-api | Feature flag for sandbox endpoint |
BROWSERLESS_TOKEN |
backend-vitto-api | Managed Chromium for JS-heavy scraping |
RAILWAY_TOKEN |
local only (.env.local) | Smart Deploy CLI authentication |
Remaining Work (Prioritized)
CRITICAL — Security Wiring (~35 lines)
5 services are built but never called:
scanForInjection()— prompt injection detection → wire before LLM callsChannelRateLimiterService— per-channel rate limits → wire in ChannelGatewayCircuitBreakerService— provider failure isolation → wrap SmartRouterCostTrackerService.recordSpending()— persist spending → call after LLM callsDeadLetterQueueService— failed task retry → wire in task failure handler
HIGH — Messaging Channel Reply-Paths
Channels have inbound but incomplete outbound:
- Slack: thread_ts reply threading
- Discord: channel.send() reply
- WhatsApp: Twilio sendMessage
- Telegram: sendMessage with reply_to_message_id
- Email: SMTP send
HIGH — HTTP Scraping Engine (DONE in this session)
cheerio installed, BrowserAgentService updated with HTTP-first scraping.
MEDIUM — Tauri Desktop App
Desktop daemon POC exists (apps/gograb-desktop-daemon/). ComputerUseLoopService works via backend-ai-api. But no native desktop app yet. Tauri v2 planned for apps/vitto-desktop/ (2-3 sessions for MVP).
MEDIUM — Workflow Auto-Submit
workflow-engine.service.ts action steps return payload but don't call submitTask(). ~5 lines.
LOW — Skill Marketplace UI, Visual Workflow Builder, Voice/Speech
Backend exists for all three. Frontend components needed.
Key Decisions Made
- Railway Redis over Upstash: Sub-ms latency on private network, resource-based billing (~$3.65/mo vs unpredictable per-command), single dashboard
- Project consolidation: 4 projects → 1 for shared Redis via private networking, zero egress, simpler management
- E2B free tier: $100 credits, no CC needed, correct tool for sandboxed code execution
- HTTP scraping primary, Browserless fallback: cheerio handles 80% of scraping at $0 with no concurrent limits. Browserless only for SPAs.
- Single Redis instance, 4 logical databases: db0=vitto, db1=api, db2=ai-api, db3=docs-api. Key isolation without separate instances.