Skip to content

Conversation

@kingston
Copy link
Collaborator

@kingston kingston commented Jul 29, 2025

Summary by CodeRabbit

  • New Features

    • Major overhaul of authentication plugin system: introduces a managed plugin architecture, allowing selection among multiple authentication providers (local, Auth0, placeholder) with improved configuration and UI.
    • Plugins now use a new metadata format and are discovered/configured via package.json, supporting a more flexible plugin management experience.
    • Added migration support to automatically convert existing authentication configurations to the new structure.
    • Enhanced UI with tabbed navigation and grouped display for managed plugins.
  • Bug Fixes

    • Improved reliability of plugin configuration and management, reducing errors related to plugin identification and discovery.
  • Refactor

    • Unified plugin identification to use a consistent key-based system across the platform.
    • Simplified and consolidated authentication configuration schemas and roles management.
    • Removed legacy manifest files and updated plugin metadata handling for better maintainability.
  • Chores

    • Updated dependencies and internal utilities to support new plugin architecture and improved testability.

@vercel
Copy link

vercel bot commented Jul 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
baseplate-project-builder-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 29, 2025 11:25pm

@changeset-bot
Copy link

changeset-bot bot commented Jul 29, 2025

🦋 Changeset detected

Latest commit: 20b753f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 17 packages
Name Type
@baseplate-dev/plugin-auth Major
@baseplate-dev/project-builder-lib Minor
@baseplate-dev/project-builder-web Minor
@baseplate-dev/project-builder-common Minor
@baseplate-dev/project-builder-cli Minor
@baseplate-dev/project-builder-server Minor
@baseplate-dev/project-builder-test Minor
@baseplate-dev/plugin-storage Major
@baseplate-dev/code-morph Minor
@baseplate-dev/core-generators Minor
@baseplate-dev/create-project Minor
@baseplate-dev/fastify-generators Minor
@baseplate-dev/react-generators Minor
@baseplate-dev/sync Minor
@baseplate-dev/tools Minor
@baseplate-dev/ui-components Minor
@baseplate-dev/utils Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Jul 29, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This change implements a comprehensive refactor of the authentication plugin system. It splits the original monolithic auth plugin into a managed plugin architecture, introduces new metadata and configuration schemas, migrates plugin identifiers from "id" to "key", updates plugin discovery to use plugin.json and package-based configuration, and overhauls related UI and migration logic. The update also propagates "key"-based identification across the entire codebase, affecting plugin utilities, server routes, web interfaces, and storage plugins.

Changes

