{"id":21277618,"url":"https://github.com/mxmarchal/k8s-chat","last_synced_at":"2026-04-05T21:03:05.690Z","repository":{"id":263700735,"uuid":"891171045","full_name":"mxmarchal/k8s-chat","owner":"mxmarchal","description":"A simple backend service for a chat application, built with Bun.js and PostgreSQL, and deployed on Kubernetes using Minikube. This project is intended for educational purposes only, showcasing backend development, containerization with Docker, and Kubernetes orchestration.","archived":false,"fork":false,"pushed_at":"2024-11-20T00:09:47.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T03:42:07.902Z","etag":null,"topics":["bun","docker","kubernetes","minikube","postgres","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/mxmarchal.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}},"created_at":"2024-11-19T21:16:35.000Z","updated_at":"2024-11-20T00:12:33.000Z","dependencies_parsed_at":"2024-11-20T03:47:38.498Z","dependency_job_id":null,"html_url":"https://github.com/mxmarchal/k8s-chat","commit_stats":null,"previous_names":["mxmarchal/k8s-chat"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxmarchal%2Fk8s-chat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxmarchal%2Fk8s-chat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxmarchal%2Fk8s-chat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxmarchal%2Fk8s-chat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mxmarchal","download_url":"https://codeload.github.com/mxmarchal/k8s-chat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243734295,"owners_count":20339265,"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","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":["bun","docker","kubernetes","minikube","postgres","typescript"],"created_at":"2024-11-21T10:06:27.998Z","updated_at":"2025-12-30T21:52:11.052Z","avatar_url":"https://github.com/mxmarchal.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chat Backend Service\n\nA simple chat backend service built with Bun.js and PostgreSQL, deployed on Kubernetes. This project is for **educational purposes only** and should never be used in production.\n\n## ⚠️ Warning\n\nThis project contains hardcoded credentials and lacks proper security measures. It is designed solely for learning purposes to demonstrate:\n\n- Bun.js backend development\n- Docker containerization\n- Kubernetes deployment\n- PostgreSQL integration\n- Basic health checks and readiness probes\n\n## 🔧 Prerequisites\n\n- [Bun](https://bun.sh) (v1.1.34 or later)\n- [Docker](https://www.docker.com/)\n- [Minikube](https://minikube.sigs.k8s.io/)\n- [kubectl](https://kubernetes.io/docs/tasks/tools/)\n\n## 🚀 Local Development\n\n1. Install dependencies:\n\n```sh\ncd backend\nbun install\n```\n\nYou'll need to have a PostgreSQL database running locally. You can use the following command to start a PostgreSQL container:\n\n```sh\ndocker run --name postgres -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 postgres\n```\n\n2. Run the application:\n\nYou'll have to create a `.env` file to run the application (see `.env.example`).\n\n```sh\nbun start\n```\n\n3. Test the application:\n\n```sh\ncurl http://localhost:3000/readyz\n```\n\n```sh\ncurl http://localhost:3000/messages\n```\n\n```sh\ncurl -X POST http://localhost:3000/messages -H \"Content-Type: application/json\" -d '{\"username\": \"John\", \"message\": \"Hello, world!\"}'\n```\n\n## 🐳 Docker Containerization\n\nI use a Makefile to build and run the Docker container (see `Makefile`).\nAlso, it's a docker-compose file to run the container (see `docker-compose.yml`).\n\n```sh\nmake build\nmake run\n```\n\n## 🚀 Kubernetes Deployment\n\n### Prerequisites\n\n- Minikube installed\n- kubectl configured to use Minikube cluster (see [Minikube installation guide](https://minikube.sigs.k8s.io/docs/start/))\n\n1. Start Minikube:\n\n```sh\nminikube start\n```\n\n2. Enable the tunnel for LoadBalancer service:\n\n```sh\nminikube tunnel\n```\n\n3. Build the Docker image in Minikube’s environment:\n\nMinikube uses its own Docker daemon. Configure your terminal to build the image directly inside Minikube's environment.\n\n```sh\nmake minikube-build\n```\n\n4. Deploy the application:\n\n```sh\nmake k8s-up\n```\n\n5. Access the application:\n\n```sh\nminikube service chat-backend-service --url\n```\n\nUse the provided URL to test the endpoints:\n\n- Retrieve Messages: GET /messages\n- Post a Message: POST /message (body: {\"username\": \"Alice\", \"message\": \"Hello Minikube!\"})\n\n6. Stop the application:\n\n```sh\nmake k8s-down\n```\n\n## Debugging the k8s cluster\n\n[RTFD](https://kubernetes.io/docs/reference/kubectl/)\n\nBut since i'm nice, here's a cheat sheet:\n\n```sh\nkubectl get pods\nkubectl logs \u003cpod-name\u003e\nkubectl describe pod \u003cpod-name\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmxmarchal%2Fk8s-chat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmxmarchal%2Fk8s-chat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmxmarchal%2Fk8s-chat/lists"}