MCPcopy
hub / github.com/sagikazarmark/modern-go-application

github.com/sagikazarmark/modern-go-application @0.3.0 sqlite

repository ↗ · DeepWiki ↗ · release 0.3.0 ↗
220 symbols 670 edges 55 files 122 documented · 55%
README

Modern Go Application

Go Report Card GolangCI GoDoc Mentioned in Awesome Go

Build Status CircleCI Gitlab

Go application boilerplate and example applying modern practices

This repository tries to collect the best practices of application development using Go language. In addition to the language specific details, it also implements various language independent practices.

Some of the areas Modern Go Application touches:

  • architecture
  • package structure
  • building the application
  • testing
  • configuration
  • running the application (eg. in Docker)
  • developer environment/experience
  • telemetry

To help adopting these practices, this repository also serves as a boilerplate for new applications.

Features

First steps

To create a new application from the boilerplate clone this repository (if you haven't done already) into your GOPATH then execute the following:

chmod +x init.sh && ./init.sh
? Package name (github.com/sagikazarmark/modern-go-application)
? Project name (modern-go-application)
? Binary name (modern-go-application)
? Service name (modern-go-application)
? Friendly service name (Modern Go Application)
? Update README (Y/n)
? Remove init script (y/N) y

It updates every import path and name in the repository to your project's values. Review and commit the changes.

Load generation

To test or demonstrate the application it comes with a simple load generation tool. You can use it to test the example endpoints and generate some load (for example in order to fill dashboards with data).

Follow the instructions in etc/loadgen.

Inspiration

See INSPIRATION.md for links to articles, projects, code examples that somehow inspired me while working on this project.

License

The MIT License (MIT). Please see License File for more information.

Extension points exported contracts — how you extend this code

Service (Interface)
Service manages a list of todos. [4 implementers]
internal/app/mga/todo/service.go
Logger (Interface)
Logger is the fundamental interface for all log operations. [2 implementers]
internal/common/logger.go
Events (Interface)
go:generate mga gen kit endpoint --outdir tododriver --with-oc Service go:generate mga gen ev dispatcher Events go:gener [3 …
internal/app/mga/todo/service.go
ErrorHandler (Interface)
ErrorHandler handles an error. [2 implementers]
internal/common/error_handler.go
Store (Interface)
Store provides todo persistence. [2 implementers]
internal/app/mga/todo/service.go
ContextExtractor (Interface)
ContextExtractor extracts log fields from a context. [2 implementers]
internal/common/commonadapter/logger.go
Context (Interface)
Context represents the application context. [1 implementers]
internal/app/todocli/command/cmd.go
IDGenerator (Interface)
IDGenerator generates a new ID.
internal/app/mga/todo/service.go

Core symbols most depended-on inside this repo

Info
called by 22
internal/common/logger.go
NewInMemoryStore
called by 15
internal/app/mga/todo/store.go
Error
called by 11
internal/common/logger.go
Handle
called by 11
internal/common/error_handler.go
MarkAsDone
called by 8
internal/app/mga/todo/service.go
CreateTodo
called by 7
internal/app/mga/todo/service.go
NewService
called by 7
internal/app/mga/todo/service.go
WithContext
called by 7
internal/common/logger.go

Shape

Function 89
Method 79
Struct 39
Interface 10
Class 2
FuncType 1

Languages

Go96%
Python4%

Modules by API surface

internal/app/mga/todo/service.go23 symbols
internal/common/logger.go17 symbols
internal/common/commonadapter/logger.go12 symbols
internal/app/mga/todo/tododriver/transport_grpc.go12 symbols
internal/app/mga/todo/tododriver/middleware.go11 symbols
internal/app/mga/todo/store.go10 symbols
internal/app/mga/todo/tododriver/transport_graphql.go9 symbols
internal/app/mga/todo/store_test.go8 symbols
internal/app/mga/todo/service_test.go8 symbols
internal/app/mga/todo/todogen/MarkedAsDone_event_handler_gen.go7 symbols
internal/app/mga/todo/tododriver/endpoint.go7 symbols
etc/loadgen/locustfile.py7 symbols

Dependencies from manifests, versioned

contrib.go.opencensus.io/exporter/ocagentv0.6.0 · 1×
contrib.go.opencensus.io/integrations/ocsqlv0.1.4 · 1×
emperror.dev/emperrorv0.21.3 · 1×
emperror.dev/errorsv0.4.3 · 1×
emperror.dev/handler/logurv0.2.0 · 1×
github.com/99designs/gqlgenv0.9.3 · 1×
github.com/99designs/gqlgen-contribv0.0.0-2019022201522 · 1×
github.com/AppsFlyer/go-sundheitv0.0.11 · 1×
github.com/ThreeDotsLabs/watermillv1.0.0 · 1×

Datastores touched

(mysql)Database · 1 repos

For agents

$ claude mcp add modern-go-application \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact