Full stack SaaS ScrapeFlow: NextJs course with React, Typescript , React-Flow, Prisma, ReactQuery

4 min read 8 hours ago
Published on Sep 06, 2025 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

This tutorial will guide you through building a full-stack SaaS application using ScrapeFlow, which utilizes technologies such as Next.js, React, TypeScript, Prisma, and React Query. You'll set up authentication, a database, and various workflows, while also learning to handle tasks like scraping data and managing user credentials. This comprehensive guide will break down the project into manageable steps, making it easier for you to follow along.

Step 1: Project Setup

  1. Create a new Next.js project.
  2. Install necessary dependencies:
    • React
    • TypeScript
    • Prisma
    • React Query
  3. Set up your file structure to accommodate components, pages, and utilities.

Step 2: Auth Setup

  1. Integrate Clerk for user authentication.
    • Use Clerk's documentation for detailed setup instructions.
  2. Configure authentication routes and components to manage user sessions.

Step 3: Database Setup

  1. Initialize Prisma in your project.
  2. Create your database schema in schema.prisma.
  3. Run migrations to set up the database tables.

Step 4: Building the Workflows Page

  1. Create a new page for managing workflows.
  2. Add components to display existing workflows and a button to create new ones.
  3. Implement state management using React Query to fetch workflows from your database.

Step 5: Workflow Card Implementation

  1. Design a card component to represent each workflow.
  2. Include options to view, edit, or delete the workflow.

Step 6: Delete Workflow Dialog

  1. Create a confirmation dialog that prompts users when they attempt to delete a workflow.
  2. Implement the necessary logic to remove the workflow from the database.

Step 7: Workflow Functionality

  1. Set up the main workflow logic, allowing users to create and customize workflows.
  2. Implement features such as adding tasks and connecting nodes.

Step 8: Extract Text from Element Task

  1. Create a task component for scraping text from specified elements on a webpage.
  2. Provide fields for users to input selectors and other necessary parameters.

Step 9: Node Component Design

  1. Build a reusable node component that can represent various tasks in a workflow.
  2. Ensure it can handle inputs and outputs dynamically.

Step 10: Task and Node Inputs

  1. Define input fields for tasks and nodes.
  2. Validate user input to ensure correct data types are submitted.

Step 11: Save Button Functionality

  1. Implement a save button to persist workflow changes.
  2. Ensure it communicates with your backend to update the database.

Step 12: Task Menu Creation

  1. Develop a menu for users to select different types of tasks to add to workflows.
  2. Include options for tasks like "Click Element", "Wait for Element", and others.

Step 13: Task and Node Outputs

  1. Define how outputs from tasks can be used in subsequent nodes.
  2. Implement logic to handle data flow between tasks.

Step 14: Deletable Edge Implementation

  1. Allow users to create connections between tasks and delete them as needed.

Step 15: Validate Connections

  1. Implement validation to ensure that task connections are logical and functional.

Step 16: Workflow Execution

  1. Set up the backend to execute workflows.
  2. Create a user interface for monitoring execution progress.

Step 17: Log Collector

  1. Implement a logging system to track workflow executions and errors.
  2. Provide users access to view logs for debugging.

Step 18: User Balance Management

  1. Track user credits or balance for running workflows.
  2. Implement a system to deduct credits based on usage.

Step 19: Workflow Publishing and Unpublishing

  1. Create options for users to publish or unpublish workflows.
  2. Ensure published workflows are accessible to other users.

Step 20: Execution Scheduler

  1. Develop a scheduling feature for automated workflow execution.

Step 21: Task Implementation Examples

  1. Implement various tasks such as:
    • Fill Input Task
    • Click Element Task
    • Wait for Element Task
    • Deliver via Webhook Task
    • Extract Data with AI Task

Step 22: Handling JSON

  1. Create tasks for reading and modifying JSON data.
    • Use the following code snippet as a reference for reading properties:
    const property = jsonData.propertyName;
    

Step 23: Bypass Scraping Protections

  1. Implement strategies to navigate around anti-scraping measures, ensuring compliance with regulations.

Step 24: User Account Setup

  1. Guide users through setting up their accounts and managing their profiles.

Step 25: Billing Integration

  1. Integrate Stripe for payment processing.
  2. Set up billing pages to manage subscriptions and payment history.

Conclusion

In this tutorial, you learned how to build a full-stack SaaS application with ScrapeFlow using Next.js and related technologies. You set up user authentication, a database, and workflows while implementing various tasks for web scraping. For next steps, consider enhancing the user interface and exploring more advanced features, such as AI-driven data extraction or additional integrations. Explore the provided resources for source code and support as you continue your development journey.