Maintainers
Pricing
Enterprise
More
More
Documentation
Try Live
Rankings
Install
Blog
Docs7
Ask
New
Add Docs
n8n
https://github.com/zie619/n8n-workflows
Admin
all of the workflows of n8n i could find (also from the site itself)
Tokens:
57,275
Snippets:
625
Trust Score:
8.6
License:
MIT
Update:
4 months ago
Context
Chat
Benchmark
60
Latest
Show doc for...
Code
Info
Show Results
Tokens:
Raw
Copy
Link
Tokens:
Raw
Copy
Link
### Pro Tip: Start with Easy Install Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/INDEX.md A recommendation for all users, regardless of experience, to begin with the easy installation guide. ```markdown 3. **Start with EASY-INSTALL.md** - Even if you're experienced ``` -------------------------------- ### Local Installation and Server Start Source: https://github.com/zie619/n8n-workflows/blob/main/README.md Steps to clone the repository, install Python dependencies, and run the local development server. ```bash # Clone the repository git clone https://github.com/Zie619/n8n-workflows.git cd n8n-workflows # Install dependencies pip install -r requirements.txt # Start the server python run.py # Open in browser # http://localhost:8000 ``` -------------------------------- ### Goal-Based Navigation: Quick Start Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/INDEX.md For users who want to get the system running as quickly as possible. ```markdown → **QUICK-START.md** or **EASY-INSTALL.md** ``` -------------------------------- ### Development Setup and Workflow Source: https://github.com/zie619/n8n-workflows/blob/main/README.md Guide for developers on forking the repository, creating branches, making changes, testing, committing, and pushing code. ```bash # Fork and clone git clone https://github.com/YOUR_USERNAME/n8n-workflows.git # Create branch git checkout -b feature/amazing-feature # Make changes and test python run.py --debug # Commit and push git add . git commit -m "feat: add amazing feature" git push origin feature/amazing-feature # Open PR ``` -------------------------------- ### Install Gunicorn and Start Python Application Source: https://github.com/zie619/n8n-workflows/blob/main/DEPLOYMENT.md Installs Gunicorn and starts the Python application using Gunicorn workers for production deployment. ```bash # Install gunicorn pip install gunicorn # Start with gunicorn gunicorn -w 4 -k uvicorn.workers.UvicornWorker -b 0.0.0.0:8000 api_server:app ``` -------------------------------- ### Suggested Reading Order: Day 1 Installation Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/INDEX.md Follow these steps for initial installation on Day 1, choosing between a beginner-friendly or quick-start approach. ```markdown 1. QUICK-START.md (or EASY-INSTALL.md if you're new) 2. Get the stack running 3. Open all three services in browser ``` -------------------------------- ### Clone and Install Dependencies Source: https://github.com/zie619/n8n-workflows/blob/main/medcards-ai/README.md Basic commands to clone the repository and install project dependencies using npm. ```bash git clone <repository-url> cd medcards-ai npm install ``` -------------------------------- ### Install Docker on Ubuntu Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/UBUNTU-INSTALL.md Installs Docker Engine, CLI, and Containerd. This process involves updating package lists, installing prerequisites, adding Docker's GPG key and repository, and finally installing the Docker packages. It also adds the current user to the 'docker' group to avoid using sudo for Docker commands. ```bash # Update package list sudo apt update # Install required packages sudo apt install -y apt-transport-https ca-certificates curl software-properties-common # Add Docker's official GPG key curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg # Add Docker repository echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null # Update package list again sudo apt update # Install Docker sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin # Add your user to docker group (so you don't need sudo) sudo usermod -aG docker $USER # Apply the new group membership newgrp docker ``` -------------------------------- ### Install htop for Resource Monitoring Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/UBUNTU-INSTALL.md Installs the htop utility, which provides an interactive process viewer for better system resource monitoring. ```bash sudo apt install -y htop ``` -------------------------------- ### Beginner User Journey Source: https://github.com/zie619/n8n-workflows/blob/main/DELIVERY-SUMMARY.md Step-by-step guide for complete beginners using the documentation. ```text 1. Read INDEX.md → Directed to EASY-INSTALL.md 2. Follow step-by-step installation 3. Use TROUBLESHOOTING.md if needed 4. Print CHEAT-SHEET.md for reference 5. Read SUMMARY.md to learn more ``` -------------------------------- ### Install with Helm Chart Source: https://github.com/zie619/n8n-workflows/blob/main/DEPLOYMENT.md Installs the application using a Helm chart. This simplifies the deployment and management of Kubernetes resources. ```bash # Install with Helm helm install n8n-workflows-docs ./helm/workflows-docs ``` -------------------------------- ### Start Development Environment with Additional Tools (Docker Compose) Source: https://github.com/zie619/n8n-workflows/blob/main/DEPLOYMENT.md Starts the development environment with Docker Compose, including additional development tools like a database admin and file watcher. ```bash # With additional dev tools (DB admin, file watcher) docker compose --profile dev-tools up ``` -------------------------------- ### Suggested Reading Order: Day 2 First Steps Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/INDEX.md After installation, use these resources on Day 2 to understand the system and perform initial operations. ```markdown 1. SUMMARY.md - Understand what you have 2. Import test workflow 3. Generate your first image ``` -------------------------------- ### Configure AI Stack to Start on Boot with Systemd Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/UBUNTU-INSTALL.md This section details creating a systemd service file to automatically start the AI Stack on system boot. Remember to replace YOUR_USERNAME with your actual username. ```bash sudo nano /etc/systemd/system/ai-stack.service ``` ```ini [Unit] Description=AI Automation Stack After=docker.service Requires=docker.service [Service] Type=oneshot RemainAfterExit=yes WorkingDirectory=/home/YOUR_USERNAME/n8n-workflows/ai-stack ExecStart=/home/YOUR_USERNAME/n8n-workflows/ai-stack/start.sh ExecStop=/home/YOUR_USERNAME/n8n-workflows/ai-stack/start.sh --stop User=YOUR_USERNAME [Install] WantedBy=multi-user.target ``` ```bash sudo systemctl enable ai-stack sudo systemctl start ai-stack ``` -------------------------------- ### Guidance for Beginners: Still Lost? Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/INDEX.md Specific advice for beginners who are unsure where to start with the AI Stack. ```markdown **Complete Beginner?** → Read **EASY-INSTALL.md** from start to finish ``` -------------------------------- ### Docker Installation Source: https://github.com/zie619/n8n-workflows/blob/main/README.md Instructions for running the application using Docker, either from Docker Hub or by building the image locally. ```bash # Using Docker Hub docker run -p 8000:8000 zie619/n8n-workflows:latest # Or build locally docker build -t n8n-workflows . docker run -p 8000:8000 n8n-workflows ``` -------------------------------- ### Clone Repository and Start Development Environment (Docker Compose) Source: https://github.com/zie619/n8n-workflows/blob/main/DEPLOYMENT.md Use this command to clone the repository and start the development environment using Docker Compose. ```bash # Clone repository git clone <repository-url> cd n8n-workflows-1 # Start development environment docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/zie619/n8n-workflows/blob/main/medcards-ai/README.md Copies the example environment file and instructs on editing it with Supabase and Anthropic API credentials. ```bash cp .env.example .env.local ``` ```env NEXT_PUBLIC_SUPABASE_URL=your-project-url NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key SUPABASE_SERVICE_ROLE_KEY=your-service-role-key ANTHROPIC_API_KEY=sk-ant-your-api-key ``` -------------------------------- ### Run Development Server Source: https://github.com/zie619/n8n-workflows/blob/main/medcards-ai/README.md Command to start the Next.js development server for local testing. ```bash npm run dev ``` -------------------------------- ### Start AI Stack (Mac/Linux) Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/SUMMARY.md Execute the shell script to start the AI Stack on macOS or Linux. ```bash ./start.sh ``` -------------------------------- ### Check Docker Installation Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/UBUNTU-INSTALL.md Verify if Docker is already installed on your Ubuntu system. If a version number is displayed, Docker is installed and you can skip the installation steps. ```bash docker --version ``` -------------------------------- ### Install NVIDIA Drivers and Container Toolkit Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/UBUNTU-INSTALL.md Installs necessary NVIDIA drivers and the NVIDIA Container Toolkit for GPU acceleration within Docker. This involves adding repositories, installing packages, and restarting the Docker service. ```bash # Install NVIDIA drivers sudo ubuntu-drivers autoinstall # Install NVIDIA Container Toolkit distribution=$(. /etc/os-release;echo $ID$VERSION_ID) curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list sudo apt update sudo apt install -y nvidia-container-toolkit # Restart Docker sudo systemctl restart docker # Test GPU docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi ``` -------------------------------- ### Start AI Stack (Windows) Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/SUMMARY.md Run the PowerShell script to start the AI Stack on Windows. ```powershell .\start.ps1 ``` -------------------------------- ### Start and Enable Docker Service Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/UBUNTU-INSTALL.md Ensures the Docker service is running and configured to start automatically on system boot. Useful for resolving 'Cannot connect to Docker daemon' errors. ```bash # Start Docker service sudo systemctl start docker # Enable Docker to start on boot sudo systemctl enable docker # Check status sudo systemctl status docker ``` -------------------------------- ### Guidance for Experienced Users: Still Lost? Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/INDEX.md Specific advice for experienced users who are unsure where to start with the AI Stack. ```markdown **Experienced User?** → Run **QUICK-START.md** steps, then read **SUMMARY.md** ``` -------------------------------- ### Start Development Environment with Auto-Reload (Docker Compose) Source: https://github.com/zie619/n8n-workflows/blob/main/DEPLOYMENT.md Starts the development environment with Docker Compose, enabling auto-reloading for faster development cycles. ```bash # Start development environment with auto-reload docker compose -f docker-compose.yml -f docker-compose.dev.yml up ``` -------------------------------- ### Install and Scan n8n Workflows with AI-BOM Source: https://github.com/zie619/n8n-workflows/blob/main/README.md Use this command to install the AI-BOM tool and scan your n8n workflows for AI security risks. Ensure you have Python installed. ```bash pip install ai-bom ai-bom scan ./workflows/ ``` -------------------------------- ### Install Dependencies and Run Python Application Source: https://github.com/zie619/n8n-workflows/blob/main/DEPLOYMENT.md Installs project dependencies using pip and runs the Python application in either development or production mode. ```bash # Install dependencies pip install -r requirements.txt # Development mode python run.py --dev # Production mode python run.py --host 0.0.0.0 --port 8000 ``` -------------------------------- ### Verify Docker and Docker Compose Installation Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/UBUNTU-INSTALL.md Confirm that Docker and Docker Compose have been successfully installed by checking their respective versions. Successful output shows version numbers for both. ```bash docker --version docker compose version ``` -------------------------------- ### Docker Compose Port Mapping Example Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/README.md Example of how to change port mappings in a docker-compose.yml file to resolve port conflicts. ```yaml ports: - "NEW_PORT:INTERNAL_PORT" ``` -------------------------------- ### Pro Tip: Keep Troubleshooting Handy Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/INDEX.md A reminder to keep the troubleshooting guide accessible for future reference. ```markdown 5. **Keep TROUBLESHOOTING.md** handy - You'll need it eventually ``` -------------------------------- ### Start, Stop, Status, and Logs for Mac/Linux Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/CHEAT-SHEET.md Use these bash commands to manage the AI Stack services on Mac or Linux. Ensure you are in the project directory. ```bash # Start ./start.sh # Stop ./start.sh --stop # Check Status ./start.sh --status # View Logs ./start.sh --logs ``` -------------------------------- ### Download AI Stack using ZIP Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/UBUNTU-INSTALL.md Installs wget and unzip if necessary, then downloads the AI Automation Stack as a ZIP archive from GitHub and extracts it. Navigate to the 'ai-stack' directory after extraction. ```bash # Install wget and unzip if you don't have them sudo apt install -y wget unzip # Download the repository wget https://github.com/insomniakin/n8n-workflows/archive/refs/heads/feature/ai-automation-stack.zip # Unzip it unzip feature/ai-automation-stack.zip # Go to the ai-stack folder cd n8n-workflows-feature-ai-automation-stack/ai-stack ``` -------------------------------- ### Start, Stop, Status, and Logs for Windows Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/CHEAT-SHEET.md Use these PowerShell commands to manage the AI Stack services on Windows. Ensure you are in the project directory. ```powershell # Start .\start.ps1 # Stop .\start.ps1 -Stop # Check Status .\start.ps1 -Status # View Logs .\start.ps1 -Logs ``` -------------------------------- ### Make Start Script Executable Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/UBUNTU-INSTALL.md Grants execute permissions to the 'start.sh' script, allowing it to be run directly from the terminal. ```bash chmod +x start.sh ``` -------------------------------- ### Initialize Workflow Application Source: https://github.com/zie619/n8n-workflows/blob/main/static/index.html Sets up the main WorkflowApp class, initializes its state, and calls the init method to start the application. This includes setting up event listeners, theme, and Mermaid for diagram rendering. ```javascript class WorkflowApp { constructor() { this.state = { workflows: [], currentPage: 1, totalPages: 1, totalCount: 0, perPage: 20, isLoading: false, searchQuery: '', filters: { trigger: 'all', complexity: 'all', category: 'all', activeOnly: false }, categories: [], categoryMap: new Map() }; this.elements = { searchInput: document.getElementById('searchInput'), triggerFilter: document.getElementById('triggerFilter'), complexityFilter: document.getElementById('complexityFilter'), categoryFilter: document.getElementById('categoryFilter'), activeOnlyFilter: document.getElementById('activeOnly'), themeToggle: document.getElementById('themeToggle'), resultsCount: document.getElementById('resultsCount'), workflowGrid: document.getElementById('workflowGrid'), loadMoreContainer: document.getElementById('loadMoreContainer'), loadMoreBtn: document.getElementById('loadMoreBtn'), loadingState: document.getElementById('loadingState'), errorState: document.getElementById('errorState'), noResultsState: document.getElementById('noResultsState'), errorMessage: document.getElementById('errorMessage'), retryBtn: document.getElementById('retryBtn'), totalCount: document.getElementById('totalCount'), activeCount: document.getElementById('activeCount'), nodeCount: document.getElementById('nodeCount'), integrationCount: document.getElementById('integrationCount'), // Modal elements workflowModal: document.getElementById('workflowModal'), modalTitle: document.getElementById('modalTitle'), modalClose: document.getElementById('modalClose'), modalDescription: document.getElementById('modalDescription'), modalStats: document.getElementById('modalStats'), modalIntegrations: document.getElementById('modalIntegrations'), downloadBtn: document.getElementById('downloadBtn'), editWithAIBtn: document.getElementById('editWithAIBtn'), viewJsonBtn: document.getElementById('viewJsonBtn'), canvasViewer: document.getElementById('canvasViewer'), jsonSection: document.getElementById('jsonSection'), jsonViewer: document.getElementById('jsonViewer'), copyJsonBtn: document.getElementById('copyJsonBtn') }; this.searchDebounceTimer = null; this.currentWorkflow = null; this.currentJsonData = null; this.currentDiagramData = null; this.diagramZoom = 1; this.diagramSvg = null; this.diagramPan = { x: 0, y: 0 }; this.isDragging = false; this.lastMousePos = { x: 0, y: 0 }; this.init(); } async init() { this.setupEventListeners(); this.setupTheme(); this.initMermaid(); await this.loadInitialData(); } initMermaid() { // Initialize Mermaid with proper configuration if (typeof mermaid !== 'undefined') { mermaid.initialize({ startOnLoad: false, theme: 'base', themeVariables: { primaryColor: '#3b82f6', primaryTextColor: '#1e293b', primaryBorderColor: '#2563eb', lineColor: '#64748b', secondaryColor: '#f1f5f9', tertiaryColor: '#f8fafc' } }); } } setupEventListeners() { // Search and filters this.elements.searchInput.addEventListener('input', (e) => { this.state.searchQuery = e.target.value; this.debounceSearch(); }); this.elements.triggerFilter.addEventListener('change', (e) => { this.state.filters.trigger = e.target.value; this.state.currentPage = 1; this.resetAndSearch(); }); this.elements.complexityFilter.addEventListener('change', (e) => { this.state.filters.complexity = e.target.value; this.state.currentPage = 1; this.resetAndSearch(); }); this.elements.categoryFilter.addEventListener('change', (e) => { const selectedCategory = e.target.value; console.log(`Category filter changed to: ${selectedCategory}`); console.log('Current category map size:', this.state.categoryMap.size); this.state.filters.category = selectedCategory; this.state.currentPage = 1; this.resetAndSearch(); }); this.elements.activeOnlyFilter.addEventListener('change', (e) => { this.state.filters.activeOnly = e.target.checked; this.state.currentPage = 1; this.resetAndSearch(); }); // Load more this.elements.loadMoreBtn.addEventListener('click', () => { this.loadMoreWorkflows(); }); // Retry this.elements.retryBtn.addEventListener('click', () => { this.loadInitialData(); }); // Theme toggle this.elements.themeToggle.addEventListener('click', () => { this.toggleTheme(); }); // Modal events this.elements.modalClose.addEventListener('click', () => { this.closeModal(); }); this.elements.workflowModal.addEventListener('click', (e) => { if (e.target === this.elements.workflowModal) { this.closeModal(); } }); this.elements.viewJsonBtn.addEventListener('click', () => { this.toggleJsonView(); }); // Copy button events this.elements.copyJsonBtn.addEventListener('click', () => { this.copyToClipboard(this.currentJsonData, 'copyJsonBtn'); }); // Edit with AI button this.elements.editWithAIBtn.addEventListener('click', () => { this.openEditWithAI(); }); // Keyboard shortcuts document.addEventListener('keydown', ( ``` -------------------------------- ### Setup Diagram Panning and Zooming Source: https://github.com/zie619/n8n-workflows/blob/main/static/index-nodejs.html Sets up event listeners for mouse and touch events to enable diagram panning and zooming. Includes prevention of default context menu. ```javascript setupDiagramPanning() { if (!this.elements.diagramContainer) return; // Mouse events this.elements.diagramContainer.addEventListener('mousedown', (e) => { if (e.button === 0) { // Left mouse button this.startDragging(e.clientX, e.clientY); e.preventDefault(); } }); document.addEventListener('mousemove', (e) => { if (this.isDragging) { this.handleDragging(e.clientX, e.clientY); e.preventDefault(); } }); document.addEventListener('mouseup', () => { this.stopDragging(); }); // Touch events for mobile this.elements.diagramContainer.addEventListener('touchstart', (e) => { if (e.touches.length === 1) { const touch = e.touches[0]; this.startDragging(touch.clientX, touch.clientY); e.preventDefault(); } }); document.addEventListener('touchmove', (e) => { if (this.isDragging && e.touches.length === 1) { const touch = e.touches[0]; this.handleDragging(touch.clientX, touch.clientY); e.preventDefault(); } }); document.addEventListener('touchend', () => { this.stopDragging(); }); // Prevent context menu on right click this.elements.diagramContainer.addEventListener('contextmenu', (e) => { e.preventDefault(); }); // Mouse wheel zoom this.elements.diagramContainer.addEventListener('wheel', (e) => { e.preventDefault(); const zoomFactor = e.deltaY > 0 ? 0.9 : 1.1; this.zoomDiagram(zoomFactor); }); } ``` -------------------------------- ### Start Monitoring Stack with Docker Compose Source: https://github.com/zie619/n8n-workflows/blob/main/DEPLOYMENT.md Launches the monitoring stack, including Prometheus, using a specific Docker Compose profile. ```bash docker compose --profile monitoring up -d ``` -------------------------------- ### Clone AI Stack Repository using Git Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/UBUNTU-INSTALL.md Installs Git if not present and clones the AI Automation Stack repository from GitHub. This is the recommended method for downloading the stack. ```bash # Install git if you don't have it sudo apt install -y git # Clone the repository git clone https://github.com/insomniakin/n8n-workflows.git # Go to the ai-stack folder cd n8n-workflows/ai-stack ``` -------------------------------- ### Error Budget Tracking Example Source: https://github.com/zie619/n8n-workflows/blob/main/medcards-ai/SCALABILITY_ARCHITECTURE.md Illustrates the concept of an error budget based on a monthly uptime target. Shows how exceeding the budget in a given week leads to consequences like freezing feature releases. ```plaintext Monthly Uptime Target: 99.9% Error Budget: 0.1% = 43 minutes downtime/month Week 1: 5 minutes → 37 minutes left Week 2: 10 minutes → 27 minutes left Week 3: 30 minutes → -3 minutes (EXCEEDED!) → Freeze feature releases → Focus on stability → Root cause analysis ``` -------------------------------- ### Database Migration Example Source: https://github.com/zie619/n8n-workflows/blob/main/medcards-ai/SCALABILITY_ARCHITECTURE.md This TypeScript code demonstrates a database migration for adding a new table. It includes 'up' and 'down' functions for applying and rolling back the migration. ```typescript // migrations/0015_add_community_cases.ts export async function up() { // Safe migration: additive only await db.schema .createTable('community_cases') .addColumn('id', 'uuid', (col) => col.primaryKey()) .addColumn('created_at', 'timestamp') // ... other columns .execute(); } export async function down() { // Rollback (but never run in production!) await db.schema.dropTable('community_cases').execute(); } ``` -------------------------------- ### Skip Docker Image Download (Windows) Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/TROUBLESHOOTING.md Use this PowerShell command to start the AI stack without re-downloading Docker images if they are already present on Windows. ```powershell .\start.ps1 -NoPull ``` -------------------------------- ### Skip Docker Image Download (Mac) Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/TROUBLESHOOTING.md Execute this command in the Terminal to start the AI stack without re-downloading Docker images if they are already present on Mac. ```bash ./start.sh --no-pull ``` -------------------------------- ### Start AI Stack in CPU Mode (Windows) Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/TROUBLESHOOTING.md Run this PowerShell command to force the AI stack to use the CPU instead of a GPU, useful if a GPU is not detected or not supported. ```powershell .\start.ps1 -CPU ``` -------------------------------- ### Theme Management Functions Source: https://github.com/zie619/n8n-workflows/blob/main/static/index-nodejs.html Handles theme setup, toggling between light and dark modes, and updating the visual indicator for the current theme. Persists the selected theme in local storage. ```javascript setupTheme() { const savedTheme = localStorage.getItem('theme') || 'light'; document.documentElement.setAttribute('data-theme', savedTheme); this.updateThemeToggle(savedTheme); } toggleTheme() { const currentTheme = document.documentElement.getAttribute('data-theme'); const newTheme = currentTheme === 'dark' ? 'light' : 'dark'; document.documentElement.setAttribute('data-theme', newTheme); localStorage.setItem('theme', newTheme); this.updateThemeToggle(newTheme); } updateThemeToggle(theme) { this.elements.themeToggle.textContent = theme === 'dark' ? '☀️' : '🌙'; } ``` -------------------------------- ### Start AI Stack in CPU Mode (Mac) Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/TROUBLESHOOTING.md Execute this command in the Terminal to force the AI stack to use the CPU instead of a GPU, useful if a GPU is not detected or not supported. ```bash ./start.sh --cpu ``` -------------------------------- ### Beginner Experience Level Reading Path Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/INDEX.md Recommended reading order for beginners who have never used Docker. ```markdown 1. EASY-INSTALL.md ← Start here 2. TROUBLESHOOTING.md ← If problems 3. CHEAT-SHEET.md ← Print this 4. SUMMARY.md ← Learn more ``` -------------------------------- ### ComfyUI API: Get Image Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/CHEAT-SHEET.md Send a GET request to this endpoint, specifying the filename and type, to retrieve an image from ComfyUI. ```bash GET http://localhost:8188/view?filename={name}&type=output ``` -------------------------------- ### MEDCARDS.AI Marketplace Network Effect Example Source: https://github.com/zie619/n8n-workflows/blob/main/medcards-ai/EXECUTIVE_SUMMARY.md An example illustrating the marketplace network effect where a verified cardiologist creates advanced ECG cases. The example shows revenue generation for the creator based on sales to students, highlighting the platform's 70/30 revenue split. ```plaintext Example: Verified cardiologist creates "50 Advanced ECG Cases" for R$99. Sells to 1,000 students = R$99,000 revenue → R$69,300 to creator. ``` -------------------------------- ### Database Partitioning and Indexing Source: https://github.com/zie619/n8n-workflows/blob/main/medcards-ai/SCALABILITY_ARCHITECTURE.md Illustrates SQL commands for partitioning a large 'interactions' table by month and creating concurrent indexes for efficient querying of recent data. ```sql -- Partition interactions table by month (reduces query time) CREATE TABLE interactions_2025_01 PARTITION OF interactions FOR VALUES FROM ('2025-01-01') TO ('2025-02-01'); CREATE TABLE interactions_2025_02 PARTITION OF interactions FOR VALUES FROM ('2025-02-01') TO ('2025-03-01'); -- Indexes for hot queries CREATE INDEX CONCURRENTLY idx_interactions_user_recent ON interactions(user_id, created_at DESC) WHERE created_at > NOW() - INTERVAL '30 days'; -- Materialized view for dashboard stats (refresh every hour) CREATE MATERIALIZED VIEW user_stats_cache AS SELECT user_id, COUNT(*) as total_cases, AVG(CASE WHEN is_correct THEN 1.0 ELSE 0.0 END) as success_rate, MAX(created_at) as last_activity FROM interactions GROUP BY user_id; CREATE UNIQUE INDEX ON user_stats_cache(user_id); -- Auto-refresh via pg_cron SELECT cron.schedule('refresh-user-stats', '0 * * * *', 'REFRESH MATERIALIZED VIEW CONCURRENTLY user_stats_cache'); ``` -------------------------------- ### Initialize Theme from Local Storage Source: https://github.com/zie619/n8n-workflows/blob/main/static/index.html Sets up the initial theme for the application by reading from 'localStorage' or defaulting to 'light'. It applies the theme to the document's root element and updates the theme toggle UI. ```javascript setupTheme() { const savedTheme = localStorage.getItem('theme') || 'light'; document.documentElement.setAttribute('data-theme', savedTheme); this.updateThemeToggle(savedTheme); } ``` -------------------------------- ### Guidance for Troubleshooting: Still Lost? Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/INDEX.md Specific advice for users experiencing issues and seeking help. ```markdown **Something Broken?** → Check **TROUBLESHOOTING.md** first ``` -------------------------------- ### Example System Prompts for AI Bot Source: https://github.com/zie619/n8n-workflows/blob/main/templates/communication/telegram-ai-bot-template.md Define the bot's persona and role using system prompts. These examples illustrate different bot personalities for customer support, education, and business assistance. ```text # Customer Support Bot "You are a helpful customer support assistant. Provide friendly, accurate, and concise answers to customer questions." # Educational Bot "You are an educational assistant. Help students learn by providing clear explanations, examples, and study tips." # Business Assistant "You are a professional business assistant. Provide accurate information about company policies, procedures, and services." ``` -------------------------------- ### Get ComfyUI System Statistics Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/README.md Retrieve system statistics from the ComfyUI instance. ```bash GET http://comfyui:8188/system_stats ``` -------------------------------- ### Get Workflow JSON Source: https://github.com/zie619/n8n-workflows/blob/main/README.md Retrieves the JSON definition of a specific workflow by its ID. ```APIDOC ## GET /api/workflow/{id} ### Description Get the JSON definition for a specific workflow. ### Method GET ### Endpoint /api/workflow/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the workflow. ``` -------------------------------- ### Goal-Based Navigation: Understanding Usage Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/INDEX.md For users who want to learn how to use the AI Stack. ```markdown → **SUMMARY.md** → **README.md** ``` -------------------------------- ### Suggested Reading Order: Day 3 Learning Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/INDEX.md On Day 3, delve deeper into the system's details and begin experimenting with workflows. ```markdown 1. README.md - Learn the details 2. Experiment with workflows 3. Try different prompts ``` -------------------------------- ### Guidance for Command Reference: Still Lost? Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/INDEX.md Specific advice for users looking for a command reference. ```markdown **Need a Command?** → Look in **CHEAT-SHEET.md** ``` -------------------------------- ### Get ComfyUI Queue Status Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/README.md Check the current status of the ComfyUI generation queue. ```bash GET http://comfyui:8188/queue ``` -------------------------------- ### Pro Tip: Bookmark Index Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/INDEX.md A tip for efficient navigation within the AI Stack documentation. ```markdown 2. **Bookmark this INDEX.md** - Quick navigation ``` -------------------------------- ### Pro Tip: Read Summary Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/INDEX.md A tip to gain a high-level understanding of the AI Stack's functionality. ```markdown 4. **Read SUMMARY.md** - Understand the big picture ``` -------------------------------- ### Backup Configuration Files Source: https://github.com/zie619/n8n-workflows/blob/main/DEPLOYMENT.md Creates a compressed archive of essential configuration files and directories. ```bash tar -czf n8n-workflows-backup-$(date +%Y%m%d).tar.gz \ database/ \ logs/ \ docker-compose*.yml \ .env* ``` -------------------------------- ### Get Queue Status Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/README.md Retrieves the current status of the ComfyUI generation queue, including any pending or active jobs. ```APIDOC ## GET /queue ### Description Retrieves the current status of the ComfyUI generation queue, including any pending or active jobs. ### Method GET ### Endpoint http://comfyui:8188/queue ### Response #### Success Response (200) - (object) - Contains information about the current state of the generation queue. #### Response Example ```json { "queue_count": 5, "queue_remaining": 3 } ``` ``` -------------------------------- ### Intermediate Experience Level Reading Path Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/INDEX.md Recommended reading order for intermediate users who have prior Docker experience. ```markdown 1. QUICK-START.md ← Get running 2. SUMMARY.md ← Understand system 3. CHEAT-SHEET.md ← Daily reference 4. README.md ← Deep dive ``` -------------------------------- ### Run Service on Different Port Source: https://github.com/zie619/n8n-workflows/blob/main/DEPLOYMENT.md Starts the Docker Compose services, mapping host port 8001 to container port 8000. ```bash docker compose up -d -p 8001:8000 ``` -------------------------------- ### ComfyUI API: Check Status Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/CHEAT-SHEET.md Send a GET request to this endpoint, providing the prompt ID, to check the status of a task in ComfyUI. ```bash GET http://localhost:8188/history/{prompt_id} ``` -------------------------------- ### Basic Production Deployment (Docker Compose) Source: https://github.com/zie619/n8n-workflows/blob/main/DEPLOYMENT.md Performs a basic production deployment using Docker Compose. ```bash # Basic production deployment docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d ``` -------------------------------- ### Initialize Event Listeners and App Data Source: https://github.com/zie619/n8n-workflows/blob/main/static/mobile-app.html Sets up event listeners for the search input and filter buttons. Also, initializes the application by loading initial statistics and workflows. ```javascript // Event listeners document.getElementById('searchInput').addEventListener('input', filterWorkflows); document.querySelectorAll('.filter-btn').forEach(btn => { btn.addEventListener('click', () => { document.querySelectorAll('.filter-btn').forEach(b => b.classList.remove('active')); btn.classList.add('active'); currentFilters.trigger = btn.dataset.trigger; filterWorkflows(); }); }); // Initialize app loadStats(); loadWorkflows(); ``` -------------------------------- ### Linux/macOS Commands for AI Stack Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/README.md Provides various commands to manage the AI Automation Stack on Linux/macOS, including starting, stopping, and viewing logs. ```bash ./start.sh # Start the stack ./start.sh --stop # Stop the stack ./start.sh --logs # View logs ./start.sh --status # Check status ./start.sh --no-pull # Start without pulling images ./start.sh --cpu # Force CPU mode (no GPU) ``` -------------------------------- ### Create Desktop Shortcut for AI Stack Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/UBUNTU-INSTALL.md This command creates a desktop entry file that launches the AI Stack in a new GNOME terminal window. Ensure the path to start.sh is correct. ```bash cat > ~/Desktop/ai-stack.desktop << 'EOF' [Desktop Entry] Type=Application Name=AI Stack Comment=Start AI Automation Stack Exec=gnome-terminal -- bash -c "cd ~/n8n-workflows/ai-stack && ./start.sh; exec bash" Icon=applications-internet Terminal=true EOF chmod +x ~/Desktop/ai-stack.desktop ``` -------------------------------- ### Run AI Stack on Mac Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/EASY-INSTALL.md Execute the shell script to start the AI Stack on macOS. This includes steps for setting execute permissions if needed. ```bash # Right-click (or Control+click) on start.sh # Click "Open With" → "Terminal" # If Mac says "Permission denied": # Type: chmod +x start.sh # Press Enter # Type: ./start.sh # Press Enter # Wait and watch the window - you'll see lots of text scrolling # Look for these messages: # ✓ Docker found # ✓ Docker daemon is running # ✓ All images pulled successfully # 🎉 AI Stack is running! # When you see "AI Stack is running!" → You're done! ``` -------------------------------- ### Example Use of Funds Allocation Source: https://github.com/zie619/n8n-workflows/blob/main/medcards-ai/EXECUTIVE_SUMMARY.md Illustrates a sample allocation of a $500k seed investment across key operational areas for MedCards.AI over an 18-month runway. ```text Engineering: $200k (40%) - 2 engineers × 12 months Medical Content: $100k (20%) - 2 creators × 12 months Growth/Marketing: $150k (30%) - Acquisition + contractors Operations: $50k (10%) - Infrastructure, tools, legal Total: $500k Runway: 18 months ``` -------------------------------- ### Goal-Based Navigation: Troubleshooting Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/INDEX.md For users experiencing issues and needing to resolve them. ```markdown → **TROUBLESHOOTING.md** ``` -------------------------------- ### Get Workflow Category (Node.js) Source: https://github.com/zie619/n8n-workflows/blob/main/static/index-nodejs.html Retrieves the category for a given workflow filename from the category map. Returns 'Uncategorized' if the filename is not found or the category is empty. ```javascript getWorkflowCategory(filename) { const category = this.state.categoryMap.get(filename); const result = category && category.trim() ? category : 'Uncategorized'; return result; } ``` -------------------------------- ### Start Diagram Dragging Source: https://github.com/zie619/n8n-workflows/blob/main/static/index-nodejs.html Initiates the dragging state for the diagram, setting the dragging flag and recording the initial mouse position. Adds a 'dragging' class to the container. ```javascript startDragging(x, y) { this.isDragging = true; this.lastMousePos = { x, y }; this.elements.diagramContainer.classList.add('dragging'); } ``` -------------------------------- ### Queue a Generation Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/README.md Submits a generation prompt to the ComfyUI API to start a new job. It returns a unique prompt ID for tracking the job's progress. ```APIDOC ## POST /prompt ### Description Submits a generation prompt to the ComfyUI API to start a new job. It returns a unique prompt ID for tracking the job's progress. ### Method POST ### Endpoint http://comfyui:8188/prompt ### Parameters #### Request Body - **prompt** (object) - Required - ComfyUI workflow JSON definition. ### Request Example ```json { "prompt": { /* ComfyUI workflow JSON */ } } ``` ### Response #### Success Response (200) - **prompt_id** (string) - The unique identifier for the submitted prompt. #### Response Example ```json { "prompt_id": "abc123-def456-..." } ``` ``` -------------------------------- ### Deploy to Production with Vercel Source: https://github.com/zie619/n8n-workflows/blob/main/medcards-ai/README.md Commands to connect to Vercel and deploy the application to production. Environment variables need to be added in the Vercel dashboard. ```bash # Connect to Vercel npx vercel # Deploy npx vercel --prod ``` -------------------------------- ### Advanced Experience Level Reading Path Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/INDEX.md Recommended reading order for advanced users familiar with Docker. ```markdown 1. README.md ← Full docs 2. docker-compose.yml ← Customize 3. CHEAT-SHEET.md ← Quick ref ``` -------------------------------- ### Production Deployment with Monitoring Stack (Docker Compose) Source: https://github.com/zie619/n8n-workflows/blob/main/DEPLOYMENT.md Deploys the application in production using Docker Compose, including a monitoring stack. ```bash # With monitoring stack docker compose --profile monitoring up -d ``` -------------------------------- ### Direct Docker Compose Commands Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/README.md Manages the AI Automation Stack directly using Docker Compose commands for starting, stopping, viewing logs, and checking status. ```bash docker compose up -d # Start docker compose down # Stop docker compose logs -f # View logs docker compose ps # Status ``` -------------------------------- ### List Database Tables via Docker Exec Source: https://github.com/zie619/n8n-workflows/blob/main/DEPLOYMENT.md Connects to the SQLite database inside the container and lists all tables. ```bash docker exec workflows-docs sqlite3 /app/database/workflows.db ".tables" ``` -------------------------------- ### Windows PowerShell Commands for AI Stack Source: https://github.com/zie619/n8n-workflows/blob/main/ai-stack/README.md Provides various commands to manage the AI Automation Stack on Windows via PowerShell, including starting, stopping, and viewing logs. ```powershell .\start.ps1 # Start the stack .\start.ps1 -Stop # Stop the stack .\start.ps1 -Logs # View logs .\start.ps1 -Status # Check status .\start.ps1 -NoPull # Start without pulling images .\start.ps1 -CPU # Force CPU mode (no GPU) ```