# shreyashxp095/automateit architecture

> Architecture diagram of the GitHub repository shreyashxp095/automateit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shreyashxp095/automateit
- Repository: https://github.com/shreyashxp095/automateit

## Overview

1. This repository is a Next.js App Router application centered on a workflow automation product: users authenticate, design workflows in an editor, manage credentials, and inspect executions. The architecture is split by route groups rather than by page-only files.

2. The top-level UI shell is organized into three main areas: an auth area under `src/app/(auth)`, a dashboard area under `src/app/(dashboard)`, and API endpoints under `src/app/api`. The dashboard itself is further divided into an editor sub-area for workflow design and a rest sub-area for list/detail views.

3. The workflow editor is the core interactive subsystem. It uses React Flow-style node rendering, with custom node components in `src/components/react-flow`, `src/components/workflow-node.tsx`, and feature-specific nodes in `src/features/triggers`, `src/features/executions`, and `src/features/editor`. The route `workflows/[workflowId]` is the main entry point for editing a single workflow graph.

4. Workflow data appears to be modeled as graph entities in the database, not just as simple forms. The Prisma migrations include “react_flow_tables” and “new_nodes”, which indicates persisted nodes/edges, plus workflow improvements over time. The editor likely reads that graph, renders it in React Flow, and writes updates back through server mutations.

5. Execution is a separate subsystem from workflow authoring. The `executions` screens and `src/features/executions/...` components suggest read-only or inspection-oriented views of runs, with node-specific visualization such as `http-request` execution nodes. This is an important boundary: design-time workflow nodes vs. run-time execution nodes.

6. Credentials are managed as a first-class dashboard domain in `src/app/(dashboard)/(rest)/credentials`. That implies workflows depend on stored secrets or integrations, but the credential UI is separated from the editor to keep secret management outside the graph-editing flow.

7. Data access is Prisma-based. The schema and migrations live under `prisma/`, and generated client code is checked into `src/generated/prisma`. `src/lib/db.ts` is the DB entry point, so the server side talks to a relational database through Prisma rather than directly through raw SQL.

8. Typed server/client communication is handled with tRPC. The app exposes a tRPC endpoint at `src/app/api/trpc/[trpc]/route.ts`, with shared router setup under `src/trpc/routers` and client helpers in `src/trpc/client.tsx` and `src/trpc/server.tsx`. This is the main application RPC boundary for dashboard data mutations and queries.

9. Background or asynchronous processing is wired through Inngest. The project has an Inngest client and function definitions in `src/inngest/`, plus a dedicated API route at `src/app/api/inngest/route.ts`. That suggests workflow/execution events can be processed out of band from the request/response path.

10. Authentication is a dedicated subsystem. It has its own app routes, shared auth utilities in `src/lib/auth.ts`, `src/lib/auth-client.tsx`, and `src/lib/auth-utils.tsx`, and an auth API catch-all at `/api/auth/[...all]`. The presence of `better_auth_fields` in migrations suggests auth state is persisted in the same Prisma-backed database.

11. Subscription or billing concerns are present as cross-cutting product logic. `src/lib/polar.ts`, `use-subscription`, and `upgrade-modal` indicate a monetization boundary that can gate features inside the dashboard/editor, even though the billing provider is abstracted away from the page structure.

12. Observability and operational concerns are built in. There are separate Sentry configs for edge and server runtimes, plus instrumentation entry points. That means the app is deployed as a mixed server/client Next.js system with explicit monitoring across both runtime environments.

13. Shared UI and feature composition are centralized. `src/components/ui` contains a large design-system layer, while `src/features/*` keeps domain-specific UI, hooks, and server loaders close to each feature. This separation is useful for a diagram because it distinguishes reusable primitives from workflow/auth/domain code.

