Modular and extensible library for managing feature flags using Redis as storage. Based on Domain-Driven Design (DDD) principles and Hexagonal Architecture.
- ✅ Feature flag management: activate, deactivate, create, delete, retrieve.
- 🧱 Hexagonal architecture (ports and adapters).
- 🧠 Clear separation between domain, application, and infrastructure.
- 🔌 Redis storage (can be extended to others).
- 📦 Packaged as a library for reuse in multiple projects.
- 🧪 Tested with Vitest.
- ⚙️ Written in TypeScript and compatible with ESM/CJS.
npm install fflags-lib
- Use the use cases
import { Redis } from 'ioredis';
import { ManagerService } from "fflags-lib";
const redis = new Redis();
const managerService = ManagerService.getInstance(redis)
let flag = await managerService.createFlag('test', true, 'test flag')
flag = await managerService.getFlag('test')
flag = await managerService.deactivateFlag('test')
flag = await managerService.activateFlag('test')
flag = await managerService.deleteFlag('test')
flag = await managerService.getAllFlags()
flag = await managerService.getActivatedFlags()
flag = await managerService.getInactiveFlags()
npm run test
To use with your own paths or tools, check:
• tsconfig.json with configured baseUrl and paths.
• tsup.config.ts for bundling.
• vitest.config.ts for tests.
- Node.js 18+
- Redis 6+
- ioredis 5+