Cohort / File(s) Change Summary
Authentication Plugin Refactor & Managed Architecture
plugins/plugin-auth/src/auth/core/*, plugins/plugin-auth/src/auth0/core/*, plugins/plugin-auth/src/placeholder-auth/core/*, plugins/plugin-auth/src/local-auth/core/*, plugins/plugin-auth/src/common/*, plugins/plugin-auth/src/index.ts, plugins/plugin-auth/src/auth/index.ts, plugins/plugin-auth/src/local-auth/index.ts, plugins/plugin-auth/src/local-auth/plugin.json, plugins/plugin-auth/src/auth/plugin.json, plugins/plugin-auth/src/auth0/plugin.json, plugins/plugin-auth/src/placeholder-auth/plugin.json, plugins/plugin-auth/package.json, plugins/plugin-auth/vite.config.ts, plugins/plugin-auth/manifest.json, plugins/plugin-auth/src/local-auth/core/web.ts, plugins/plugin-auth/src/local-auth/core/node.ts, plugins/plugin-auth/src/local-auth/core/common.ts, plugins/plugin-auth/src/local-auth/core/schema/plugin-definition.ts, plugins/plugin-auth/src/local-auth/core/components/local-auth-definition-editor.tsx, plugins/plugin-auth/src/local-auth/core/generators/*, plugins/plugin-auth/src/local-auth/core/schema/models.ts, plugins/plugin-auth/src/local-auth/core/generators/auth-hooks/templates/src/hooks/*, plugins/plugin-auth/src/auth/utils/*, plugins/plugin-auth/src/auth/utils/get-auth-plugin-definition.ts, plugins/plugin-auth/src/auth/utils/index.ts, plugins/plugin-auth/src/common/components/auth-config-tabs.tsx
Splits the monolithic auth plugin into a managed system with a base plugin and multiple managed implementation plugins (local-auth, auth0, placeholder-auth). Refactors plugin metadata to use plugin.json with key, fullyQualifiedName, and managedBy. Updates configuration schemas, UI components, and plugin exports. Adds migration support and new utility modules. Removes legacy manifest and common compiler code.
Plugin Metadata, Utilities, and Loader Refactor
packages/project-builder-lib/src/plugins/metadata/types.ts, packages/project-builder-lib/src/plugins/plugins.test-utils.ts, packages/project-builder-lib/src/definition/plugins/plugin-utils.ts, packages/project-builder-lib/src/definition/plugins/plugin-utils.unit.test.ts, packages/project-builder-lib/src/plugins/imports/loader.ts, packages/project-builder-lib/src/plugins/imports/loader.unit.test.ts, packages/project-builder-lib/src/plugins/imports/types.ts, packages/project-builder-lib/src/plugins/imports/utils.ts, packages/project-builder-lib/src/plugins/imports/index.ts, packages/project-builder-lib/src/plugins/index.ts, packages/project-builder-lib/src/plugins/manifest/manifest.ts
Renames plugin identifiers from id to key throughout metadata, utilities, and loader logic. Adds new utility functions for plugin management. Removes manifest schema and legacy exports. Updates tests and types for new metadata structure.
Plugin Discovery, Migration, and Parser Updates
packages/project-builder-lib/src/plugin-tools/plugin-loader.ts, packages/project-builder-lib/src/plugin-tools/plugin-loader.unit.test.ts, packages/project-builder-lib/src/parser/parser.ts, packages/project-builder-lib/src/migrations/index.ts, packages/project-builder-lib/src/migrations/migration-017-rename-auth-plugin.ts, .changeset/refactor-auth-plugin-architecture.md, .workspace-meta/config.ts
Refactors plugin discovery to use plugin.json and package.json-based configuration. Adds migration to rename and restructure auth plugin configuration. Updates parser and loader logic for new plugin metadata. Removes manifest-based discovery.
Project Builder Web: Plugin Key Refactor & Managed Plugin UI
packages/project-builder-web/src/routes/plugins/*, packages/project-builder-web/src/services/plugins.ts, packages/project-builder-web/src/services/module-federation.ts, packages/project-builder-web/src/route-tree.gen.ts, packages/project-builder-web/plugins/plugin-dev-server.ts, packages/project-builder-web/vite.config.ts
Refactors plugin identification from id to key throughout web routes, services, and module federation. Updates plugin UI to support managed plugins, grouping, and configuration redirection. Adjusts route parameters and navigation.
Project Builder Web: CRUD/Admin/Model Transformer Key Refactor
packages/project-builder-web/src/routes/apps/edit.$key/web/admin/-components/inputs/*, packages/project-builder-web/src/routes/apps/edit.$key/web/admin/-components/crud-form-fields-form.tsx, packages/project-builder-web/src/routes/data/models/-constants.tsx, packages/project-builder-web/src/routes/data/models/edit.$key/-components/service/service-embedded-relation-form.tsx, packages/project-builder-web/src/routes/data/models/edit.$key/-components/service/service-transformer-form.tsx
Changes all CRUD/admin and model transformer components to use pluginKey instead of pluginId in props and configuration. Updates destructuring, prop passing, and config object keys.
Plugin Spec and Config Schema Updates
packages/project-builder-lib/src/plugins/spec/auth-config-spec.ts, packages/project-builder-lib/src/plugins/spec/auth-model-config-spec.ts, packages/project-builder-lib/src/plugins/spec/config-spec.ts, packages/project-builder-lib/src/plugins/spec/web-config-spec.ts, packages/project-builder-lib/src/plugins/spec/index.ts, packages/project-builder-lib/src/web/specs/admin-crud-input-web-spec.ts, packages/project-builder-lib/src/web/specs/model-transformer-web-spec.ts
Introduces new auth model config spec, updates method parameter names from pluginId to pluginKey in spec interfaces, and adjusts config types and interfaces accordingly.
Storage Plugin: Key Refactor and Manifest Removal
plugins/plugin-storage/src/storage/core/*, plugins/plugin-storage/src/storage/transformers/*, plugins/plugin-storage/src/storage/admin-crud/web.ts, plugins/plugin-storage/package.json, plugins/plugin-storage/manifest.json
Refactors plugin identifier from pluginId to pluginKey across all storage plugin modules. Removes manifest.json and updates package.json/build scripts for new plugin metadata.
Project Builder Core & Generators
packages/core-generators/src/generators/node/typescript/typescript.generator.ts, packages/core-generators/src/generators/node/typescript/typescript.generator.unit.test.ts, packages/react-generators/src/generators/core/react-typescript/react-typescript.generator.ts
Adds isComposite flag to TypeScript generator config, updates build tasks for composite projects, and adjusts React generator to set composite flag.
Project Builder Lib: Mocks and Dev Dependencies
packages/project-builder-lib/package.json, packages/project-builder-lib/src/__mocks__/fs.cts, packages/project-builder-lib/src/__mocks__/fs/promises.cts
Adds memfs as a dev dependency and provides in-memory filesystem mocks for testing.
Server and Miscellaneous
packages/project-builder-server/src/diff/snapshot/snapshot-manifest.ts, packages/project-builder-server/src/plugins/plugin-discovery.unit.test.ts, packages/project-builder-server/src/server/plugin.ts
Updates server-side plugin routes and discovery to use pluginKey instead of pluginId. Ensures directories exist before writing snapshot manifests.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant WebUI as Project Builder Web UI
    participant PluginMgr as Plugin Manager (Base Auth Plugin)
    participant ImplPlugin as Implementation Plugin (e.g., local-auth, auth0)
    participant Config as Config Store

    User->>WebUI: Open Plugins Page
    WebUI->>PluginMgr: List available plugins
    PluginMgr->>ImplPlugin: Discover managed plugins via managedBy
    PluginMgr->>WebUI: Group and display main and managed plugins

    User->>WebUI: Click "Configure" on managed plugin
    WebUI->>PluginMgr: Redirect to manager's config page

    User->>WebUI: Select implementation provider in base auth config
    WebUI->>PluginMgr: Update implementationPluginKey in config
    PluginMgr->>Config: Save configuration
    PluginMgr->>ImplPlugin: Enable selected implementation, disable others

    User->>WebUI: Edit implementation plugin settings
    WebUI->>ImplPlugin: Show provider-specific config UI
    ImplPlugin->>Config: Save provider config
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~90 minutes

Possibly related PRs

  • halfdomelabs/baseplate#549: Migrates Auth0 functionality into a separate plugin and modularizes authentication logic, directly relating to the new managed plugin system and separation of Auth0 as an implementation plugin.
  • halfdomelabs/baseplate#576: Renames UID methods to key methods across multiple packages, mirroring the main PR's migration from "id" to "key" in plugin utilities and metadata.

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kingston/eng-826-refactor-auth-plugin-into-base-implementation-plugins

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@kingston kingston merged commit 85e6413 into main Jul 29, 2025
8 of 9 checks passed
@kingston kingston deleted the kingston/eng-826-refactor-auth-plugin-into-base-implementation-plugins branch July 29, 2025 23:27
@github-actions github-actions bot mentioned this pull request Jul 29, 2025
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.

2 participants