A feature flag management platform built with .NET 9, allowing you to manage feature flags across different environments.
FMP.API- The API project implementing the feature flag management endpointsFMP.API.Tests- The test project with comprehensive tests for the API
- .NET 9
- Azure Cosmos DB Emulator (for non-debug mode)
You can use the included Makefile to run various commands:
In debug mode, the API uses an in-memory data store and seeds it with example data automatically:
# Using make:
make runapi-debug
# Or manually:
cd FMP.API
dotnet run --debugThe API will be available at http://localhost:5000 and the Swagger UI at http://localhost:5000/swagger.
For normal operation, the API connects to Cosmos DB. Make sure you have the Cosmos DB Emulator running before starting:
- Start the Azure Cosmos DB Emulator
- Run the API:
# In the future, this will be available as:
# make run-cosmos
# For now:
cd FMP.API
dotnet runThe API will connect to the local Cosmos DB Emulator using the connection string configured in appsettings.json.
The Makefile provides several commands for running tests:
# Run all tests
make runtests
# Run specific test categories
make testflags # Run Feature Flag tests
make testrules # Run Targeting Rule tests
make testenv # Run Environment tests
make testanalytics # Run Analytics tests
# Run a specific test by name
make test name=AddTargetingRule_WithValidData_ReturnsCreatedRule# Build the solution
make build
# Clean the solution
make clean# Watch for changes and auto-restart the API
make watch
# See all available make commands
make helpAll configuration is in appsettings.json:
ConnectionStrings:CosmosDb: The connection string for Cosmos DBCosmosDb:DatabaseName: The database name to useApiKeys: Configured API keys for authenticationRateLimit: Rate limiting settings
The API uses API key-based authentication. Include the key in the Authorization header with one of the following formats:
Authorization: ApiKey YOUR_API_KEY
Authorization: Bearer YOUR_API_KEY
The default API key is test-api-key (configured in appsettings.json).
The Swagger UI provides full documentation for all API endpoints. Access it at:
https://localhost:5001/swagger
cd FMP.API.Tests
dotnet testIf you want to use a real Cosmos DB instance (not the emulator), you'll need to:
- Create an Azure Cosmos DB account
- Create a database called "FeatureManagementDb" (or update the configuration)
- Update the connection string in
appsettings.json
When running in debug mode, the API will use an in-memory store that exists only for the duration of the application's runtime. This is prefect for development and testing.
In normal operating mode, the API connects to Cosmos DB, which provides:
- Persistence of data
- Scalability for production
- Automatic indexing
- Geo-replication
The Cosmos DB schema follows the models defined in the API, with separate containers for:
- Feature flags
- Environments
- Analytics data