# saas-kits/remix-boilerplate architecture

> Architecture diagram of the GitHub repository saas-kits/remix-boilerplate, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saas-kits/remix-boilerplate
- Repository: https://github.com/saas-kits/remix-boilerplate

## Overview

##### Main System Components

a) Client Layer
- React/Remix frontend components
- Theme switcher system
- Authentication flows
- Dashboard interface components

b) Server Layer
- Remix server-side components
- Authentication services
- Email service (Resend)
- Stripe integration
- SEO/Robots/Sitemap generators

c) Database Layer
- Prisma ORM
- Database tables (Users, Subscriptions, Plans)

##### Key Architectural Elements

Frontend Architecture:
- UI components library structure
- Theme switching mechanism
- Authentication flow components

Backend Services:
- Authentication service with Google OAuth integration
- Stripe payment processing flow
- Email service for password reset and verification
- Session management system
- Database interactions through Prisma

##### Specific Implementation Details

a) User Flow Paths:
- Authentication routes (/login, /signup, /forgot-password)
- Dashboard access routes
- Payment and subscription flows

b) Service Interactions:
- Stripe webhook handling
- Email service triggers
- Session management
- Theme persistence

##### Component Grouping

Related components:
**Frontend Layer:**
- Public Routes (_index)
- Protected Routes (dashboard)
- Auth Routes (_auth)
- UI Components

**Service Layer:**
- Auth Service
- Email Service
- Stripe Service
- Session Service

**Infrastructure Layer:**
- Database (Prisma)
- External Services

##### Additional Elements

Supporting details:
- Configuration management
- Build process flow
- Development vs Production environments
- Docker container boundaries
- API endpoint structure

This structure will give a complete picture of how the SaaS boilerplate functions while maintaining clarity and usefulness for development team members.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        UI["UI Components"]:::frontend
        Theme["Theme Switcher"]:::frontend
        AuthUI["Auth Components"]:::frontend
        DashUI["Dashboard Interface"]:::frontend
        PricingUI["Pricing Components"]:::frontend
    end

    subgraph Server
        AuthService["Authentication Service"]:::backend
        EmailService["Email Service"]:::backend
        StripeService["Stripe Service"]:::backend
        SessionMgmt["Session Management"]:::backend
        SEO["SEO/Robots/Sitemap"]:::backend
    end

    subgraph Database
        Prisma["Prisma ORM"]:::database
        DBModels["Data Models"]:::database
    end

    subgraph External
        Google["Google OAuth"]:::external
        StripeAPI["Stripe API"]:::external
        ResendAPI["Resend Email"]:::external
    end

    UI --> DashUI
    UI --> AuthUI
    UI --> PricingUI
    Theme --> UI
    
    AuthUI --> AuthService
    AuthService --> SessionMgmt
    AuthService --> Google
    
    DashUI --> SessionMgmt
    DashUI --> StripeService
    
    PricingUI --> StripeService
    
    EmailService --> ResendAPI
    StripeService --> StripeAPI
    
    AuthService --> Prisma
    SessionMgmt --> Prisma
    StripeService --> Prisma
    
    Prisma --> DBModels

    %% Click Events
    click UI "https://github.com/saas-kits/remix-boilerplate/tree/main/app/components/ui/"
    click Theme "https://github.com/saas-kits/remix-boilerplate/blob/main/app/routes/_themeswitcher+/action.set-theme.ts"
    click AuthUI "https://github.com/saas-kits/remix-boilerplate/tree/main/app/routes/_auth+/"
    click DashUI "https://github.com/saas-kits/remix-boilerplate/tree/main/app/routes/dashboard/"
    click PricingUI "https://github.com/saas-kits/remix-boilerplate/tree/main/app/components/pricing/"
    click AuthService "https://github.com/saas-kits/remix-boilerplate/blob/main/app/services/auth.server.ts"
    click EmailService "https://github.com/saas-kits/remix-boilerplate/blob/main/app/services/email/resend.server.ts"
    click StripeService "https://github.com/saas-kits/remix-boilerplate/blob/main/app/services/stripe/stripe.server.ts"
    click SessionMgmt "https://github.com/saas-kits/remix-boilerplate/blob/main/app/services/session.server.ts"
    click SEO "https://github.com/saas-kits/remix-boilerplate/tree/main/app/lib/server/seo/"
    click Prisma "https://github.com/saas-kits/remix-boilerplate/blob/main/prisma/schema.prisma"
    click DBModels "https://github.com/saas-kits/remix-boilerplate/tree/main/app/models/"

    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#9b59b6,stroke:#8e44ad,color:white
    classDef external fill:#f1c40f,stroke:#f39c12,color:black

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Service"]:::backend
        DB["Database Component"]:::database
        Ext["External Service"]:::external
    end
```
