Feature flag documentation - Real-Dev-Squad/feature-flag-backend GitHub Wiki
- What is a Feature Flag?
- Why this service exists (e.g., "Control feature rollout, A/B testing, kill switches").
- Brief on how it works conceptually (toggle on/off for users or all).
- Having a centralised place to control all feature flags, instead of managing their rollout in service configs / ENVs.
Include a diagram if possible.
a. AWS Services Used:
- AWS API gateway -> (for routing requests to different lambdas)
- AWS Systems manager -> to store the public key safely
- AWS lambda
- AWS DynamoDb
- Cloudwatch -> for monitoring + APM (if enabled X-ray tracing)
POST `/feature-flags`
{
"name": "Test-flag-via-postman",
"description": "Feature flag created via postman",
"userId":"vikhyat"
}
{
"data": {
"id": "0cffec18-518a-41b2-b5e5-86604c06c38c",
"name": "Test-flag-via-postman",
"description": "Feature flag created via postman",
"createdAt": 1745424103,
"createdBy": "vikhyat",
"updatedAt": 1745424103,
"updatedBy": "vikhyat",
"status": "ENABLED"
},
"message": "Created feature flag successfully"
}
{
"message": "Internal server error"
}
GET `/feature-flags/{flagId}`
Empty
<flagId> - uuid for identifying the feature flags
{
"id": "0cffec18-518a-41b2-b5e5-86604c06c38c",
"name": "Test-flag-via-postman",
"description": "Feature flag created via postman",
"status": "ENABLED",
"createdAt": 1745424103,
"createdBy": "vikhyat",
"updatedAt": 1745424103,
"updatedBy": "vikhyat"
}
Currently this is passed in the body, we need to change this to pass it in JSON format
404 Feature Flag not found
PATCH `/feature-flags/{flagId}`
<flagId> passing uuid of the feature flag
{
"status": "DISABLED",
"userId": "vikhyat187"
}
{
"id": "22d400ca-8736-4c11-8a48-c74ff7d66f09",
"name": "Test-flag-via-postman",
"description": "Feature flag created via postman",
"status": "DISABLED",
"createdAt": 1744734096,
"createdBy": "vikhyat",
"updatedAt": 1745425567,
"updatedBy": "vikhyat187"
}
{
"message": "Internal server error"
}
POST `/users/{userId}/feature-flags/{flagId}`
<userId> -> user for which feature flag has to be enabled
<flagId> -> feature flag which has to be enabled
{
"status": "DISABLED",
"userId": "vikhyat187" -> this is the user Id to store in the `createdBy` / `updatedBy` column
}
{
"userId": "vikhyat",
"flagId": "22d400ca-8736-4c11-8a48-c74ff7d66f09",
"status": "DISABLED",
"createdAt": 1745425825,
"createdBy": "vikhyat187",
"updatedAt": 1745425825,
"updatedBy": "vikhyat187"
}
{
"message": "Internal server error"
}
GET `/users/{userId}/feature-flags/{flagId}`
<userId> -> user for which feature flag has to be enabled
<flagId> -> feature flag which has to be enabled
Empty
{
"userId": "1234",
"flagId": "22d400ca-8736-4c11-8a48-c74ff7d66f09",
"status": "DISABLED",
"createdAt": 1744735629,
"createdBy": "vikhyat187",
"updatedAt": 1745425794,
"updatedBy": "vikhyat187"
}
{
"message": "Internal server error"
}
GET `/users/{userId}/feature-flags/
<userId> -> user for which feature flag has to be enabled
Empty
[
{
"userId": "1234",
"flagId": "22d400ca-8736-4c11-8a48-c74ff7d66f09",
"status": "DISABLED",
"createdAt": 1744735629,
"createdBy": "vikhyat187",
"updatedAt": 1745425794,
"updatedBy": "vikhyat187"
}
]
{
"message": "Internal server error"
}
GET `/feature-flags`
Empty
[
{
"id": "0cffec18-518a-41b2-b5e5-86604c06c38c",
"name": "Test-flag-via-postman",
"description": "Feature flag created via postman",
"status": "ENABLED",
"createdAt": 1745424103,
"createdBy": "vikhyat",
"updatedAt": 1745424103,
"updatedBy": "vikhyat"
},
{
"id": "22d400ca-8736-4c11-8a48-c74ff7d66f09",
"name": "Test-flag-via-postman",
"description": "Feature flag created via postman",
"status": "DISABLED",
"createdAt": 1744734096,
"createdBy": "vikhyat",
"updatedAt": 1745425567,
"updatedBy": "vikhyat187"
},
{
"id": "aaf474b1-0b0f-44d3-a648-82ac6754d7ba",
"name": "Test-flag-via-postman",
"description": "Feature flag created via postman",
"status": "ENABLED",
"createdAt": 1744733459,
"createdBy": "vikhyat",
"updatedAt": 1744733459,
"updatedBy": "vikhyat"
}
]
{
"message": "Internal server error"
}
POST `/reset-limit
{
"pendingLimit": 20
}
Successfully updated concurrency limit
{
"message": "Internal server error"
}
PATCH `/mark-concurrency-zero`
Empty
Changed the reserved concurrency of the lambda function GetFeatureFlagFunction
{
"message": "Internal server error"
}
📎 Appendix Glossary for beginners (SSM, IAM, Lambda, Dynamodb, Cloudwatch, API gateway.)