Build and Deploy an N8N & Zapier Clone | Next.js 15, React, Better Auth, Polar | Full Course 2025
By Code With Antonio
Share:
Key Concepts
- Tech Stack: Next.js 15 (App Router), TypeScript, Prisma ORM, Neon (PostgreSQL), Better Auth, Polar (Payments/Subscriptions), Ingest (Background Jobs), React Flow (Visual Canvas), Sentry (Error/AI Monitoring), Code Rabbit (AI PR Reviews).
- Architecture: Data Access Layer (TRPC), Server Components (for speed/prefetching), Client Components (for interactivity), and Background Jobs (for long-running tasks).
- State Management: Jotai (for global editor state), Nooks (for URL-based state management).
- UI/UX: Shadcn UI (Component library), Tailwind CSS v4, Lucide React (Icons).
1. Project Foundation & Setup
The project, Nodebase, is a SaaS workflow automation platform. The setup involves:
- Next.js & Tailwind: Initialized with Turbopack for fast builds. Tailwind v4 is used, which eliminates the need for a separate config file.
- Shadcn UI: Used as the component foundation. The tutorial adds all components (
npx shadcn@latest add --all) to ensure a consistent design system. - Git Workflow: Uses feature branches (e.g.,
01-setup,02-database) and Code Rabbit for AI-powered PR reviews.
2. Database & Data Access Layer
- Prisma & Neon: Prisma serves as the ORM, connected to a serverless Neon PostgreSQL database.
- TRPC: Implemented as the data access layer. It provides end-to-end type safety.
- Security: A
protectedProcedureis implemented in TRPC to ensure only authenticated users can access database queries. ApremiumProcedureis later added to restrict access based on subscription status.
3. Authentication & Payments
- Better Auth: Handles authentication with email/password and social providers. It is configured to automatically create a customer record in Polar upon sign-up.
- Polar: Acts as the Merchant of Record (handling VAT/taxes). It manages subscriptions and usage-based billing.
- Integration: The
createCustomerOnSignUpfeature maps the internal database user ID to Polar’sexternal_id, allowing seamless subscription status checks.
4. Workflow Automation & Background Jobs
- Ingest: Powers background job execution. This is critical for long-running tasks (e.g., AI summarization, API requests) to prevent request timeouts.
- Reliability: Ingest allows for automatic retries and real-time pub/sub messaging, ensuring the UI remains responsive while tasks run in the background.
5. AI Integration & Monitoring
- AI SDK: Integrates OpenAI, Claude, and Gemini.
- Sentry AI Monitoring: Tracks LLM calls, including token counts, cost per request, and execution duration.
- Error Tracking: Sentry is configured for session replays, allowing developers to see exactly what the user clicked when an error occurred.
6. Editor & Canvas (React Flow)
- React Flow: Powers the drag-and-drop canvas.
- Custom Nodes: The editor supports custom node types (Manual Trigger, HTTP Request).
- State Persistence: The editor state (nodes and edges) is transformed between React Flow’s client-side format and Prisma’s database schema. A transaction-based update procedure ensures that when a workflow is saved, existing nodes/connections are cleared and replaced with the new state.
- Search & Pagination: Implemented using Nooks to synchronize URL state (page, search query) with the TRPC backend, enabling shareable and bookmarkable views.
Step-by-Step Methodologies
- Prefetching Strategy: Use server components to prefetch data via TRPC, then hydrate the client-side cache using
HydrationBoundary. This provides the speed of server-side rendering with the interactivity of client-side hooks. - Component Registry: A factory map (
nodeComponents.ts) maps Prisma node types to specific React components, allowing the canvas to render dynamic, custom UI elements based on database records. - Form Handling: Uses
react-hook-formwithzodvalidation for all inputs, including the HTTP request configuration dialogs.
Notable Quotes
- "This isn't just a workflow automation tutorial. This is a complete playbook for building and shipping a real SaaS product."
- "The data access layer is the only security layer... everything else is improved user experience."
Synthesis/Conclusion
Nodebase is built as a production-ready SaaS. By combining TRPC for type-safe data access, Ingest for reliable background processing, and Polar for automated billing, the platform achieves a high level of scalability. The use of React Flow for the visual canvas, coupled with Sentry for observability, ensures that the complex, node-based automation logic remains maintainable and debuggable in a production environment.
Chat with this Video
AI-PoweredLoad the transcript when you're ready to chat so the initial page stays lighter.