mirror of
https://github.com/xtr-dev/payload-feature-flags.git
synced 2025-12-08 00:13:23 +00:00
- Updated all @payloadcms/* dependencies from 3.37.0 to 3.56.0 - Implemented DefaultTemplate from @payloadcms/next/templates with proper props structure - Fixed TypeScript compilation by adding proper Locale type import - Feature flags admin interface now wrapped in PayloadCMS default admin layout with navigation sidebar - Verified build process works with updated dependencies 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Demo Environment
Simple demo for testing the feature flags plugin.
Quick Start
pnpm install
pnpm dev
# Visit http://localhost:3000
URLs:
- Home: http://localhost:3000
- Admin: http://localhost:3000/admin
- API: http://localhost:3000/api/feature-flags
Login
Admin: dev@payloadcms.com / test (full access)
Editor: editor@payloadcms.com / test123 (limited access)
User: user@payloadcms.com / test123 (read-only)
What's included
Homepage: Shows feature flag status and demo content
Admin Panel: Manage feature flags and users
Sample Data: One test feature flag ready to use
Testing the Plugin
- Check the homepage - See the feature flag in action
- Login to admin - Use admin credentials above
- Toggle the flag - Go to Feature Flags collection
- Refresh homepage - See content appear/disappear
Plugin Config
payloadFeatureFlags({
enableRollouts: true, // Percentage rollouts
enableVariants: true, // A/B testing
defaultValue: false, // New flags start disabled
// + custom fields and permissions
})
API Testing
The plugin uses Payload's native REST API:
# Get all flags
curl http://localhost:3000/api/feature-flags
# Query specific flag
curl 'http://localhost:3000/api/feature-flags?where[name][equals]=new-feature'
# Get only enabled flags
curl 'http://localhost:3000/api/feature-flags?where[enabled][equals]=true'
Database
Uses in-memory MongoDB - no setup needed! Data resets on each restart.
Creating New Flags
- Login to
/admin/collections/feature-flags - Click "Create New"
- Add name, description, and toggle enabled/disabled
- Check the homepage to see it working
Need Help?
- Check the console for error messages
- Make sure port 3000 is available
- Try logging in as admin user
Next Steps
Ready to use this in your project?
- Add to your project: Copy the plugin config
- Customize: Add your own fields and permissions
- Go live: Use a real MongoDB database
- Monitor: Track how your flags perform
This demo gives you everything needed to test feature flags with zero setup.