Main entry points: [`src/app/layout.tsx`](https://github.com/shreyashxp095/automateit/blob/main/src/app/layout.tsx) (App Shell), [`src/app/(dashboard)/layout.tsx`](https://github.com/shreyashxp095/automateit/blob/main/src/app/(dashboard)/layout.tsx) (Dashboard Shell), [`src/components/workflow-node.tsx`](https://github.com/shreyashxp095/automateit/blob/main/src/components/workflow-node.tsx) (Workflow Nodes), [`src/features/editor/components/editor.tsx`](https://github.com/shreyashxp095/automateit/blob/main/src/features/editor/components/editor.tsx) (Editor Core)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Next.js App"]
  node_root["App Shell<br/>nextjs app<br/>[layout.tsx]"]
  node_auth_group["Auth Area<br/>route group<br/>[layout.tsx]"]
  node_dashboard_group["Dashboard Shell<br/>route group<br/>[layout.tsx]"]
  node_auth_api["Auth API<br/>route handler<br/>[route.ts]"]
  node_trpc_api["tRPC API<br/>rpc route<br/>[route.ts]"]
  node_inngest_api["Inngest API<br/>job route<br/>[route.ts]"]
  node_workflows_editor_route["Workflow Editor<br/>editor route<br/>[page.tsx]"]
  node_workflows_list_route["Workflows List<br/>dashboard page<br/>[page.tsx]"]
  node_executions_route["Executions<br/>dashboard page<br/>[page.tsx]"]
  node_credentials_route["Credentials<br/>dashboard page<br/>[page.tsx]"]
end

subgraph group_features["Feature Code"]
  node_editor_feature["Editor Core<br/>workflow editor<br/>[editor.tsx]"]
  node_workflow_nodes["Workflow Nodes<br/>node system<br/>[workflow-node.tsx]"]
  node_trigger_nodes["Trigger Nodes<br/>workflow nodes<br/>[node.tsx]"]
  node_execution_nodes["Execution Nodes<br/>runtime nodes<br/>[node.tsx]"]
  node_workflows_domain["Workflows Domain<br/>feature module<br/>[routers.ts]"]
  node_auth_feature["Auth Feature<br/>feature module<br/>[auth-layout.tsx]"]
  node_subscription["Subscription Gate<br/>billing logic"]
end

subgraph group_infra["Infrastructure"]
  node_db[("Prisma DB<br/>database access<br/>[db.ts]")]
  node_schema["Schema<br/>[schema.prisma]"]
  node_trpc_core["tRPC Core<br/>[_app.ts]"]
  node_inngest_core["Inngest Core<br/>async jobs<br/>[functions.ts]"]
  node_auth_core["Auth Core<br/>auth utils<br/>[auth.ts]"]
  node_billing_core["Billing Core<br/>billing provider<br/>[polar.ts]"]
  node_observability["Observability<br/>monitoring"]
end

subgraph group_shared["Shared UI"]
  node_react_flow_core["React Flow UI<br/>graph ui<br/>[base-node.tsx]"]
  node_shared_ui["UI Kit<br/>design system<br/>[button.tsx]"]
end

node_root -->|"routes"| node_auth_group
node_root -->|"routes"| node_dashboard_group
node_root -->|"api"| node_auth_api
node_root -->|"api"| node_trpc_api
node_root -->|"jobs"| node_inngest_api
node_dashboard_group -->|"editor"| node_workflows_editor_route
node_dashboard_group -->|"workflows"| node_workflows_list_route
node_dashboard_group -->|"executions"| node_executions_route
node_dashboard_group -->|"credentials"| node_credentials_route
node_workflows_editor_route -->|"uses"| node_editor_feature
node_editor_feature -->|"renders"| node_workflow_nodes
node_workflow_nodes -->|"builds on"| node_react_flow_core
node_workflow_nodes -->|"includes"| node_trigger_nodes
node_workflow_nodes -->|"mirrors"| node_execution_nodes
node_editor_feature -->|"loads"| node_workflows_domain
node_workflows_domain -->|"queries"| node_trpc_core
node_workflows_domain -->|"persists"| node_db
node_trpc_core -->|"data"| node_db
node_db -->|"modeled by"| node_schema
node_auth_group -->|"uses"| node_auth_feature
node_auth_feature -->|"auth"| node_auth_core
node_auth_feature -->|"gates"| node_subscription
node_subscription -->|"provider"| node_billing_core
node_auth_core -->|"users"| node_db
node_auth_api -->|"implements"| node_auth_core
node_trpc_api -->|"serves"| node_trpc_core
node_inngest_api -->|"dispatches"| node_inngest_core
node_observability -->|"instruments"| node_root
node_shared_ui -->|"ui"| node_editor_feature
node_shared_ui -->|"ui"| node_auth_feature

click node_root "https://github.com/shreyashxp095/automateit/blob/main/src/app/layout.tsx"
click node_auth_group "https://github.com/shreyashxp095/automateit/blob/main/src/app/(auth)/layout.tsx"
click node_dashboard_group "https://github.com/shreyashxp095/automateit/blob/main/src/app/(dashboard)/layout.tsx"
click node_auth_api "https://github.com/shreyashxp095/automateit/blob/main/src/app/api/auth/[...all]/route.ts"
click node_trpc_api "https://github.com/shreyashxp095/automateit/blob/main/src/app/api/trpc/[trpc]/route.ts"
click node_inngest_api "https://github.com/shreyashxp095/automateit/blob/main/src/app/api/inngest/route.ts"
click node_workflows_editor_route "https://github.com/shreyashxp095/automateit/blob/main/src/app/(dashboard)/(editor)/workflows/[workflowId]/page.tsx"
click node_workflows_list_route "https://github.com/shreyashxp095/automateit/blob/main/src/app/(dashboard)/(rest)/workflows/page.tsx"
click node_executions_route "https://github.com/shreyashxp095/automateit/blob/main/src/app/(dashboard)/(rest)/executions/page.tsx"
click node_credentials_route "https://github.com/shreyashxp095/automateit/blob/main/src/app/(dashboard)/(rest)/credentials/page.tsx"
click node_editor_feature "https://github.com/shreyashxp095/automateit/blob/main/src/features/editor/components/editor.tsx"
click node_workflow_nodes "https://github.com/shreyashxp095/automateit/blob/main/src/components/workflow-node.tsx"
click node_react_flow_core "https://github.com/shreyashxp095/automateit/blob/main/src/components/react-flow/base-node.tsx"
click node_trigger_nodes "https://github.com/shreyashxp095/automateit/blob/main/src/features/triggers/manual-trigger/node.tsx"
click node_execution_nodes "https://github.com/shreyashxp095/automateit/blob/main/src/features/executions/componenets/http-request/node.tsx"
click node_workflows_domain "https://github.com/shreyashxp095/automateit/blob/main/src/features/workflows/server/routers.ts"
click node_auth_feature "https://github.com/shreyashxp095/automateit/blob/main/src/features/auth/components/auth-layout.tsx"
click node_subscription "https://github.com/shreyashxp095/automateit/blob/main/src/features/auth/components/hooks/use-subscription.ts"
click node_shared_ui "https://github.com/shreyashxp095/automateit/blob/main/src/components/ui/button.tsx"
click node_db "https://github.com/shreyashxp095/automateit/blob/main/src/lib/db.ts"
click node_schema "https://github.com/shreyashxp095/automateit/blob/main/prisma/schema.prisma"
click node_trpc_core "https://github.com/shreyashxp095/automateit/blob/main/src/trpc/routers/_app.ts"
click node_inngest_core "https://github.com/shreyashxp095/automateit/blob/main/src/inngest/functions.ts"
click node_auth_core "https://github.com/shreyashxp095/automateit/blob/main/src/lib/auth.ts"
click node_billing_core "https://github.com/shreyashxp095/automateit/blob/main/src/lib/polar.ts"
click node_observability "https://github.com/shreyashxp095/automateit/blob/main/sentry.server.config.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_root,node_auth_group,node_dashboard_group,node_auth_api,node_trpc_api,node_inngest_api,node_workflows_editor_route,node_workflows_list_route,node_executions_route,node_credentials_route toneBlue
class node_editor_feature,node_workflow_nodes,node_trigger_nodes,node_execution_nodes,node_workflows_domain,node_auth_feature,node_subscription toneAmber
class node_db,node_schema,node_trpc_core,node_inngest_core,node_auth_core,node_billing_core,node_observability toneMint
class node_react_flow_core,node_shared_ui toneRose
```

## Components

### Next.js App

Route groups and API surface

- [App Shell](https://github.com/shreyashxp095/automateit/blob/main/src/app/layout.tsx): nextjs app · Global layout and routing shell · `src/app/layout.tsx`
- [Auth Area](https://github.com/shreyashxp095/automateit/blob/main/src/app/(auth)/layout.tsx): route group · Sign-in and sign-up flows · `src/app/(auth)/layout.tsx`
- [Dashboard Shell](https://github.com/shreyashxp095/automateit/blob/main/src/app/(dashboard)/layout.tsx): route group · Main authenticated application shell · `src/app/(dashboard)/layout.tsx`
- [Auth API](https://github.com/shreyashxp095/automateit/blob/main/src/app/api/auth/[...all]/route.ts): route handler · Authentication endpoint catch-all · `src/app/api/auth/[...all]/route.ts`
- [tRPC API](https://github.com/shreyashxp095/automateit/blob/main/src/app/api/trpc/[trpc]/route.ts): rpc route · Typed app RPC boundary · `src/app/api/trpc/[trpc]/route.ts`
- [Inngest API](https://github.com/shreyashxp095/automateit/blob/main/src/app/api/inngest/route.ts): job route · Background event ingress · `src/app/api/inngest/route.ts`
- [Workflow Editor](https://github.com/shreyashxp095/automateit/blob/main/src/app/(dashboard)/(editor)/workflows/[workflowId]/page.tsx): editor route · Single-workflow graph editor entry point · `src/app/(dashboard)/(editor)/workflows/[workflowId]/page.tsx`
- [Workflows List](https://github.com/shreyashxp095/automateit/blob/main/src/app/(dashboard)/(rest)/workflows/page.tsx): dashboard page · Workflow overview and navigation · `src/app/(dashboard)/(rest)/workflows/page.tsx`
- [Executions](https://github.com/shreyashxp095/automateit/blob/main/src/app/(dashboard)/(rest)/executions/page.tsx): dashboard page · Run history and execution inspection · `src/app/(dashboard)/(rest)/executions/page.tsx`
- [Credentials](https://github.com/shreyashxp095/automateit/blob/main/src/app/(dashboard)/(rest)/credentials/page.tsx): dashboard page · Stored secrets and integrations · `src/app/(dashboard)/(rest)/credentials/page.tsx`

### Feature Code

Domain-specific UI and loaders

- [Editor Core](https://github.com/shreyashxp095/automateit/blob/main/src/features/editor/components/editor.tsx): workflow editor · Workflow graph editing experience · `src/features/editor/components/editor.tsx`
- [Workflow Nodes](https://github.com/shreyashxp095/automateit/blob/main/src/components/workflow-node.tsx): node system · Shared workflow node rendering and selection · `src/components/workflow-node.tsx`
- [Trigger Nodes](https://github.com/shreyashxp095/automateit/blob/main/src/features/triggers/manual-trigger/node.tsx): workflow nodes · Start nodes for manual or event-triggered workflows · `src/features/triggers/manual-trigger/node.tsx`
- [Execution Nodes](https://github.com/shreyashxp095/automateit/blob/main/src/features/executions/componenets/http-request/node.tsx): runtime nodes · Runtime visualization for workflow executions · `src/features/executions/componenets/http-request/node.tsx`
- [Workflows Domain](https://github.com/shreyashxp095/automateit/blob/main/src/features/workflows/server/routers.ts): feature module · Workflow params, loaders, and prefetching · `src/features/workflows/server/routers.ts`
- [Auth Feature](https://github.com/shreyashxp095/automateit/blob/main/src/features/auth/components/auth-layout.tsx): feature module · Auth forms and subscription-aware auth shell · `src/features/auth/components/auth-layout.tsx`
- [Subscription Gate](https://github.com/shreyashxp095/automateit/blob/main/src/features/auth/components/hooks/use-subscription.ts): billing logic · Plan state and upgrade prompts · `src/features/auth/components/hooks/use-subscription.ts`

### Infrastructure

Database, RPC, jobs, and observability

- [Prisma DB](https://github.com/shreyashxp095/automateit/blob/main/src/lib/db.ts): database access · Database entry point through Prisma · `src/lib/db.ts`
- [Schema](https://github.com/shreyashxp095/automateit/blob/main/prisma/schema.prisma): prisma schema · Data model and migrations source · `prisma/schema.prisma`
- [tRPC Core](https://github.com/shreyashxp095/automateit/blob/main/src/trpc/routers/_app.ts): rpc core · Shared client, server, and router setup · `src/trpc/routers/_app.ts`
- [Inngest Core](https://github.com/shreyashxp095/automateit/blob/main/src/inngest/functions.ts): async jobs · Background client and function definitions · `src/inngest/functions.ts`
- [Auth Core](https://github.com/shreyashxp095/automateit/blob/main/src/lib/auth.ts): auth utils · Shared auth helpers and client utilities · `src/lib/auth.ts`
- [Billing Core](https://github.com/shreyashxp095/automateit/blob/main/src/lib/polar.ts): billing provider · Monetization integration abstraction · `src/lib/polar.ts`
- [Observability](https://github.com/shreyashxp095/automateit/blob/main/sentry.server.config.ts): monitoring · Sentry and instrumentation hooks · `sentry.server.config.ts`

### Shared UI

Reusable components and primitives

- [React Flow UI](https://github.com/shreyashxp095/automateit/blob/main/src/components/react-flow/base-node.tsx): graph ui · Base node and handle primitives · `src/components/react-flow/base-node.tsx`
- [UI Kit](https://github.com/shreyashxp095/automateit/blob/main/src/components/ui/button.tsx): design system · Reusable interface primitives · `src/components/ui/button.tsx`

## Connections

- App Shell → Auth Area: routes · Public auth flows are mounted from the root shell
- App Shell → Dashboard Shell: routes · Authenticated app shell is mounted from the root shell
- App Shell → Auth API: api · Auth requests terminate in the auth API route
- App Shell → tRPC API: api · Dashboard data flows through the tRPC route
- App Shell → Inngest API: jobs · Background events enter through the Inngest route
- Dashboard Shell → Workflow Editor: editor · Single-workflow editing lives in the dashboard editor area
- Dashboard Shell → Workflows List: workflows · Workflow list and detail navigation live in the rest area
- Dashboard Shell → Executions: executions · Execution inspection lives in the dashboard rest area
- Dashboard Shell → Credentials: credentials · Credential management is a separate dashboard domain
- Workflow Editor → Editor Core: uses · The route renders the editor feature composition
- Editor Core → Workflow Nodes: renders · Editor composes reusable workflow node UI
- Workflow Nodes → React Flow UI: builds on · Workflow nodes are implemented with graph primitives
- Workflow Nodes → Trigger Nodes: includes · Trigger nodes define workflow starts
- Workflow Nodes → Execution Nodes: mirrors · Execution visualization mirrors workflow nodes at runtime
- Editor Core → Workflows Domain: loads · Editor consumes workflow loaders and params
- Workflows Domain → tRPC Core: queries · Workflow data is fetched and mutated via RPC
- Workflows Domain → Prisma DB: persists · Workflow graph state is stored through Prisma
- tRPC Core → Prisma DB: data · RPC handlers read and write via the database layer
- Prisma DB → Schema: modeled by · Prisma schema and migrations define persistence
- Auth Area → Auth Feature: uses · Auth pages are built from shared auth feature components
- Auth Feature → Auth Core: auth · Auth UI depends on shared auth helpers
- Auth Feature → Subscription Gate: gates · Subscription state can gate dashboard access and upgrades
- Subscription Gate → Billing Core: provider · Billing logic is mediated by the Polar integration
- Auth Core → Prisma DB: users · Auth state is persisted in the shared database
- Auth API → Auth Core: implements · Auth API is backed by shared auth utilities
- tRPC API → tRPC Core: serves · The API route exposes the shared RPC router
- Inngest API → Inngest Core: dispatches · The API route hands off to Inngest functions
- Observability → App Shell: instruments · Monitoring and instrumentation wrap the application runtime
- UI Kit → Editor Core: ui · Editor and dashboard screens are composed from shared primitives
- UI Kit → Auth Feature: ui · Auth screens use the same design system
