{"id":47987905,"url":"https://github.com/danielcristho/fastapi-2f","last_synced_at":"2026-04-04T11:30:21.017Z","repository":{"id":333109631,"uuid":"1135489051","full_name":"danielcristho/fastapi-2f","owner":"danielcristho","description":"FastAPI Feature Flags Implementation on AWS Environment","archived":false,"fork":false,"pushed_at":"2026-01-17T10:52:41.000Z","size":6867,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-17T21:55:31.756Z","etag":null,"topics":["aws","eks","fastapi"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielcristho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-16T07:03:21.000Z","updated_at":"2026-01-17T10:52:45.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/danielcristho/fastapi-2f","commit_stats":null,"previous_names":["danielcristho/fastapi-2f"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/danielcristho/fastapi-2f","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielcristho%2Ffastapi-2f","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielcristho%2Ffastapi-2f/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielcristho%2Ffastapi-2f/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielcristho%2Ffastapi-2f/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielcristho","download_url":"https://codeload.github.com/danielcristho/fastapi-2f/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielcristho%2Ffastapi-2f/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31398007,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","eks","fastapi"],"created_at":"2026-04-04T11:30:15.651Z","updated_at":"2026-04-04T11:30:20.934Z","avatar_url":"https://github.com/danielcristho.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FastAPI 2F\n\nSimple feature flag service built with FastAPI. Nothing fancy, just a working implementation for learning and experimentation.\n\nThis project was built using:\n\n- FastAPI + Uvicorn for the web service\n- Redis pr ElastiCache for caching\n- AWS SSM Parameter Store for persistence\n- Pydantic for data validation\n- Loguru for logging\n\n## What it does\n\n- Create and manage feature flags\n- Roll out features gradually (percentage-based, user lists, or all users)\n- Cache flags in Redis for speed\n- Store flags in AWS SSM Parameter Store for persistence\n\n```sh\nRequest → Check Redis → If miss, get from SSM → Store in Redis → Response\n```\n\n![Project infra on AWS EKS](./assets/2f-eks-infra.png)\n\n## How to Run\n\n```bash\n# Start Redis\ndocker run -d -p 6379:6379 redis:7-alpine\n\n# Install and run using UV\nuv sync\nuv run uvicorn app.main:app --reload --port 8000\n\n# Or with pip\ncd app \u0026\u0026 pip install -r requirements.txt\nuvicorn main:app --reload --port 8000\n```\n\nVisit http://localhost:8000/docs to see the API docs.\n\n## Basic usage\n\n```bash\n# Create a flag\ncurl -X POST http://localhost:8000/api/v1/flags \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"key\": \"new_feature\", \"enabled\": true, \"rules\": {\"strategy\": \"percentage\", \"percentage\": 50}}'\n\n# Check if enabled for a user\ncurl \"http://localhost:8000/api/v1/flags/new_feature/evaluate?user_id=user123\"\n```\n\n\u003c!-- ## Project structure\n\n```sh\napp/                    # FastAPI application\n├── api/v1/            # API endpoints\n├── services/          # Business logic\n├── models/            # Data models\n├── core/              # Redis/AWS clients\n└── tests/             # Test suite\n\ncdk/                   # AWS infrastructure (optional)\n├── eks_stack.py       # EKS cluster setup\n└── app.py             # CDK app\n\ninfra/k8s/             # Kubernetes manifests (optional)\n``` --\u003e\n\n## Running tests\n\n```bash\nuv run pytest app/tests/ -v\n```\n\n## Deployment options\n\n### Local development\n\nJust run it with uvicorn. Redis is optional but recommended.\n\n### AWS EKS\n\nThere's CDK code to set up an EKS cluster if you want to try that. See `cdk/` directory.\n\n### Docker\n\n```bash\n$ docker build -f infra/docker/Dockerfile -t 2f .\n$ docker run -p 8000:8000 2f\n\nor\n\n$ cd infra/docker \u0026\u0026 docker-compose up -d --build\n```\n\n## Configuration\n\nCopy `app/.env.example` to `app/.env` and adjust settings:\n\n- `REDIS_ENABLED=true` to use Redis caching\n- `SSM_ENABLED=true` to use AWS SSM for persistence\n- Set AWS credentials if using SSM\n\n## API endpoints\n\n- `GET /health/ready` - Health check\n- `POST /api/v1/flags` - Create flag\n- `GET /api/v1/flags` - List flags\n- `GET /api/v1/flags/{key}` - Get flag\n- `GET /api/v1/flags/{key}/evaluate?user_id=X` - Evaluate flag\n\nSee [`app/FEATURE_FLAGS.md`](./app/FEATURE_FLAGS.md) for detailed API docs.\n\n## Future improvements\n\nThis project may be expanded to explore different deployment environments, infrastructure-as-code approaches, and cloud providers. Future work includes running the service on Docker and Kubernetes, managing infrastructure with Terraform and AWS CDK, and deploying primarily on AWS with an eye toward portability across clouds. The main goal is learning and experimentation, not completeness.\n\nTodo:\n\n- [x] Improve environment separation (local / staging / production)\n- [x] Add Docker Compose setup for local development\n- [ ] Add AWS Lambda deployment option\n- [ ] Manage infrastructure using Terraform\n- [ ] Explore multi-cloud portability (AWS-first)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielcristho%2Ffastapi-2f","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielcristho%2Ffastapi-2f","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielcristho%2Ffastapi-2f/lists"}