Skip to content

Conversation

@talissoncosta
Copy link
Contributor

@talissoncosta talissoncosta commented Dec 19, 2025

Summary

Migrate the Flagsmith plugin to use Backstage's new frontend system as the default export, replacing the legacy createPlugin API.

Closes #6421

Changes

  • Remove legacy frontend system files (plugin.ts, routes.ts)
  • Use createFrontendPlugin from @backstage/frontend-plugin-api as the default export
  • Implement EntityContentBlueprint for the flags tab
  • Implement EntityCardBlueprint for overview and usage cards
  • Remove separate /alpha export path (new system is now the default)

Breaking Changes

  • Plugin now requires Backstage apps using the new frontend system
  • Legacy flagsmithPlugin named export removed
  • Direct component exports removed from package root

Test plan

  • yarn build passes
  • yarn start runs dev server successfully
  • Test in a Backstage app with new frontend system

🤖 Generated with Claude Code

talissoncosta and others added 12 commits December 17, 2025 08:25
- Remove backend plugin (src/service/) in favor of Backstage proxy
- Update FlagsmithClient to use proxy endpoint (/proxy/flagsmith)
- Add lazy loading for feature details (versions, states) on accordion expand
- Reduce initial API calls from 35 to 1 for improved performance
- Update README with proxy configuration instructions
- Remove backend dependencies from package.json

Closes Flagsmith/flagsmith#6420

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add husky and lint-staged for pre-commit linting
- Configure lint-staged to run ESLint on staged .ts/.tsx files
- Add GitHub Actions CI workflow for lint and build checks
- Fix lint errors (radix, nested ternary, icon imports, etc.)
- Add tsconfig.json for TypeScript configuration
- Remove unused FlagsmithAdminService.ts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update tsconfig.json with proper exclusions and type definitions
- Change build:all script to check if declaration files were generated
- This approach safely handles node_modules TypeScript errors while
  still failing if our source code has actual type errors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace complex shell script with simpler fallback:
- Run tsc (may show errors from node_modules)
- Fall back to checking if declaration files were generated
- This handles the react-markdown type errors gracefully

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Runs lint, TypeScript check, and build in parallel for faster CI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add MSW mock handlers for Flagsmith API responses
- Create mock entity with Flagsmith annotations
- Update dev/index.tsx with entity provider and mock setup
- Add app-config.yaml for dev server configuration
- Add public/mockServiceWorker.js for MSW browser support
- Add .devcontainer for GitHub Codespaces preview
- Add react-dom and react-router-dom dev dependencies

Preview the plugin:
- Run `yarn start` locally
- Or use GitHub Codespaces from the PR

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add undefined checks alongside null checks to prevent
"Cannot read properties of undefined (reading 'toString')"
error when feature_state_value properties are undefined.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This method was a leftover from the old backend plugin architecture.
With the proxy approach, we just use getProjectFeatures directly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…-use

Detected with knip - these packages were not imported anywhere in the codebase.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add trailing newline to package.json
- Add /dist-demo to .gitignore

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements #6421 - adds `/alpha` export path that uses Backstage's new
declarative frontend system while maintaining backward compatibility with
the existing legacy export.

Changes:
- Add `@backstage/frontend-plugin-api` dependency
- Create `src/alpha.ts` with new frontend system plugin using:
  - EntityContentBlueprint for FlagsTab
  - EntityCardBlueprint for FlagsmithOverviewCard and FlagsmithUsageCard
- Add exports and typesVersions configuration to package.json

Usage:
- Legacy: `import { flagsmithPlugin } from '@internal/plugin-flagsmith'`
- Alpha: `import flagsmithPlugin from '@internal/plugin-flagsmith/alpha'`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
talissoncosta and others added 5 commits December 22, 2025 21:56
Remove plugin.ts, routes.ts, and plugin.test.ts that were part of
the legacy Backstage frontend system using createPlugin API.

BREAKING CHANGE: Legacy plugin export removed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Consolidate alpha.ts into index.ts as the main plugin export.
The plugin now uses createFrontendPlugin with EntityContentBlueprint
and EntityCardBlueprint from the new Backstage frontend system.

Exports:
- default: flagsmithPlugin (new frontend system)
- flagsmithPlugin: named export for compatibility
- FlagsTab, FlagsmithOverviewCard, FlagsmithUsageCard: components

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove the separate /alpha export since the new frontend system
is now the default export at the package root.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove registerPlugin call since the new frontend system plugin
is not compatible with the legacy dev-utils registerPlugin API.
Components are rendered directly via addPage instead.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Keep only the default plugin export. The new frontend system
handles component registration via blueprints automatically.

Dev server now imports components directly from their files.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@talissoncosta talissoncosta changed the title Add /alpha export with Backstage new frontend system Migrate to Backstage new frontend system Dec 23, 2025
@talissoncosta talissoncosta linked an issue Dec 23, 2025 that may be closed by this pull request
Zaimwa9
Zaimwa9 previously approved these changes Jan 5, 2026
@talissoncosta talissoncosta changed the base branch from feat/6420-proxy-architecture-lazy-loading to main January 5, 2026 15:14
@talissoncosta talissoncosta dismissed Zaimwa9’s stale review January 5, 2026 15:14

The base branch was changed.

@talissoncosta talissoncosta merged commit 3f56baf into main Jan 5, 2026
3 checks passed
@talissoncosta talissoncosta deleted the feat/6421-alpha-export branch January 5, 2026 15:20
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.

Migrate to Backstage new frontend system

3 participants