{"id":20214781,"url":"https://github.com/raezil/thunder","last_synced_at":"2025-03-03T11:17:08.655Z","repository":{"id":260900968,"uuid":"882664523","full_name":"Raezil/Thunder","owner":"Raezil","description":"gRPC-Gateway + Prisma + GO","archived":false,"fork":false,"pushed_at":"2025-02-27T18:10:43.000Z","size":10925,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-27T19:10:54.806Z","etag":null,"topics":["backend","containerization","framework","golang","grpc-gateway-example","grpc-go","kubernetes","prisma","template"],"latest_commit_sha":null,"homepage":"","language":"Go","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/Raezil.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-03T12:42:00.000Z","updated_at":"2025-02-27T13:26:11.000Z","dependencies_parsed_at":"2025-01-13T21:43:26.893Z","dependency_job_id":"12ebd76e-b258-48cd-82fd-29777eb00f3b","html_url":"https://github.com/Raezil/Thunder","commit_stats":null,"previous_names":["raezil/grpc-gateway-template","raezil/protolink","raezil/thunder"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raezil%2FThunder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raezil%2FThunder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raezil%2FThunder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raezil%2FThunder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Raezil","download_url":"https://codeload.github.com/Raezil/Thunder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241652965,"owners_count":19997578,"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":["backend","containerization","framework","golang","grpc-gateway-example","grpc-go","kubernetes","prisma","template"],"created_at":"2024-11-14T06:18:04.461Z","updated_at":"2025-03-03T11:17:08.649Z","avatar_url":"https://github.com/Raezil.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **Thunder - A Minimalist Backend Framework in Go**\n*A gRPC-Gateway-powered framework with Prisma, Kubernetes and Go for scalable microservices.*\n\n[![Go Version](https://img.shields.io/badge/Go-1.21-blue)](https://golang.org)\n[![License](https://img.shields.io/github/license/Raezil/Thunder)](LICENSE)\n[![Stars](https://img.shields.io/github/stars/Raezil/Thunder)](https://github.com/Raezil/Thunder/stargazers)\n[![Issues](https://img.shields.io/github/issues/Raezil/Thunder)](https://github.com/Raezil/Thunder/issues)\n\n## **Table of Contents**\n- [🚀 Features](#-features)\n- [📌 Getting Started](#-getting-started)\n- - [⚡ Thunder CLI](#thunder-cli)\n  - [1️⃣ Install Dependencies](#1️⃣-install-dependencies)\n  - [2️⃣ Define Your gRPC Service](#2️⃣-define-your-grpc-service)\n- [🛠️ Prisma Integration](#️-prisma-integration)\n- [🚀 Running the Server](#-running-the-server)\n  - [a. Code Generation](#a-code-generation)\n  - [b. Start the **gRPC + REST API** server](#b-start-the-grpc--rest-api-server)\n- [🚀 Running the Tests](#-running-the-tests)\n  - [a. Mocking Tests](#a-mocking-tests)\n  - [b. Running the Tests](#b-running-the-tests)\n- [🔧 Kubernetes Deployment](#-kubernetes-deployment)\n  - [1️⃣ Generate TLS Certificates](#1️⃣-generate-tls-certificates)\n  - [2️⃣ Build \u0026 Push Docker Image](#2️⃣-build--push-docker-image)\n  - [3️⃣ Deploy to Kubernetes](#3️⃣-deploy-to-kubernetes)\n- [📡 API Testing](#-api-testing)\n  - [Register a User](#register-a-user)\n  - [Login](#login)\n- [📜 Contributing](#-contributing)\n- [🔗 References](#-references)\n- [📣 Stay Connected](#-stay-connected)\n\n---\n\n## **🚀 Features**\n✔️ **gRPC + REST (gRPC-Gateway)** – Automatically expose RESTful APIs from gRPC services.  \n✔️ **Prisma Integration** – Use Prisma for efficient database access in Go.  \n✔️ **Kubernetes Ready** – Easily deploy and scale with Kubernetes.  \n✔️ **TLS Security** – Secure gRPC communications with TLS.  \n✔️ **Structured Logging** – Built-in `zap` logging.  \n✔️ **Rate Limiting \u0026 Authentication** – Pre-configured middleware.  \n✔️ **Modular \u0026 Extensible** – Easily extend Thunder for custom use cases.  \n✔️ **Thunder CLI** - generate, deploy, create new project by using dedicated CLI.  \n\n---\n\n## **📌 Getting Started**\n\n### **Thunder CLI**\nFor a comprehensive guide on how to use Thunder CLI—including installation steps, available commands, and usage examples—you can refer to the official documentation here:\nhttps://github.com/Raezil/Thunder/blob/main/thunder-cli.md\n\nThis file covers everything you need to get started with Thunder CLI and will help you integrate it into your development workflow.\n\n\n### **1️⃣ Install Dependencies**\nEnsure you have Go, `protoc`, and Prisma installed.  \n\n```sh\ngo mod tidy\n```\n\n### **2️⃣ Define Your gRPC Service**\nCreate a `.proto` file, e.g., `user.proto`:\n\n```proto\nsyntax = \"proto3\";\n\npackage example;\n\noption go_package = \"backend/\";\n\nimport \"google/api/annotations.proto\";\n\n// A simple service definition.\nservice UserService {\n  rpc GetUser (UserRequest) returns (UserResponse) {\n    option (google.api.http) = {\n      get: \"/v1/users/{id}\"\n    };\n  }\n}\n\n// Request and response messages.\nmessage UserRequest {\n  int32 id = 1;\n}\n\nmessage UserResponse {\n  int32 id = 1;\n  string name = 2;\n  int32 age = 3;\n}\n```\n---\n\n## **🛠️ Prisma Integration**\nThunder automatically integrates Prisma for database management. Define your schema:\n\n## a. Create Your schema.prisma File\n```prisma\ndatasource db {\n  provider = \"postgresql\"\n  url      = env(\"DATABASE_URL\")\n}\n\nmodel User {\n  id    String @default(cuid()) @id\n  name  String\n  email String @unique\n}\n```\n\n## **🚀 Running the Server**\n\n#### a. Code Generation\n```\nthunder generate -proto=filename.proto -prisma=true\n```\n\u003e **Note:** Replace `filename` with the actual name of your gRPC service.\n\u003e **Note** Remember to install [ Thunder CLI](#thunder-cli)\n\n#### b. Start the **gRPC + REST API** server:\n\n```sh\ngo run ./server/main.go\n```\n\u003e **Note:** Generate TLS certificates prior running the server.\n\n## **🚀 Running the Tests**\n#### a. Mocking Tests\nTo mock a gRPC server:\n```\ncd backend\nmockgen -source=yourservice_grpc.pb.go -destination=yourservice_mock.go\n```\n\u003e **Note:** Replace `yourservice` with the actual name of your gRPC service. Look into /backend/authenticator_server_test.go to see how to develop tests or look into https://github.com/golang/mock\n\n#### b. Running the Tests\n```\ngo test ./backend/... ./db/...\n```\n\n---\n\n## **🔧 Kubernetes Deployment**\n### **1️⃣ Generate TLS Certificates**\n```sh\nmkdir certs\nopenssl req -x509 -newkey rsa:4096 -keyout certs/server.key -out certs/server.crt -days 365 -nodes \\\n  -subj \"/CN=localhost\" \\\n  -addext \"subjectAltName=DNS:localhost,IP:127.0.0.1\"\n```\n\n### **2️⃣ Build \u0026 Push Docker Image**\n```\nthunder docker\n```\n\n### **3️⃣ Deploy to Kubernetes**\n```sh\nthunder deploy\n```\n**Note** Remember to install [ Thunder CLI](#thunder-cli)\n\n#### Checking Pod Status\n```\nkubectl get pods -n default\nkubectl describe pod $NAME -n default\n```\n\n---\n\n## **📡 API Testing**\n### **Register a User**\n```sh\ncurl -k --http2 -X POST https://localhost:8080/v1/auth/register \\\n     -H \"Content-Type: application/json\" \\\n     -d '{\n           \"email\": \"newuser@example.com\",\n           \"password\": \"password123\",\n           \"name\": \"John\",\n           \"surname\": \"Doe\",\n           \"age\": 30\n         }'\n```\n\n### **Login**\n```sh\ncurl -k --http2 -X POST https://localhost:8080/v1/auth/login \\\n     -H \"Content-Type: application/json\" \\\n     -d '{\n           \"email\": \"newuser@example.com\",\n           \"password\": \"password123\"\n         }'\n```\n---\n\n## **📜 Contributing**\nWant to improve Thunder? 🚀  \n1. Fork the repo  \n2. Create a feature branch (`git checkout -b feature-new`)  \n3. Commit your changes (`git commit -m \"Added feature\"`)  \n4. Push to your branch (`git push origin feature-new`)  \n5. Submit a PR!  \n\n---\n\n## **🔗 References**\n- 📜 [Go Documentation](https://golang.org/doc/)  \n- 📘 [gRPC-Gateway](https://grpc-ecosystem.github.io/grpc-gateway/)  \n- 🛠️ [Prisma ORM](https://www.prisma.io/docs/)  \n- ☁️ [Kubernetes Docs](https://kubernetes.io/docs/)  \n\n---\n\n## **📣 Stay Connected**\n⭐ Star the repo if you find it useful!  \n📧 For questions, reach out via [GitHub Issues](https://github.com/Raezil/Thunder/issues).  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraezil%2Fthunder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraezil%2Fthunder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraezil%2Fthunder/lists"}