+
A Complete Development Environment Guide
+
+ Based on a real terminal session, this guide documents the complete process of setting up
+ the Torrust BitTorrent index development environment using Claude Code, including all the
+ challenges encountered and solutions applied.
+
+
Overview
+
+ Torrust is a modern BitTorrent index system built with Rust and Vue.js, consisting of
+ three main components:
+
+
+ - torrust-tracker β BitTorrent tracker backend (Rust)
+ - torrust-index β API backend for torrent indexing (Rust)
+ - torrust-index-gui β Web frontend (Nuxt.js/Vue.js)
+
+
Setting Up Torrust with Claude Code
+
+
Initial Setup and Analysis
+
+
What Claude Code Did Right
+
+
Comprehensive Project Analysis
+
Claude Code immediately analyzed the project structure and identified all components:
+
+
Dependency Verification
+
Claude Code verified the presence of required tools:
+
+ - β
Rust toolchain (including nightly)
+ - β
Node.js v20.12.2
+ - β
Development tools (imdl, sqlx-cli)
+
+
+
Following Official Documentation
+
+ Claude Code followed the official Torrust development guide, ensuring full compatibility with the intended setup process.
+
+
+
Build Process
+
Step 1: Building Components
+
+
β
All components built successfully without modification.
+
Step 2: Storage Directory Creation
+
+
β
Directory structure matched the expected configuration.
+
Major Issues Encountered and Solutions
+
+
+ Issue 1: Database Initialization Failures
+
+
Error:
+
+
Root Cause: The app expected an existing SQLite DB file.
+
Fix:
+
+
+ β
Why it worked: Torrust expects existing DB files and doesnβt create them automatically.
+
+
+
Issue 2: Port Conflicts
+
Error:
+
+
+
Root Cause: Multiple Index services running on the same port.
+
Fix:
+
+
+
β
Why it worked: Ensured only one instance was listening on each port.
+
+
Issue 3: CORS Configuration Problems
+
Error:
+
+
Root Cause: The required CORS environment variable wasnβt set.
+
Fix:
+
+
+ β
Why it worked: Claude identified TORRUST_INDEX_API_CORS_PERMISSIVE from source code and
+ activated permissive CORS.
+
+
+
How Claude Code Helped
+
+ -
+ π Systematic Debugging
+
+ - Analyzed logs line-by-line
+ - Identified root causes instead of surface fixes
+ - Used diagnostic tools like
lsof
, curl
+
+
+ -
+ π Code Analysis
+
+ - Read source code to identify config logic
+ - Found undocumented environment variables
+ - Verified DB initialization logic in Rust code
+
+
+ -
+ βοΈ Service Orchestration
+
+ - Ensured proper service startup order
+ - Understood dependencies between services
+
+
+ -
+ β
Testing and Verification
+
+ - Used
curl
to test APIs
+ - Verified CORS headers
+ - Confirmed DB presence
+
+
+
+
+
Final Working Setup
+
+
Required Running Services (3 terminals)
+
+ -
+ Terminal 1 β Tracker
+
+
+ -
+ Terminal 2 β Index
+
+
+ -
+ Terminal 3 β GUI
+
+
+
+
Access Points
+
+
+
Clean Setup Guide for Others
+
+
π§° Prerequisites
+
+ - Rust (nightly)
+ - Node.js v20.12.2+
+ - Git
+
+
+
π¦ Setup Steps
+
+
+
Key Takeaways
+
+ -
+ Database Files Are Critical: Must be created manually before app startup
+
+ -
+ CORS Must Be Explicitly Enabled: Set
+
TORRUST_INDEX_API_CORS_PERMISSIVE=true
+
+ -
+ Service Dependencies Matter: GUI β Index β Tracker (start in that order)
+
+ -
+ Expected 404s Are Normal: Token endpoint returns 404 if no user is logged
+ in
+
+ -
+ Claude Code Excels at Systematic Setup: It debugged, read source, and diagnosed
+ like a seasoned engineer
+
+
+
+
Conclusion
+
+ This setup process demonstrates how Claude Code can assist with complex multi-service
+ development environments. By combining log analysis, source code reading, and iterative
+ testing, it enabled a clean and fully functional Torrust development environment β even in
+ the face of port conflicts, missing DBs, and CORS issues.
+
+