How henry0hai/browser-n8n-local works
Main Components
• API Server (FastAPI): Represent the core server (see app.py) that handles HTTP requests and exposes all the documented endpoints (/api/v1/*). Indicate that it listens on port 8000 by default.
• Task Management Module: Although not explicitly separated into multiple files, conceptualize the component responsible for task lifecycle management (start, stop, pause, resume, and status tracking).
• Browser Use Python Library Interface: This is the internal bridge that communicates with the Browser Use API locally to mimic the cloud functionality.
• Docker and Deployment: Include Dockerfile and docker-compose as supporting components that encapsulate the whole service and its deployment environment.
• Testing: Incorporate the test_api.py component representing the test harness for the API endpoints.
• Auxiliary Components: Coverage for configuration (represented by files such as .env-example, requirements.txt) indicating dependency management and environment setup.
Relationships and Interactions
• Client (n8n or any consumer) sends HTTP requests → API Server processes the requests, performs validations, and calls into the Task Management Module.
• The Task Management Module leverages the Browser Use Python library to execute browser automation tasks.
• When interacting with LLM providers, the API Server (or Task Manager) reaches out to external APIs using credentials/settings configured via the .env file.
• Testing components simulate client requests to ensure all endpoints function as expected.
• Deployment is containerized via Docker where docker-compose might set up service dependencies if there are any (for instance, dynamic API credentials or even mock services).
Architectural Patterns and Design Principles
• Layered Architecture: Separate concerns between API request handling, business logic in task management, and external service integrations.
• Configuration via Environment Variables: Highlight the use of .env files for deployment flexibility.
• Containerization: Notice the containerized nature of the application (Dockerfile and docker-compose.yml) which is key for environment consistency.
Technologies, Frameworks, and Libraries
• FastAPI for the web server.
• Python 3.10+ as the language/runtime.
• Docker & docker-compose for containerization.
• Browser Use Python library as the main automation engine.
• External LLM APIs (OpenAI, Anthropic, etc.) integrated based on API keys and configuration.