crud/

directory
v0.0.0-...-de04c94 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2025 License: MIT

README

CRUD

Problem Statement

This project aims to demonstrate the implementation of a sample TODO app with plugable storage backend. The system will showcase the following features:

  • Utilization of Protocol Buffer based API contracts and dependency management via buf.
  • Generation of OpenAPI specification from the Protobuf API definitions.
  • Implementation of gRPC and HTTP gateway server for communication.
  • Configurable storage backend supporting plugable mysql, sqlite or inmemory storage options.
  • Example database migration management via sql-migrate,
  • Implementation of a caching layer using redis or in-memory caching on top of persistant storage.
  • Examples of Golang gorm usage.
  • Sample Golang project architecture showcasing best practices and code architecture.
  • Multiple testing strategies including unit and end-to-end (e2e) testing, along with support for auto-generated mocks for unit testing.
  • Containerizing of the system for deployment on Kubernetes. Scripts for Docker images and K8s deployment manifests
  • Implementation of a server that exposes healthz, statusz, pprof, promethus metrics endpoints for server monitoring and debugging.
  • CLI application that interacts with server via configurable http or grpc transport.

Non-Goals

This system does not consider user management, authentication or session management. All APIs are assumed to be public and owned by everyone. These features will be demonstrated in future examples.

Application Overview

Checkout the application demo and how the application work here.

Highlevel design

Read the detailed design decision of todo service in docs/design.md.

Highlevel architecture

Code Overview

  • apis - apis directory contains protocol buffer defination for the service and buf generated golang codes and swagger defination. Golang codes resist inside apis/go directory.

  • cmd - cmd is the entry point for different binaries. Currenlty have crud-apiserver and todocl

    • crud-apiserver - runs a server binary that responses to http and grpc.
    • todocli - is a cli application that can connect to the server via http or grpc and perform operations related to todod.
  • hack - collection of scripts and configs used in the project

    • hack/docker - contains the docker file to builf and contair the service.
    • hack/k8s - basic Kubernetes yaml files to run deployment, mainly inteneded for testing.
    • hack/scripts - collection of scripts.
  • pkg - library codes for the project.

    • pkg/clients - todo service clients.
    • pkg/service - contsins the business logics implementation of the HelloService.
    • pkg/storage - implementation of different persistant storage module, includeing database schema and models.

Development

Read the development Guideline and local build instructions in developmen.md.

Directories

Path Synopsis
apis
go/crudapiv1
Package crudapiv1 is a reverse proxy.
Package crudapiv1 is a reverse proxy.
openapi
Code generated for package openapi by go-bindata DO NOT EDIT.
Code generated for package openapi by go-bindata DO NOT EDIT.
cmd
crud-apiserver command
todocli command
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL