https://github.com/soundphilosopher/basic-grpc-service-node
Basic gRPC service written in TypeScript
https://github.com/soundphilosopher/basic-grpc-service-node
cloudevents grpc learning protobuf typescript
Last synced: 3 months ago
JSON representation
Basic gRPC service written in TypeScript
- Host: GitHub
- URL: https://github.com/soundphilosopher/basic-grpc-service-node
- Owner: soundphilosopher
- License: mit
- Created: 2025-08-10T18:53:02.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-12-01T21:59:13.000Z (4 months ago)
- Last Synced: 2025-12-04T11:58:13.176Z (4 months ago)
- Topics: cloudevents, grpc, learning, protobuf, typescript
- Language: TypeScript
- Homepage:
- Size: 157 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# 🚀 Basic gRPC Service: The TypeScript Edition
[](https://www.typescriptlang.org/)
[](https://nodejs.org/)
[](https://grpc.io/)
[](https://www.fastify.io/)
[](./LICENSE)
[](https://buf.build/)
[](https://connectrpc.com/)
[](https://http2.github.io/)
[](https://en.wikipedia.org/wiki/Transport_Layer_Security)
> *"Why write boring microservices when you can build something that actually talks back?"*
Welcome to the most entertaining basic gRPC service you'll ever encounter! This isn't just another "Hello World" - it's a fully-featured gRPC service that includes an ELIZA-style therapist, background processing simulation, and all the modern TypeScript/Node.js goodness you crave.
## ✨ What Makes This Special?
🎭 **Three Distinct Personalities in One Service:**
- **Hello**: Your friendly neighborhood greeter with CloudEvent superpowers
- **Talk**: A streaming ELIZA therapist bot (because who doesn't need therapy while debugging?)
- **Background**: A process simulator that pretends to spin up services across different protocols
🔒 **Security First**: Local TLS certificates with `mkcert` (because even localhost deserves encryption)
⚡ **Modern Stack**: ConnectRPC + Fastify + TypeScript + Buf CLI (the cool kids' table)
🌊 **Streaming Ready**: Both client and server streaming, because sometimes one message just isn't enough
## 🛠️ Prerequisites
Before we dive into this TypeScript wonderland, make sure you have:
- **Node.js** (because obviously)
- **npm** (comes free with Node.js, like ketchup with fries)
- **[Buf CLI](https://buf.build)** (the protobuf Swiss Army knife)
- **mkcert** (for those sweet, sweet local certificates)
- **grpcurl** *(optional, but highly recommended for showing off)*
### Quick Setup for the Impatient
```bash
# Install buf (if you haven't already)
npm install -g @bufbuild/buf
# Install mkcert (macOS)
brew install mkcert
# Install mkcert (Linux)
curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64"
chmod +x mkcert-v*-linux-amd64
sudo mv mkcert-v*-linux-amd64 /usr/local/bin/mkcert
```
## 🚀 Getting Started
### 1. Clone & Install
```bash
git clone
cd basic-grpc-service-node
npm install
```
### 2. Generate Your Certificates (Trust Issues Much?)
```bash
npm run cert:generate
```
*This creates local certificates that your browser will actually trust. Magic!*
### 3. Generate Proto Code (Optional, but Fun)
```bash
npm run buf:generate
```
*Watch as Buf transforms your `.proto` files into beautiful TypeScript. It's like a protobuf makeover show!*
### 4. Start the Show
```bash
npm start
```
🎉 **Boom!** Your gRPC service is now running on `https://127.0.0.1:8443` with all the bells, whistles, and TLS goodness.
## 🎪 Meet Your Service Methods
### 👋 `Hello` - The Friendly Greeter
**What it does:** Takes your message and wraps it in a CloudEvent like a present
```bash
# Using buf curl (the modern way)
buf curl --schema ./proto -d '{"message": "Universe"}' \
https://127.0.0.1:8443/basic.v1.BasicService/Hello
# Using grpcurl (the classic way)
grpcurl 127.0.0.1:8443 basic.v1.BasicService/Hello -d '{"message": "Universe"}'
```
**Response:** A CloudEvent containing a greeting that would make your grandmother proud.
### 💬 `Talk` - Your Personal Streaming Therapist
**What it does:** Engages you in meaningful conversation using ELIZA-style responses. It's like having a therapist, but one that runs on your localhost.
```bash
# Stream some deep thoughts
cat <