Skip to content

ToufikIIT/Nodebase

Repository files navigation

Nodebase

A modern workflow automation platform built with Next.js, featuring AI-powered workflow execution, subscription management, and comprehensive monitoring.

πŸš€ Features

  • Workflow Management: Create, edit, and manage automated workflows
  • AI-Powered Execution: Execute workflows using Google's Gemini AI models
  • User Authentication: Secure authentication with Better Auth (email/password)
  • Subscription Management: Integrated with Polar for subscription handling
  • Background Jobs: Inngest integration for reliable workflow execution
  • Error Monitoring: Sentry integration for error tracking and monitoring
  • Type-Safe API: tRPC for end-to-end type safety
  • Modern UI: Built with shadcn/ui components and Tailwind CSS

πŸ› οΈ Tech Stack

Core

  • Framework: Next.js 15.5.4 (App Router)
  • Language: TypeScript
  • Database: PostgreSQL with Prisma ORM
  • Authentication: Better Auth with Polar integration
  • API: tRPC v11
  • State Management: TanStack Query (React Query)

UI & Styling

  • Components: shadcn/ui (Radix UI primitives)
  • Styling: Tailwind CSS v4
  • Icons: Lucide React
  • Fonts: Geist Sans & Geist Mono

Integrations

  • AI: Google Generative AI (Gemini 2.5 Flash)
  • Background Jobs: Inngest
  • Error Tracking: Sentry
  • Subscriptions: Polar.sh
  • Notifications: Sonner (toast notifications)

Development Tools

  • Linting/Formatting: Biome
  • Process Management: mprocs
  • Package Manager: npm

πŸ“‹ Prerequisites

  • Node.js 20+
  • PostgreSQL database
  • npm, yarn, pnpm, or bun

πŸ—οΈ Project Structure

nodebase/
β”œβ”€β”€ prisma/
β”‚   β”œβ”€β”€ schema.prisma          # Database schema
β”‚   └── migrations/            # Database migrations
β”œβ”€β”€ public/                    # Static assets
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                   # Next.js App Router pages
β”‚   β”‚   β”œβ”€β”€ (auth)/           # Authentication routes
β”‚   β”‚   β”œβ”€β”€ (dashboard)/      # Dashboard routes
β”‚   β”‚   β”‚   β”œβ”€β”€ (editor)/     # Workflow editor
β”‚   β”‚   β”‚   └── (rest)/       # Other dashboard pages
β”‚   β”‚   └── api/              # API routes
β”‚   β”œβ”€β”€ components/           # React components
β”‚   β”‚   └── ui/              # shadcn/ui components
β”‚   β”œβ”€β”€ features/            # Feature modules
β”‚   β”‚   β”œβ”€β”€ auth/           # Authentication
β”‚   β”‚   β”œβ”€β”€ subscription/   # Subscription management
β”‚   β”‚   └── workflows/      # Workflow feature
β”‚   β”œβ”€β”€ generated/          # Generated Prisma client
β”‚   β”œβ”€β”€ hooks/              # React hooks
β”‚   β”œβ”€β”€ inngest/            # Inngest functions
β”‚   β”œβ”€β”€ lib/                # Utility libraries
β”‚   └── trpc/               # tRPC setup and routers
β”œβ”€β”€ biome.json              # Biome configuration
β”œβ”€β”€ components.json         # shadcn/ui configuration
β”œβ”€β”€ mprocs.yaml            # Process management config
└── next.config.ts         # Next.js configuration

🚦 Getting Started

1. Clone the repository

git clone <repository-url>
cd nodebase

2. Install dependencies

npm install

3. Set up environment variables

Create a .env file in the root directory with the following variables:

# Database
DATABASE_URL="postgresql://user:password@localhost:5432/nodebase"

# Better Auth
BETTER_AUTH_SECRET="your-secret-key"
BETTER_AUTH_URL="http://localhost:3000"

# Polar (Subscription Management)
POLAR_ACCESS_TOKEN="your-polar-access-token"
POLAR_WEBHOOK_SECRET="your-polar-webhook-secret"
POLAR_SUCCESS_URL="http://localhost:3000/dashboard"

# Google AI (Gemini)
GOOGLE_GENERATIVE_AI_API_KEY="your-google-ai-api-key"

# Sentry (Error Tracking)
SENTRY_DSN="your-sentry-dsn"
SENTRY_ORG="js-mastery-x1"
SENTRY_PROJECT="nodebase"
SENTRY_AUTH_TOKEN="your-sentry-auth-token"

# Inngest
INNGEST_EVENT_KEY="your-inngest-event-key"
INNGEST_SIGNING_KEY="your-inngest-signing-key"

4. Set up the database

# Generate Prisma client
npx prisma generate

# Run migrations
npx prisma migrate dev

# (Optional) Open Prisma Studio to view data
npx prisma studio

5. Run the development server

Option 1: Run all services (Next.js + Inngest)

npm run dev:all

Option 2: Run services separately

Terminal 1 - Next.js:

npm run dev

Terminal 2 - Inngest Dev Server:

npm run inngest:dev

6. Open your browser

Navigate to http://localhost:3000

The app will automatically redirect to /workflows (configured in next.config.ts).

πŸ“œ Available Scripts

  • npm run dev - Start Next.js development server with Turbopack
  • npm run build - Build the application for production
  • npm run start - Start the production server
  • npm run lint - Run Biome linter
  • npm run format - Format code with Biome
  • npm run inngest:dev - Start Inngest development server
  • npm run dev:all - Run all services using mprocs

πŸ—„οΈ Database Schema

The application uses the following main models:

  • User: User accounts with authentication
  • Session: User sessions for authentication
  • Account: OAuth and email/password accounts
  • Verification: Email verification tokens
  • Workflow: User-created workflows

πŸ” Authentication

The app uses Better Auth with:

  • Email/password authentication
  • Auto sign-in after registration
  • Session management
  • Integration with Polar for subscription-based features

πŸ’³ Subscription Management

Subscription features are managed through Polar.sh:

  • Checkout flow for "Nodebase-Pro" subscription
  • Customer portal access
  • Webhook handling for subscription events

πŸ€– Workflow Execution

Workflows are executed using Inngest functions with AI integration:

  • Background job processing
  • Google Gemini AI for workflow steps
  • Telemetry and monitoring

🎨 UI Components

The project uses shadcn/ui components built on Radix UI primitives. All components are located in src/components/ui/.

πŸ” Error Monitoring

Sentry is configured for:

  • Client-side error tracking
  • Server-side error tracking
  • Source map uploads
  • Performance monitoring

πŸ“ Code Quality

  • Linting: Biome for fast linting and formatting
  • Type Safety: Full TypeScript coverage
  • API Safety: tRPC for type-safe API calls

🚒 Deployment

Build for production

npm run build

Environment Variables

Ensure all environment variables are set in your production environment.

Database Migrations

Run migrations in production:

npx prisma migrate deploy

πŸ“š Key Integrations

  • Better Auth: Authentication and session management
  • Polar.sh: Subscription and payment processing
  • Inngest: Background job processing
  • Sentry: Error tracking and monitoring
  • Google AI: AI-powered workflow execution
  • tRPC: Type-safe API layer

🀝 Contributing

  1. Create a feature branch
  2. Make your changes
  3. Run linting and formatting: npm run lint && npm run format
  4. Submit a pull request

Built with using Next.js, TypeScript, and modern web technologies.

About

A modern workflow automation platform built with Next.js, featuring AI-powered workflow execution, subscription management, and comprehensive monitoring.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Β 
Β 
Β 

Contributors

Languages