An open API service indexing awesome lists of open source software.

https://github.com/aaqaishtyaq/bookmark-service

CRUD application for managing bookmarks using gRPC
https://github.com/aaqaishtyaq/bookmark-service

golang grpc grpc-go microservice

Last synced: about 1 year ago
JSON representation

CRUD application for managing bookmarks using gRPC

Awesome Lists containing this project

README

          

# Bookmark Service
Golang Server gRPC CRUD App

## Table of Contents

- [Overview](#overview)
- [Features](#features)
- [Requirements](#requirements)
- [Quickstart](#quickstart)
- [Architecture](#architecture)
- [Todo](#todo)
- [Credits](#credits)

## Overview

Basic Go Client/Server CRUD app using gRPC.

## Features

- [gRPC](https://grpc.io/docs/)
- [Protobuf Format and Protoc](https://github.com/protocolbuffers/protobuf)
- SQLite

## Requirements

- [Docker](https://www.docker.com/)
- [Docker-Compose](https://docs.docker.com/compose/install/)
- [Protocol Buffer Compiler (Protoc)](https://developers.google.com/protocol-buffers/docs/downloads)
- [Binary Releases](https://github.com/protocolbuffers/protobuf/releases/tag/v3.6.1)
- [Installation Instructions](https://github.com/google/protobuf)
- [SQLite](https://www.sqlite.org/download.html)

## Configuration

Runtime environment variables that need to be in your Shell.

| Parameter | Example | Description |
| ------------- |-------------| -----|
| GOPATH | $HOME/$USER/go | |
| GOROOT | /usr/local/go | |
| GOBIN | $HOME/$USER/go/bin | |

---

## Quickstart

### 1. Download and Install The Protobuf Compiler (Protoc)

- Place the binary somewhere in your `$PATH`

```bash
$ which protoc

/usr/local/bin/protoc
```

---

#### 2. Compile the Proto Files

```bash
$ ./hack/proto-gen.sh

./pkg
|── api
└── v1
└── bookmark-service.pb.go

```

---

#### 3. Start the Server

- Build the server

```console
% pushd cmd/server && go build && popd
```

- Run the server

```console
% ./cmd/server/server --grpc-port 55521
```

- Add Bookmark

```console
% grpcurl -d '{"api" : "v1", "bookmark" : {"url" : "aaqa.dev"} }' -plaintext localhost:55521 v1.BookmarkService/CreateBookmark
```

- List Bookmarks

```console
% grpcurl -plaintext localhost:55521 v1.BookmarkService/ListBookmarks
```

## Architecture

```console
.
├── README.md
├── api
│   └── proto
│   └── v1
│   └── bookmark-service.proto - V1 Proto Description
├── cmd
│   └── server
│   └── main.go - Server entrypoint
├── go.mod
├── go.sum
├── hack
│   └── proto-gen.sh
└── pkg
├── api
│   └── v1
│   ├── bookmark-service.pb.go - Compiled Protobuf TodoService Package (Autogenerated by protoc-gen-go)
│   └── bookmark-service_grpc.pb.go
├── logger
│   └── log.go
└── service
└── v1
└── bookmark-service.go - CRUD functionality using compiled protobuf API and PB definitions

```

## Todo

- CLI Client.
- Add Remaining methods for CRUD ops.
- Add REST Server and Swagger Files.

## Credits

- [Aleksandr Sokolovskii](https://github.com/amsokol)
- [go-grpc-http-rest-microservice-tutorial](https://medium.com/@amsokol.com/tutorial-how-to-develop-go-grpc-microservice-with-http-rest-endpoint-middleware-kubernetes-daebb36a97e9)
- [Chris Paynes](https://github.com/chrispaynes/gRPCrud)
- [Go CRUD with MongoDB gRPC](https://itnext.io/learning-go-mongodb-crud-with-grpc-98e425aeaae6)