Module Deep Dives

Understanding Our React Marketplace's Architecture

This section provides comprehensive deep dives into each type of module in our React marketplace.

Remember: This is our marketplace's organizational structure. Your marketplace can organize modules differently (Level 1 Personalization).


🎯 What You'll Learn

Each deep-dive page explains:

  • What the module type is
  • Why we need it
  • When to use it
  • How it works
  • Real examples from our marketplace

πŸ“š Available Deep Dives

Adapters Deep Dive β†’

Universal SDK Configuration (Framework-Agnostic)

Learn about:

  • What adapters are and why they exist
  • Framework-agnostic principle
  • When to create an adapter
  • Real examples: Better Auth, Stripe, Vercel AI SDK
  • How connectors import from adapters

Key Concept: Adapters configure SDKs universally, without framework coupling.


Connectors Deep Dive β†’

SDK + Framework Integration

Learn about:

  • What connectors are and why they exist
  • The Adapter β†’ Connector pattern
  • When to create a connector
  • Backend Overwrites Hooks pattern (priority system)
  • Real examples: better-auth-nextjs, stripe-nextjs-drizzle
  • Category-first organization

Key Concept: "A connector cannot exist without the adapters it tries to connect."


Features Deep Dive β†’

Complete Business Capabilities

Learn about:

  • Backend / Tech-Stack / Frontend structure
  • When backend is needed (decision tree!)
  • All integration patterns (SDK, API, Custom)
  • Tech-Stack as the contract layer
  • Real examples: Auth, Payments, Teams
  • Backend Overwrites Hooks pattern

Key Concept: Features use 3 layers with tech-stack as single source of truth.


πŸ”„ How They Work Together

The Flow:

1. Adapter (Universal)

adapters/auth/better-auth/
β”œβ”€β”€ config.ts          (Universal Better Auth config)
β”œβ”€β”€ client.ts          (Auth client)
└── types.ts           (Core auth types)

β†’ Deployed to: src/lib/auth/
β†’ Framework-agnostic: Works with Next.js, Remix, etc.

2. Connector (Framework-Specific)

connectors/auth/better-auth-nextjs/
β”œβ”€β”€ config.ts          (Imports adapter, adds Next.js plugins)
β”œβ”€β”€ api/route.ts       (Next.js API routes)
β”œβ”€β”€ middleware.ts      (Next.js middleware)
└── hooks.ts           (SDK-native hooks, priority 2)

β†’ Requires: adapters/auth/better-auth
β†’ Provides: Next.js-specific integration

3. Feature (Business Logic)

features/auth/
β”œβ”€β”€ tech-stack/        (Schemas, types, generic hooks, UI stores)
└── frontend/shadcn/   (UI components)

❌ No backend/ needed (connector handles it!)

πŸ“‹ Quick Reference

Module TypePurposeFramework-Specific?RequiresExample
AdapterConfigure SDK universally❌ No-adapters/auth/better-auth/
ConnectorIntegrate SDK + Frameworkβœ… YesAdaptersconnectors/auth/better-auth-nextjs/
FeatureDeliver business capability⚠️ Frontend onlyAdapters/Connectorsfeatures/auth/

🎯 Common Questions

Q: When do I create an adapter vs connector?

Adapter:

  • βœ… Configuring a new SDK/library
  • βœ… Want framework-agnostic setup
  • βœ… Can be reused across frameworks
  • Example: adapters/auth/better-auth/

Connector:

  • βœ… Integrating SDK with specific framework
  • βœ… Need framework-specific code (API routes, middleware)
  • βœ… Want to provide SDK-native hooks
  • Example: connectors/auth/better-auth-nextjs/

Q: When do I need a backend in my feature?

Backend NOT needed (❌):

  • SDK + connector handle everything
  • Example: Auth with Better Auth

Backend OPTIONAL (⚠️):

  • External API provides core functionality
  • Only need custom business logic
  • Example: Payments with Stripe

Backend REQUIRED (βœ…):

  • No SDK available
  • Custom business logic needed
  • Example: Teams Management

β†’ See Features Deep Dive for decision tree!

Q: What's the Backend Overwrites Hooks pattern?

Tech-stack provides generic hooks (priority 1):

// features/auth/tech-stack/hooks.ts
export function useSession() {
  return useQuery({ /* generic fetch */ });
}

Connector provides SDK-native hooks (priority 2 - WINS!):

// connectors/auth/better-auth-nextjs/hooks.ts
export { useSession } from '@/lib/auth/client';  // Better Auth native

β†’ Frontend imports from @/lib/auth and gets the best version available!

β†’ See Connectors Deep Dive for details!


πŸš€ Where to Start?

I want to understand adapters

β†’ Adapters Deep Dive

I want to understand connectors

β†’ Connectors Deep Dive

I want to understand features

β†’ Features Deep Dive

I want the big picture

β†’ Architecture & Concepts


πŸ’‘ Why Deep Dives Matter

Problem: Main architecture page was getting too long and verbose.

Solution: Dedicated deep-dive pages for each module type.

Benefit:

  • βœ… Main architecture page stays concise
  • βœ… Users can choose their depth
  • βœ… All patterns explained with real examples
  • βœ… No redundancy or conflicts

πŸŽ“ Learning Path

Quick Overview (15 minutes):

  1. Read Architecture & Concepts Parts 1-3
  2. Understand the big picture
  3. Done!

Deep Understanding (1-2 hours):

  1. Read Architecture & Concepts
  2. Deep dive into Adapters
  3. Deep dive into Connectors
  4. Deep dive into Features
  5. Understand all patterns and examples
  6. Done!

You choose your depth! βœ…


πŸ“š Next Steps


Choose a deep dive above to get started! πŸš€