Skip to content

feat: M3 - Implement Node & Web SDKs with React Hooks#2

Merged
reckziegelwilliam merged 5 commits intomainfrom
feat/m3-sdks
Dec 2, 2025
Merged

feat: M3 - Implement Node & Web SDKs with React Hooks#2
reckziegelwilliam merged 5 commits intomainfrom
feat/m3-sdks

Conversation

@reckziegelwilliam
Copy link
Owner

Summary

Implements Milestone 3 (M3) - Node.js and Web/Browser SDKs for Togglekit feature flags.

Changes

Node SDK (@togglekit/flags-client-node)

  • ✅ Ergonomic client API with createFlagClient factory function
  • ✅ Config fetching from API with authentication
  • ✅ In-memory config caching
  • ✅ Automatic periodic refresh (configurable interval)
  • ✅ Static config mode for testing/development
  • ✅ Error handling and graceful degradation
  • ✅ Full TypeScript support
  • ✅ 25 comprehensive tests (100% passing)

Web SDK (@togglekit/flags-client-web)

  • ✅ Browser-compatible client with fetch support
  • ✅ Bootstrap mode for SSR (synchronous initialization)
  • ✅ Optional async API fetch mode
  • ✅ Config update subscriptions and listeners
  • ✅ React hooks: useFlag, useFlagVariant, useFlagKeys, useFlagExists
  • FlagProvider context provider
  • ✅ Automatic re-renders on config updates
  • ✅ Full TypeScript support
  • ✅ 41 comprehensive tests (100% passing, 1 skipped)

Documentation

  • ✅ Comprehensive README for Node SDK with examples
  • ✅ Comprehensive README for Web SDK with React examples
  • ✅ API reference documentation
  • ✅ SSR examples (Next.js)
  • ✅ Updated root README

Testing

  • Node SDK: 25 tests passing
  • Web SDK: 41 tests passing, 1 skipped
  • Total: 66 tests passing
  • Coverage: >80% for all packages

Breaking Changes

None - this is a new feature.

Related Issues

Closes milestone M3 as defined in PLAN.md

Checklist

  • Code follows project conventions
  • Tests added and passing
  • Documentation updated
  • TypeScript types included
  • No linting errors
  • Conventional commit messages used

- Implement Node.js SDK with config fetching, caching, and auto-refresh
- Implement Web/Browser SDK with bootstrap mode for SSR
- Add React hooks (useFlag, useFlagVariant, useFlagKeys, useFlagExists)
- Add comprehensive test suites (25 tests for Node, 41 tests for Web)
- Add full documentation with examples and API reference
- Support both static config and API-based config loading
- Automatic refresh capabilities with configurable intervals
- Config update subscriptions and event listeners
- Update ESLint configs to be standalone instead of extending non-existent root config
- Add TypeScript composite project references for proper monorepo builds
- Add jsx flag to web SDK tsconfig
- Add eslint-disable comments for necessary any type usage
- All packages now lint and build successfully
- Remove accidentally committed .d.ts and .js files from src/ directories
- Add .gitignore files to each package to prevent committing generated files
- Update ESLint configs to ignore any generated .d.ts and .js files
- Generated files should only exist in dist/ directory, not src/
- Quote PR_BODY variable in pr-checks workflow
- Prevents backticks and special chars in PR description from being executed
- Fixes PR validation job failure
- Use heredoc with quoted delimiter (EOF) to safely capture PR body
- Prevents backticks and other special characters from being executed
- Previous fix only quoted usage, not assignment where injection occurs
@reckziegelwilliam reckziegelwilliam merged commit 55248c6 into main Dec 2, 2025
14 checks passed
@reckziegelwilliam reckziegelwilliam deleted the feat/m3-sdks branch December 2, 2025 04:13
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