Skip to content

Isvane/charlatan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Charlatan

A lightweight Go-based gRPC server featuring user management and product response simulations. Built using modern gRPC practices, it features thread-safe in-memory storage, gRPC reflection for easy testing, and clean, graceful shutdown handling.


Features

  • User Management: Thread-safe user creation and listing.
  • Product Endpoint: Simulates dynamic product data handling with fallback defaults.
  • Health Check: Native endpoints for standard ping and application status validation.
  • gRPC Reflection: Enabled out of the box for quick debugging with tools like grpcurl.
  • Graceful Shutdown: Listens for system interrupts (SIGINT, SIGTERM) to cleanly terminate running instances without dropping active connections.

API Endpoints

The server exposes the UserService containing the following RPCs:

Method Request Response Description
GetRoot Empty StringResponse Returns a static "Goodbye, World!" greeting.
HealthCheck Empty StringResponse Simple endpoint returning an "OK" status.
GetProduct ProductRequest ProductResponse Echoes product requirements with default limit handling.
CreateUser CreateUserRequest User Stores a new user to an in-memory database with validation.
ListUsers Empty UserListResponse Returns all registered users.

Getting Started

Installation & Running

# Clone the repository and navigate to its root directory
git clone https://github.com/Isvane/charlatan.git
cd charlatan

# Download dependencies
go mod download

# Start the server
go run main.go

Testing with grpcurl

# Check Server Health
grpcurl -plaintext localhost:8000 pb.UserService/HealthCheck

# Create a User
grpcurl -plaintext -d '{"name": "Alice", "email": "alice@example.com"}' localhost:8000 pb.UserService/CreateUser

# List Users
grpcurl -plaintext localhost:8000 pb.UserService/ListUsers

About

A lightweight Go gRPC service implementation.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages