Skip to content

feat: Phase 10 - Database Provider Adapter Layer#15

Merged
weroperking merged 1 commit intomainfrom
docs/enhanced-codebase-documentation
Feb 21, 2026
Merged

feat: Phase 10 - Database Provider Adapter Layer#15
weroperking merged 1 commit intomainfrom
docs/enhanced-codebase-documentation

Conversation

@weroperking
Copy link
Copy Markdown
Owner

@weroperking weroperking commented Feb 21, 2026

  • Add provider adapters for Neon, Turso, PlanetScale, Supabase, Postgres
  • Implement ProviderAdapter interface with connect(), getMigrationsDriver(), supportsRLS(), supportsGraphQL()
  • Add CLI integration with provider prompts for database selection
  • Add Drizzle config generation for each provider type
  • Add provider-specific Zod schemas for configuration validation
  • Add helper functions: providerSupportsRLS(), getProviderDialect()
  • Fix missing @neondatabase/serverless dependency for Neon provider
  • Add explicit driver 'pg' for Supabase Drizzle config

Summary by CodeRabbit

  • New Features

    • Expanded database provider support with streamlined selection during setup.
    • Comprehensive roadmap documentation for upcoming capabilities: Row-Level Security, GraphQL API generation, Webhooks, S3-compatible storage, and Edge Functions.
  • Improvements

    • Enhanced configuration schema to prepare for future storage and webhook features.
    • Improved initialization flow with better provider-specific setup prompts.

- Add provider adapters for Neon, Turso, PlanetScale, Supabase, Postgres
- Implement ProviderAdapter interface with connect(), getMigrationsDriver(), supportsRLS(), supportsGraphQL()
- Add CLI integration with provider prompts for database selection
- Add Drizzle config generation for each provider type
- Add provider-specific Zod schemas for configuration validation
- Add helper functions: providerSupportsRLS(), getProviderDialect()
- Fix missing @neondatabase/serverless dependency for Neon provider
- Add explicit driver 'pg' for Supabase Drizzle config
@weroperking weroperking merged commit 6e6ac59 into main Feb 21, 2026
1 check was pending
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 21, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This pull request introduces a comprehensive blueprint for BetterBase v3 Phases 10–15 and implements foundational infrastructure for provider-agnostic database adapters. It refactors the CLI initialization flow with modular provider prompts, adds adapter implementations for Neon, Turso, PlanetScale, Supabase, and PostgreSQL, and establishes configuration generation helpers for Drizzle and environment setup. The core configuration schema is extended to support optional storage, webhooks, and GraphQL sections.

Changes

Cohort / File(s) Summary
Blueprint & Documentation
betterbase_blueprint_v3.md
Comprehensive multi-phase roadmap detailing Phases 10–15 including provider adapters, RLS, GraphQL, webhooks, S3 storage, and edge functions with architectural notes and implementation examples.
CLI Provider System
packages/cli/src/commands/init.ts, packages/cli/src/utils/provider-prompts.ts
Refactored CLI init to delegate provider selection and credential gathering to a new modular promptForProvider utility; removed inline provider logic; added support for 'managed' provider type; integrated generateDrizzleConfig for dynamic config generation per provider.
Core Configuration Schema & Generation
packages/core/src/config/schema.ts, packages/core/src/config/drizzle-generator.ts, packages/core/src/config/index.ts
Extended BetterBaseConfig schema with optional storage, webhooks, and graphql sections; added provider validation (Turso requires url/authToken; others require connectionString); introduced generateDrizzleConfig and dialect/driver mapping utilities; re-exported full config API surface.
Provider Types & Abstractions
packages/core/src/providers/types.ts, packages/core/src/providers/index.ts
Defined DatabaseDialect type and comprehensive ProviderConfigSchema with discriminated unions for each provider; added DrizzleMigrationDriver interfaces; enhanced ProviderAdapter with concrete connect/getMigrationsDriver methods; introduced validation helpers and factory utilities for provider resolution.
Provider Implementations
packages/core/src/providers/neon.ts, packages/core/src/providers/turso.ts, packages/core/src/providers/planetscale.ts, packages/core/src/providers/supabase.ts, packages/core/src/providers/postgres.ts
Added provider adapters for Neon (PostgreSQL serverless), Turso (libSQL), PlanetScale (MySQL), Supabase (PostgreSQL), and Postgres; each includes connection wrapper, migration driver stub, and RLS/GraphQL capability flags.
Dependencies & Templates
packages/core/package.json, templates/base/betterbase.config.ts
Added provider-specific client dependencies (@neondatabase/serverless, @libsql/client, @planetscale/database, postgres); replaced schema-based template config with concrete default export using satisfies BetterBaseConfig.

Sequence Diagram

sequenceDiagram
    participant User as User
    participant CLI as CLI Init
    participant ProviderPrompt as Provider Prompt
    participant ConfigGen as Config Generator
    participant Provider as Provider Adapter

    User->>CLI: Run init command
    CLI->>ProviderPrompt: promptForProvider()
    ProviderPrompt->>ProviderPrompt: Display provider options
    User->>ProviderPrompt: Select provider (e.g., Neon)
    ProviderPrompt->>ProviderPrompt: Prompt for credentials
    User->>ProviderPrompt: Enter DATABASE_URL
    ProviderPrompt-->>CLI: Return {providerType, envVars}
    
    CLI->>ConfigGen: generateDrizzleConfig(providerType)
    ConfigGen->>ConfigGen: Map provider → dialect & driver
    ConfigGen-->>CLI: Return drizzle.config.ts content
    
    CLI->>ConfigGen: generateEnvContent(providerType, envVars)
    ConfigGen-->>CLI: Return .env content
    
    CLI->>Provider: resolveProvider(config)
    Provider->>Provider: Validate config schema
    Provider-->>CLI: Return NeonProviderAdapter instance
    
    CLI->>User: Scaffolding complete
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • PR #3 — Introduces initial CLI init scaffolding that this PR refactors and extends with the provider-prompts system and dynamic config generation.
  • PR #12 — Modifies core configuration schema validation, particularly Turso-specific superRefine logic that overlaps with schema.ts changes.
  • PR #11 — Establishes provider scaffolding stubs that this PR materializes into concrete adapter implementations and factory utilities.

Suggested labels

codex

Poem

🐰 A rabbit's ode to the provider garden:

From Neon's glow to Turso's flight,
PostgreSQL and Supabase bright,
PlanetScale dancing in MySQL's delight—
Adapters bloom in the schema's light! 🌱✨

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/enhanced-codebase-documentation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant