MCPcopy
hub / github.com/ThreeDotsLabs/wild-workouts-go-ddd-example

github.com/ThreeDotsLabs/wild-workouts-go-ddd-example @v2.7 sqlite

repository ↗ · DeepWiki ↗ · release v2.7 ↗
962 symbols 2,190 edges 122 files 326 documented · 34%
README

Wild Workouts

Wild Workouts is an example Go DDD project that we created to show how to build Go applications that are easy to develop, maintain, and fun to work with, especially in the long term!

The idea for this series, is to apply DDD by refactoring. This process is in progress! Please check articles, to know the current progress.

No application is perfect from the beginning. With over a dozen coming articles, we will uncover what issues you can find in the current implementation. We will also show how to fix these issues and achieve clean implementation by refactoring.

Articles

"Too modern" application

  1. Too modern Go application? Building a serverless application with Google Cloud Run and Firebase [v1.0]
  2. A complete Terraform setup of a serverless application on Google Cloud Run and Firebase [v1.1]
  3. Robust gRPC communication on Google Cloud Run (but not only!) [v1.2]
  4. You should not build your own authentication. Let Firebase do it for you. [v1.3]

Refactoring

  1. Business Applications in Go: Things to know about DRY [v2.0]
  2. When microservices in Go are not enough: introduction to DDD Lite [v2.1]
  3. Repository pattern: painless way to simplify your Go service logic [v2.2]
  4. 4 practical principles of high-quality database integration tests in Go [v2.3]
  5. Introducing Clean Architecture by refactoring a Go project [v2.4]
  6. Introducing basic CQRS by refactoring [v2.5]
  7. Combining DDD, CQRS, and Clean Architecture
  8. Microservices test architecture. Can you sleep well without end-to-end tests? [v2.6]
  9. More articles are on the way!

Directories

  • api OpenAPI and gRPC definitions
  • docker Dockerfiles
  • internal application code
  • scripts deployment and development scripts
  • terraform - infrastructure definition
  • web - frontend JavaScript code

Live Demo

The example application is available at https://threedotslabs-wildworkouts.web.app/.

Running locally

> docker-compose up

# ...

web_1             |  INFO  Starting development server...
web_1             |  DONE  Compiled successfully in 6315ms11:18:26 AM
web_1             |
web_1             |
web_1             |   App running at:
web_1             |   - Local:   http://localhost:8080/
web_1             |
web_1             |   It seems you are running Vue CLI inside a container.
web_1             |   Access the dev server via http://localhost:<your container's external mapped port>/
web_1             |
web_1             |   Note that the development build is not optimized.
web_1             |   To create a production build, run yarn build.

Google Cloud Deployment

> cd terraform/
> make

Fill all required parameters:
    project [current: wild-workouts project]:       # <----- put your Wild Workouts Google Cloud project name here (it will be created) 
    user [current: email@gmail.com]:                # <----- put your Google (Gmail, G-suite etc.) e-mail here
    billing_account [current: My billing account]:  # <----- your billing account name, can be found here https://console.cloud.google.com/billing
    region [current: europe-west1]: 
    firebase_location [current: europe-west]: 

# it may take a couple of minutes...

The setup is almost done!

Now you need to enable Email/Password provider in the Firebase console.
To do this, visit https://console.firebase.google.com/u/0/project/[your-project]/authentication/providers

You can also downgrade the subscription plan to Spark (it's set to Blaze by default).
The Spark plan is completely free and has all features needed for running this project.

Congratulations! Your project should be available at: https://[your-project].web.app

If it's not, check if the build finished successfully: https://console.cloud.google.com/cloud-build/builds?project=[your-project]

If you need help, feel free to contact us at https://threedots.tech

Screenshots

Wild Workouts login Wild Workouts trainer's schedule Wild Workouts schedule training

Extension points exported contracts — how you extend this code

UserService (Interface)
(no doc) [6 implementers]
internal/trainings/app/command/services.go
AvailableHoursReadModel (Interface)
(no doc) [1 implementers]
internal/trainer/app/query/available_hours.go
TrainerService (Interface)
(no doc) [3 implementers]
internal/trainings/app/command/services.go
Repository (Interface)
(no doc)
internal/trainer/domain/hour/repository.go
AllTrainingsReadModel (Interface)
(no doc) [1 implementers]
internal/trainings/app/query/all_trainings.go
TrainingsForUserReadModel (Interface)
(no doc) [1 implementers]
internal/trainings/app/query/trainings_for_user.go
Repository (Interface)
(no doc)
internal/trainings/domain/training/repository.go

Core symbols most depended-on inside this repo

String
called by 34
internal/trainings/domain/training/user.go
Error
called by 27
internal/trainer/domain/hour/hour.go
Time
called by 21
internal/trainings/domain/training/training.go
Error
called by 18
internal/trainings/domain/training/repository.go
convertToType
called by 18
web/src/repositories/clients/trainings/src/ApiClient.js
UUID
called by 17
internal/trainings/domain/training/user.go
UserUUID
called by 16
internal/trainings/domain/training/training.go
NewAvailableHour
called by 15
internal/trainer/domain/hour/hour.go

Shape

Method 471
Function 269
Struct 129
Class 42
Interface 24
TypeAlias 21
FuncType 6

Languages

Go82%
TypeScript18%

Modules by API surface

internal/common/client/trainings/openapi_client_gen.go91 symbols
internal/common/genproto/trainer/trainer.pb.go70 symbols
internal/common/genproto/users/users.pb.go61 symbols
internal/common/client/trainer/openapi_client_gen.go50 symbols
internal/common/client/users/openapi_client_gen.go22 symbols
internal/trainer/domain/hour/hour.go19 symbols
web/src/repositories/clients/users/src/ApiClient.js18 symbols
web/src/repositories/clients/trainings/src/ApiClient.js18 symbols
web/src/repositories/clients/trainer/src/ApiClient.js18 symbols
internal/trainings/ports/openapi_api.gen.go17 symbols
web/src/repositories/auth.js16 symbols
internal/common/tests/clients.go16 symbols

Dependencies from manifests, versioned

cloud.google.com/gov0.38.0 · 1×
cloud.google.com/go/firestorev1.2.0 · 1×
firebase.google.com/gov3.12.0+incompatible · 1×
github.com/deepmap/oapi-codegenv1.4.1 · 1×
github.com/dgrijalva/jwt-gov3.2.0+incompatible · 1×
github.com/go-chi/chiv4.1.0+incompatible · 1×
github.com/go-chi/corsv1.0.1 · 1×
github.com/go-chi/renderv1.0.1 · 1×

Datastores touched

trainer-hoursCollection · 1 repos
trainingsCollection · 1 repos
usersCollection · 1 repos
(mysql)Database · 1 repos

For agents

$ claude mcp add wild-workouts-go-ddd-example \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact