Idea to Tool incubator pipeline
  • TypeScript 88.9%
  • JavaScript 10.1%
  • Dockerfile 0.6%
  • CSS 0.4%
Find a file
Fabian Lehnen 39314051c0 Add n8n pipeline workflows and fix open redirect in login
Three importable n8n workflow JSONs:
- main-pipeline.json: orchestrator with webhook trigger, status updates, execution logging, error handling
- sub-intake-agent.json: OCR via Grok, text combination, LLM standardization via Ollama
- sub-overlap-tagging.json: LLM tag generation, cross-idea overlap detection with fallback JSON parsing

Also fixes open redirect vulnerability in login action by validating the redirect target is a same-origin path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-05 13:15:37 +02:00
n8n/workflows Add n8n pipeline workflows and fix open redirect in login 2026-06-05 13:15:37 +02:00
pocketbase Implement Hatchling Phase 1: full web app, PocketBase schema, and pipeline hook 2026-06-05 13:09:33 +02:00
web Add n8n pipeline workflows and fix open redirect in login 2026-06-05 13:15:37 +02:00
.env.example Implement Hatchling Phase 1: full web app, PocketBase schema, and pipeline hook 2026-06-05 13:09:33 +02:00
.gitignore Implement Hatchling Phase 1: full web app, PocketBase schema, and pipeline hook 2026-06-05 13:09:33 +02:00
CLAUDE.md Implement Hatchling Phase 1: full web app, PocketBase schema, and pipeline hook 2026-06-05 13:09:33 +02:00
docker-compose.yml Implement Hatchling Phase 1: full web app, PocketBase schema, and pipeline hook 2026-06-05 13:09:33 +02:00
README.md Implement Hatchling Phase 1: full web app, PocketBase schema, and pipeline hook 2026-06-05 13:09:33 +02:00

Hatchling

Internal "Idea to Tool" incubator pipeline. Users submit raw ideas (text + files/whiteboards), which are automatically processed through an agentic pipeline and returned as polished, scored ideas ready for go/no-go decisions.

Architecture

Browser ──► Next.js (web) ──► PocketBase (DB/Auth/Files)
                                     │
                                     ▼
                               PocketBase Hook
                                     │
                                     ▼
                                n8n (pipeline)
                                     │
                         ┌───────────┼───────────┐
                         ▼           ▼           ▼
                    Intake Agent  Overlap/Tag  (future agents)
                         │           │
                         ▼           ▼
                   Ollama (LLM)  Grok (OCR)

Services:

Service Port Purpose
web 3000 Next.js 15 app (App Router + Server Actions)
pocketbase 8090 Database, auth, file storage
n8n 5678 Workflow orchestration
nginx-proxy-manager 80/443/81 Reverse proxy + SSL

Pipeline flow: User creates idea → PocketBase hook triggers n8n webhook → n8n runs sub-workflows (Intake → Overlap/Tagging → ...) → each step updates idea status in PocketBase → user gets realtime notification.

Idea status: rawprocessingintake_completeoverlap_completeresearch_completereuse_completesynthesizedscoredreadyapproved/rejected/on-hold

Prerequisites

  • Docker & Docker Compose
  • Node.js 22+ (for local Next.js dev)
  • Ollama running on host machine (for LLM inference)

Quick Start

# 1. Configure environment
cp .env.example .env
# Edit .env with your credentials

# 2. Start all services
docker compose up -d

# 3. Set up PocketBase admin
# Open http://localhost:8090/_/ and create admin account
# Migrations run automatically on first start

# 4. Import n8n workflows
# Open http://localhost:5678/
# Import workflow files from n8n/workflows/
# Set up credentials (PocketBase URL, Grok API key, Ollama URL)

Development

For frontend work with hot module reloading, run Next.js outside Docker:

# Start backend services only
docker compose up -d pocketbase n8n

# Run Next.js dev server
cd web
npm install
npm run dev

Commands:

cd web
npm run dev      # Dev server (http://localhost:3000)
npm run build    # Production build
npm run lint     # ESLint
npx tsc --noEmit # Type check

Environment Variables

Variable Description
POCKETBASE_URL PocketBase URL for server-side (e.g., http://localhost:8090)
NEXT_PUBLIC_POCKETBASE_URL PocketBase URL for browser (must be externally accessible)
POCKETBASE_ADMIN_EMAIL PocketBase admin email
POCKETBASE_ADMIN_PASSWORD PocketBase admin password
N8N_USER n8n basic auth username
N8N_PASSWORD n8n basic auth password
N8N_WEBHOOK_URL n8n URL for PocketBase hooks (Docker internal)
OLLAMA_URL Ollama API URL (defaults to http://host.docker.internal:11434)
GROK_API_KEY xAI Grok API key for OCR

Switching LLMs

The LLM provider is configured in n8n, not in the web app. To switch from Ollama to another provider:

  1. Open the n8n editor (http://localhost:5678/)
  2. In each sub-workflow, find the HTTP Request node that calls Ollama
  3. Replace with the equivalent API call for your provider (Groq, OpenAI, Anthropic, etc.)
  4. Update credentials in n8n's credential store

Auth & Roles

  • user: Can create, view, edit, and delete own ideas. Can approve/reject/hold own ideas.
  • admin: Full access to all ideas + user management + pipeline monitoring.

Auth is handled by PocketBase (email/password). The pb_auth cookie stores the JWT token. Row-level security is enforced at the PocketBase collection level.

PocketBase Admin

Access the PocketBase admin UI at http://localhost:8090/_/. From here you can:

  • View/edit collections and records
  • Manage users and auth settings
  • View API documentation
  • Check logs

Migrations in pocketbase/pb_migrations/ run automatically. The pipeline trigger hook in pocketbase/pb_hooks/trigger_pipeline.pb.js fires on idea creation/re-trigger.

Troubleshooting

PocketBase realtime not working in browser: NEXT_PUBLIC_POCKETBASE_URL must be the externally accessible URL, not the Docker-internal one. If using Nginx Proxy Manager, point it at http://pocketbase:8090.

n8n webhook not triggering: Check that PocketBase can reach n8n on the Docker network. The hook uses N8N_WEBHOOK_URL (defaults to http://n8n:5678). Check PocketBase logs for hook errors.

Ollama connection refused from n8n: Ollama runs on the host, not in Docker. n8n uses host.docker.internal:11434 to reach it. Make sure Ollama is running and listening on all interfaces (OLLAMA_HOST=0.0.0.0).

LLM returns malformed JSON: Ollama may return invalid JSON for structured outputs (tags, overlaps). The n8n sub-workflows have Code nodes with JSON extraction fallbacks — check those if pipeline steps fail silently.