RouterMesh is an API orchestration and integration platform that connects multiple routers, APIs, internal tools, and services into unified, secure, and observable workflows.
PROJECT: RouterMesh ROLE: Act as a senior software architect, full-stack developer, backend engineer, UI/UX designer, QA engineer, DevOps engineer, and security engineer. GOAL: Build a complete, production-ready API integration and orchestration platform called RouterMesh. TARGET USERS: Developers, integration engineers, platform teams, and technical businesses that need to connect multiple APIs, routers, internal tools, and third-party services without building custom integration code for every connection. BUSINESS CONTEXT: RouterMesh allows teams to visually or programmatically connect APIs and routers to each other, transform request and response data, apply authentication, route traffic, retry failures, and trigger actions in internal tools. It reduces integration complexity and creates a centralized control plane for service-to-service communication. CORE FEATURES: 1. User registration, login, logout, password reset, profile management, and organization/workspace management. 2. Role-based access control with Owner, Admin, Developer, Integrator, and Viewer roles. 3. Register and manage API endpoints, including REST, GraphQL, Webhook, and internal service APIs. 4. Configure API connections with base URL, authentication method, headers, query parameters, timeouts, retry policy, rate limits, and environment variables. 5. Support API keys, Bearer tokens, OAuth 2.0, Basic Auth, HMAC signatures, and custom authentication headers. 6. Create visual workflow builder to connect routers, APIs, internal tools, transformations, conditions, loops, and error handlers. 7. Create router-to-router connections where the output of one API can become the input of another API. 8. Create API-to-tool connections that send data to internal tools such as databases, queues, email services, CRMs, analytics platforms, and custom internal services. 9. Data mapping and transformation engine using JSONPath, JavaScript expressions, templates, field mapping, and conditional logic. 10. Request/response transformation, header manipulation, query rewriting, payload enrichment, filtering, and response validation. 11. Conditional routing based on HTTP status, response payload, headers, user roles, time, rate limits, or custom business rules. 12. Retry failed requests with exponential backoff, circuit breaker behavior, dead-letter queue, and fallback routes. 13. Webhook receiver and outbound webhook dispatcher with signature verification, retries, and event delivery logs. 14. Scheduled workflows using cron expressions and one-time scheduled executions. 15. Execution history with request/response snapshots, status, duration, retries, error messages, and trace ID. 16. Real-time monitoring dashboard showing API health, latency, success rate, error rate, throughput, active workflows, and failed executions. 17. Alerting through email, Slack, webhook, or internal notification when an API fails, latency exceeds a threshold, or a workflow repeatedly fails. 18. API mocking and sandbox environment for testing workflows before production deployment. 19. Import/export workflows and connection configurations as JSON. 20. Audit logs for configuration changes, secret access, workflow execution, and administrative actions. USER STORIES: - As a developer, I want to register an external API so that I can securely connect it to my workflows. - As an integrator, I want to connect the response of one API to the request of another API so that I can automate multi-step processes. - As a platform engineer, I want to route requests conditionally so that traffic goes to the correct service based on business rules. - As a developer, I want to transform API responses so that downstream tools receive data in the required format. - As an operations engineer, I want to monitor API failures and latency so that I can respond to incidents quickly. - As an admin, I want to manage secrets and access permissions so that only authorized users can modify integrations. - As a user, I want to view execution logs so that I can debug failed workflows. TECH STACK: - Frontend: Next.js + TypeScript + Tailwind CSS - Workflow builder: React Flow - Backend: Node.js + NestJS + TypeScript - API Gateway and routing: Express or Fastify with a custom routing layer - Database: PostgreSQL with Prisma ORM - Queue and background jobs: BullMQ with Redis - Real-time updates: Socket.IO or WebSockets - Caching: Redis - Authentication: JWT authentication with refresh tokens - Secret management: HashiCorp Vault, AWS Secrets Manager, or encrypted database storage - Validation: Zod - Testing: Vitest, Supertest, and Playwright - Observability: OpenTelemetry, Prometheus, Grafana, and structured logging - Deployment: Docker, docker-compose, GitHub Actions, and Kubernetes-ready configuration ARCHITECTURE: - Use a clean, modular, scalable architecture. - Separate UI, workflow engine, API gateway, connector layer, transformation engine, queue workers, monitoring, and data access. - Use event-driven architecture for asynchronous workflows, retries, webhooks, and scheduled jobs. - Use a queue-based execution model so long-running or failing workflows do not block API requests. - Store workflow definitions as versioned JSON documents. - Execute workflows through a deterministic, sandboxed engine with timeouts and resource limits. - Use a connector abstraction so new API, router, and internal-tool integrations can be added without changing the core engine. - Use centralized error handling, structured logs, distributed tracing, and correlation IDs. - Make the system horizontally scalable, observable, and production-ready. USER INTERFACE: - Build a modern, clean, responsive, and accessible UI. - Include desktop, tablet, and mobile layouts. - Create a dashboard with API health, workflow success rate, latency charts, recent executions, and active alerts. - Build a visual workflow canvas using React Flow with draggable nodes, connections, zoom, pan, undo/redo, and validation indicators. - Provide node types for API Request, Router, Condition, Transformation, Delay, Loop, Webhook, Internal Tool, Error Handler, and End. - Build an API connection manager with forms for base URL, authentication, headers, timeouts, retries, rate limits, and environment selection. - Build an execution history page with filters, trace IDs, status, request/response viewer, error details, and retry action. - Build a monitoring page with charts, health indicators, error breakdowns, latency percentiles, and alert configuration. - Include modals, toast notifications, empty states, loading states, and error states. - Support dark mode and light mode. - Ensure keyboard navigation, screen-reader support, and accessible color contrast. SECURITY & PRIVACY: - Never hardcode API keys, passwords, tokens, client secrets, certificates, or any other credentials. - Store secrets encrypted at rest using a secure key-management approach. - Use environment variables for infrastructure configuration and provide a .env.example file. - Mask secrets, tokens, authorization headers, and sensitive fields in UI, logs, API responses, and execution history. - Validate and sanitize all user input on both client and server. - Protect against SSRF, SQL injection, XSS, CSRF, clickjacking, insecure deserialization, and unsafe JavaScript execution. - Restrict outbound requests with an allowlist or policy engine to prevent SSRF and unauthorized internal-network access. - Implement role-based access control and server-side authorization for every workflow, connection, secret, and execution action. - Require explicit confirmation before deleting connections, workflows, secrets, execution history, or production configurations. - Use secure sandboxing or restricted execution for user-defined JavaScript transformations. - Apply rate limiting, request timeouts, payload-size limits, retry limits, and circuit breakers. - Sign outbound webhooks and verify inbound webhook signatures. - Use secure cookies, token expiration, refresh-token rotation, and audit logging. - Do not expose sensitive data, stack traces, tokens, internal IPs, or internal errors in logs or API responses. DATA MODEL: - User: id, name, email, passwordHash, avatarUrl, role, organizationId, emailVerified, createdAt, updatedAt. - Organization: id, name, ownerId, plan, createdAt, updatedAt. - OrganizationMember: id, organizationId, userId, role, joinedAt. - ApiConnection: id, organizationId, name, type, baseUrl, authType, authConfigRef, headers, defaultQueryParams, timeoutMs, retryPolicy, rateLimit, environment, status, createdBy, createdAt, updatedAt. - Secret: id, organizationId, name, encryptedValue, keyVersion, createdBy, lastAccessedAt, createdAt, updatedAt. - Router: id, organizationId, name, description, routePath, httpMethod, status, version, createdBy, createdAt, updatedAt. - RouterRule: id, routerId, priority, condition, targetConnectionId, targetPath, transformationId, fallbackConnectionId, isActive. - Workflow: id, organizationId, name, description, status, currentVersion, createdBy, createdAt, updatedAt. - WorkflowVersion: id, workflowId, versionNumber, definitionJson, createdBy, createdAt. - WorkflowNode: id, workflowVersionId, nodeType, name, configurationJson, positionX, positionY. - WorkflowEdge: id, workflowVersionId, sourceNodeId, targetNodeId, condition, label. - InternalTool: id, organizationId, name, type, connectionConfig, status, createdBy, createdAt, updatedAt. - Execution: id, organizationId, workflowId, workflowVersionId, triggerType, status, startedAt, finishedAt, durationMs, traceId, error, inputSnapshot, outputSnapshot. - ExecutionStep: id, executionId, nodeId, name, status, requestSnapshot, responseSnapshot, startedAt, finishedAt, durationMs, retryCount, error. - WebhookEndpoint: id, organizationId, name, url, secretRef, events, isActive, createdAt, updatedAt. - WebhookDelivery: id, webhookEndpointId, eventId, payload, status, attempts, responseStatus, lastAttemptAt, nextRetryAt, createdAt. - AlertRule: id, organizationId, name, condition, channel, recipients, isActive, createdAt, updatedAt. - AuditLog: id, organizationId, userId, action, resourceType, resourceId, metadata, ipAddress, createdAt. TESTING & QUALITY: - Write unit tests for routing rules, transformations, authentication handling, retry logic, condition evaluation, and workflow validation. - Write integration tests for API connection CRUD, workflow CRUD, execution, webhooks, secrets, permissions, and internal-tool integrations. - Write end-to-end tests for creating a workflow, connecting two APIs, transforming data, executing the workflow, viewing logs, and handling failures. - Include tests for invalid input, unauthorized access, expired credentials, SSRF attempts, webhook signature failures, timeouts, retries, and destructive actions. - Ensure the project passes linting, type checking, build, and all tests. DELIVERABLES: - Complete source code with no placeholders or unfinished features. - README with project overview, architecture, setup, environment variables, database setup, run commands, and deployment instructions. - Configuration files for development, testing, and production. - Database migrations and optional seed data. - API documentation or endpoint reference. - Docker and docker-compose configuration. - Kubernetes manifests or deployment instructions. - CI/CD pipeline configuration. - Observability setup with logging, metrics, and tracing. - Test suite and instructions to run tests. IMPLEMENTATION RULES: - Build real working features, not mockups or placeholder code. - Implement every required feature completely. - Handle errors gracefully with meaningful user-facing messages. - Use clean, modular, maintainable, and well-organized code. - Avoid deprecated libraries, insecure patterns, and unnecessary dependencies. - If information is missing, state assumptions clearly before implementing. - Do not claim that a feature works unless it is implemented and verified through tests or a runnable flow. - If the task is too large for one response, create a phased implementation plan first, then implement phase by phase. OUTPUT: 1. Start with a short architecture plan, technology decisions, and project structure. 2. Then implement the application phase by phase. 3. After each phase, summarize what was completed and what remains. 4. At the end, provide: - Completed features - Files created - Database schema - API endpoints - Workflow engine design - Tests run - Setup instructions
Opinionated React Router v7 framework-mode preferences: loaders and actions, typed routes, progressive forms, server-only modules, error boundaries and URL state.
# React Router App taste of a full-stack developer who wants routes to own their data
- Use React Router v7 in framework mode with Vite and TypeScript for new apps, not the old data-router setup by hand. Confidence: 0.90
- Define routes in app/routes.ts with explicit route() and layout() calls instead of relying only on file-name magic. Confidence: 0.75
- Load data in route loaders and mutate in route actions; never fetch page data in useEffect. Confidence: 0.95
- Use the generated Route types (./+types/route-name) for loaderData, actionData and params in every route module. Confidence: 0.90
- Render on the server by default and switch a route to prerender or SPA mode only when there is a clear reason. Confidence: 0.80
- Use <Form> and useFetcher for mutations so the app works before JavaScript loads and revalidates automatically. Confidence: 0.90
- Validate form data and params in actions with Zod and return field errors with data(..., { status: 400 }). Confidence: 0.85
- Throw redirect() after a successful POST to avoid double submits on refresh. Confidence: 0.90
- Keep server-only code in .server.ts files so secrets and database clients never reach the client bundle. Confidence: 0.95
- Read the session in a shared helper used by loaders and actions; protect routes with a parent layout loader that redirects. Confidence: 0.80
- Export an ErrorBoundary from the root and from risky routes, and throw data() responses for 404 and 403. Confidence: 0.85
- Use URL search params as state for filters, sorting and pagination so views are shareable and back-button safe. Confidence: 0.90
- Show pending UI with useNavigation and fetcher.state, and add optimistic UI for quick actions like toggles. Confidence: 0.80
- Return promises from loaders for slow, non-critical data and render them with Suspense and Await. Confidence: 0.70
- Set cache headers per route with the headers export instead of one global policy. Confidence: 0.75
- Define meta and links exports per route for titles, descriptions and preloaded assets. Confidence: 0.75
- Keep a thin route module and move business logic into plain functions in app/lib that are easy to unit test. Confidence: 0.85
- Do not add a client data cache library by default; the router's revalidation is enough for most apps. Confidence: 0.70
- Use nested routes and <Outlet /> for shared layouts instead of repeating headers and sidebars. Confidence: 0.85
- Prefetch likely next pages with <Link prefetch="intent">. Confidence: 0.75
- Test loaders and actions as functions with Vitest, and cover the main flows with Playwright against a built server. Confidence: 0.80
- Deploy with an official adapter for the target (Node, Vercel, Cloudflare) and keep environment access behind one typed config module. Confidence: 0.75