{"id":31698809,"url":"https://github.com/hevalhazalkurt/fastapi-k8s-launchpad","last_synced_at":"2026-04-30T08:34:09.756Z","repository":{"id":318278941,"uuid":"1070585800","full_name":"hevalhazalkurt/FastAPI-K8s-Launchpad","owner":"hevalhazalkurt","description":"A starter project for deploying FastAPI microservices on a local Kubernetes (Minikube) cluster.","archived":false,"fork":false,"pushed_at":"2025-10-06T08:29:25.000Z","size":57,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-06T09:37:29.534Z","etag":null,"topics":["boilerplate","docker","example-project","fastapi","k8s","kubernetes","microservices","minikube","python","rest-api","starter-kit"],"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/hevalhazalkurt.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":"2025-10-06T06:45:25.000Z","updated_at":"2025-10-06T08:29:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"e41e6ca7-8f12-4649-8b32-ffd5e1248a87","html_url":"https://github.com/hevalhazalkurt/FastAPI-K8s-Launchpad","commit_stats":null,"previous_names":["hevalhazalkurt/fastapi-k8s-launchpad"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/hevalhazalkurt/FastAPI-K8s-Launchpad","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hevalhazalkurt%2FFastAPI-K8s-Launchpad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hevalhazalkurt%2FFastAPI-K8s-Launchpad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hevalhazalkurt%2FFastAPI-K8s-Launchpad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hevalhazalkurt%2FFastAPI-K8s-Launchpad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hevalhazalkurt","download_url":"https://codeload.github.com/hevalhazalkurt/FastAPI-K8s-Launchpad/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hevalhazalkurt%2FFastAPI-K8s-Launchpad/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000701,"owners_count":26082805,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["boilerplate","docker","example-project","fastapi","k8s","kubernetes","microservices","minikube","python","rest-api","starter-kit"],"created_at":"2025-10-08T19:10:57.297Z","updated_at":"2025-10-08T19:11:17.357Z","avatar_url":"https://github.com/hevalhazalkurt.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FastAPI-K8s-Launchpad \n\nA comprehensive, beginner-friendly starter project that demonstrates how to build, containerize, and deploy a multi-service FastAPI application on a local Kubernetes cluster using Minikube.\n\nThis project is designed to be a **blueprint** for anyone moving from developing a monolithic application to adopting a cloud-native, microservices architecture. It bridges the gap between writing Python code and running it in an orchestrated, production-like environment.\n\n---\n\n### Core Technologies\n\n| Technology | Role |\n| :--- | :--- |\n| **FastAPI** | Building high-performance, asynchronous API microservices. |\n| **Poetry** | Managing dependencies for each isolated service. |\n| **Docker** | Containerizing the individual microservices for portability. |\n| **Docker Compose**| Running the multi-container application locally for quick testing. |\n| **Kubernetes** | Orchestrating the containers (Pods, Deployments, Services). |\n| **Minikube** | Running a single-node Kubernetes cluster on a local machine. |\n| **Makefile** | Providing a simple command-line interface for all project operations. |\n\n\n---\n\n### Key Learning Objectives\n\nThis repository provides a hands-on example of the following core concepts:\n\n- **Microservice Design:** Splitting a logical application into smaller, independent services.\n- **Containerization:** Creating efficient and reproducible container images for each service with `Dockerfile`.\n- **Service Discovery:** Enabling services to find and communicate with each other within the Kubernetes cluster using `Service` objects.\n- **Declarative Configuration:** Defining the desired state of the application using Kubernetes YAML manifests (`Deployment`, `Service`).\n- **Local Development Workflow:** A complete guide on how to run and test a multi-container application on your local machine before pushing to a real cloud environment.\n\n---\n\n## Project Architecture\n\nThis project consists of two simple microservices that communicate with each other:\n\n1.  **`inventory-service`**\n    *   Acts as the data source.\n    *   It holds a static list of products (ID, name, price).\n    *   Exposes endpoints to list all products or get a single product by its ID.\n\n2.  **`order-service`**\n    *   Handles the business logic.\n    *   Exposes an endpoint to create a new order.\n    *   Before creating an order, it makes an **internal HTTP request** to the `inventory-service` to validate the product and get its price.\n\nThis interaction is a classic example of inter-service communication within a microservices architecture.\n\n---\n\n## Prerequisites\n\nBefore you begin, ensure you have the following tools installed on your system:\n\n*   [Docker Desktop](https://www.docker.com/products/docker-desktop/)\n*   [Minikube](https://minikube.sigs.k8s.io/docs/start/)\n*   [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)\n*   `make` \n\n---\n\n## Getting Started\n\nThis project is managed via a `Makefile`, which simplifies all common tasks.\n\n### Workflow 1: Running with Docker Compose (Quick Local Test)\n\nThis workflow is ideal for quickly testing the services on your local machine without Kubernetes.\n\n1.  **Build and Start the Services:**\n    This command will build the Docker images and start the containers in the background.\n    ```bash\n    make up\n    ```\n\n2.  **Test the Application:**\n    You can now access the services:\n    *   **Order Service Docs:** `http://localhost:8001/docs`\n    *   **Inventory Service Docs:** `http://localhost:8000/docs`\n\n3.  **Stop and Clean Up:**\n    This will stop the containers and remove the network.\n    ```bash\n    make down\n    ```\n\n\n\u003cbr\u003e\n\n### Workflow 2: Deploying on Kubernetes with Minikube (Main Goal)\n\nThis is the core workflow of the project, demonstrating a full deployment cycle.\n\n1.  **Start the Minikube Cluster:**\n    This command initializes your local Kubernetes cluster. It may take a few minutes on the first run.\n    ```bash\n    make k8s-start\n    ```\n\n2.  **Build Images for Minikube:**\n    This crucial step builds your Docker images *inside* Minikube's isolated Docker environment, making them available to the cluster.\n    ```bash\n    make k8s-build\n    ```\n\n3.  **Deploy the Application:**\n    This command applies all the YAML manifests from the `kubernetes_manifests` directory to your cluster, creating the Deployments and Services.\n    ```bash\n    make k8s-deploy\n    ```\n\n4.  **Check the Status:**\n    Verify that all Pods are in the `Running` state.\n    ```bash\n    make k8s-status\n    ```\n\n5.  **Access the Application:**\n    To test the application from your local machine (e.g., Postman or a browser), you need to create a tunnel to the `order-service`. Open a **new terminal window** and run:\n    ```bash\n    make k8s-forward-order\n    ```\n    This will make the `order-service` available at `http://localhost:8001`. Keep this terminal open while testing.\n\n6.  **Clean Up:**\n    When you're finished, you can delete all the application resources from your cluster.\n    ```bash\n    make k8s-delete\n    ```\n    You can also stop the Minikube cluster itself to save system resources:\n    ```bash\n    make k8s-stop\n    ```\n\n---\n\n## Testing the API\n\nOnce the application is running (either via Docker Compose or Kubernetes with port-forwarding), you can test the `order-service` endpoint.\n\n**Example using `curl`:**\n```bash\ncurl -X 'POST' \\\n  'http://localhost:8001/orders' \\\n  -H 'accept: application/json' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n  \"product_id\": 1,\n  \"quantity\": 2\n}\n```\n\nExpected Successful Response (201 Created):\n\n```json\n{\n  \"product_id\": 1,\n  \"quantity\": 2,\n  \"id\": 1,\n  \"total_price\": 2400,\n  \"status\": \"completed\"\n}\n```\n\n---\n\n## Using the Makefile\n\nThe Makefile provides a convenient interface for all project tasks. Run make help to see all available commands.\n\n```bash\n$ make help\nMakefile for the FastAPI-K8s-Launchpad project\n---------------------------\nUsage: make [target]\n\nAvailable Targets:\n  build                     Build Docker images for all services.\n  clean                     Clean up all Docker and Kubernetes resources.\n  down                      Stop and remove Docker Compose services.\n  help                      Display this help message.\n  k8s-build                 Build Docker images for Minikube.\n  k8s-delete                Delete the application from Kubernetes.\n  k8s-deploy                Deploy the application to Kubernetes.\n  k8s-forward-inventory     Forward inventory-service to localhost:8000.\n  k8s-forward-order         Forward order-service to localhost:8001.\n  k8s-start                 Start the Minikube cluster.\n  k8s-status                Show the status of Pods and Services.\n  k8s-stop                  Stop the Minikube cluster.\n  logs                      Follow the logs of running services.\n  up                        Start services using Docker Compose.\n```\n\n---\n\n## License\nThis project is licensed under the MIT License. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhevalhazalkurt%2Ffastapi-k8s-launchpad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhevalhazalkurt%2Ffastapi-k8s-launchpad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhevalhazalkurt%2Ffastapi-k8s-launchpad/lists"}