https://github.com/kasir-barati/flagd-nestjs
A NestJS wrapper around flagd.
https://github.com/kasir-barati/flagd-nestjs
docker flagd nestjs openfeature
Last synced: 28 days ago
JSON representation
A NestJS wrapper around flagd.
- Host: GitHub
- URL: https://github.com/kasir-barati/flagd-nestjs
- Owner: kasir-barati
- Created: 2026-03-29T22:03:07.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-04-01T19:27:32.000Z (3 months ago)
- Last Synced: 2026-04-02T05:45:23.115Z (3 months ago)
- Topics: docker, flagd, nestjs, openfeature
- Language: TypeScript
- Homepage: https://hub.docker.com/r/9109679196/flagd-nestjs
- Size: 153 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
# flagd-nestjs
| `PORT` | NestJS server port | `3000` |
| `SWAGGER_PATH` | Swagger UI path | `api` |
A NestJS wrapper around [flagd](https://flagd.dev/) for feature flag management with persistent storage. It bundles a NestJS REST API for CRUD operations on feature flags with a co-located flagd process that serves evaluated flags over **gRPC** and **[OFREP](https://github.com/open-feature/protocol)/HTTP** — all inside a single Docker image.
## How It Works
```
╭───────────────────────────────────────────────────────────╮
│ 🐳 Docker Container │
│ ╭───────────────────────╮ ╭─────────────────────╮ │
│ │ 🐈 NestJS REST API │ │ 🚩 flagd │ │
│ │ (CRUD operations) │◄─────│ (Flag evaluation) │ │
│ │ - Port: 3000 │ poll │ - gRPC: 8013 │ │
│ ╰──────────┬────────────╯ │ - OFREP: 8016 │ │
│ │ ▲ ╰──────────┬──────────╯ │
╰─────────────┼─────────┼────────────────────┼──────────────╯
▼ │ ▼
╭─────────────╮ │ ╭──────────────╮
│ 💾 Database │ │ │ 👤 Client │
╰─────────────╯ │ │ (Frontend or │
│ │ Backend) │
│ │ via SDK │
│ ╰──────┬───────╯
└───────────────────┘
Flag Definitions
```
1. **NestJS** exposes a REST API to create, read, update, and delete feature flags, persisting them to a database via TypeORM.
2. **NestJS** also serves a `/flagd/flags.json` sync endpoint that renders all stored flags in the [flagd flag definition format](https://flagd.dev/reference/flag-definitions/).
3. **flagd** polls that sync endpoint and serves evaluated flag values over gRPC (port `8013`) and OFREP/HTTP (port `8016`) to your backend and frontend applications using the [OpenFeature](https://openfeature.dev/) SDKs.
## Features
- 🚀 **RESTful API** for feature flag management with full **Swagger** documentation.
- 🗄️ **Multi‑database support**:
- 🐘 PostgreSQL.
- 🐬 MySQL.
- 🍃 MongoDB.
- 🪟 MSSQL.
- 🧊 SQLite.
- 📦 **Single container** — NestJS + flagd bundled together through a lightweight entrypoint script.
- 🔌 **OpenFeature compatible** — flagd supports gRPC and OFREP evaluation endpoints.
- ❤️ **Health check** — `GET /healthcheck`.
- 📜 **Structured logging** with correlation IDs for traceability.
## Environment Variable
| Variable | Description | Default |
| ----------------- | ------------------------------------------------------------ | -------------------------------------------- |
| `SERVICE_NAME` | Application name | `flagd-nestjs` |
| `DATABASE_ENGINE` | `postgres`, `mysql`, `mongodb`, `mssql`, or `sqlite` | `postgres` |
| `DATABASE_URL` | Database connection string (or file path for SQLite) | `postgres://flagd:flagd@postgres:5432/flagd` |
| `LOG_MODE` | `PLAIN_TEXT` or `JSON` | `PLAIN_TEXT` |
| `LOG_LEVEL` | `error`, `warn`, `info`, `http`, `verbose`, `debug`, `silly` | `debug` |