Wild Workouts Go DDD Example

repository·master·Indexed 27 days ago

https://github.com/threedotslabs/wild-workouts-go-ddd-example

An example Go project demonstrating Domain-Driven Design (DDD) principles. It showcases how to build maintainable and scalable applications using Clean Architecture, CQRS, and the Repository pattern, specifically designed for a serverless environment using Google Cloud Run and Firebase.

Tokens
6.6K
Snippets
13
Records
70
Agent score
91%

What's inside wild-workouts-go-ddd-example

  1. Project Directory Structure

    master

    The repository is organized into the following key directories:

    • api/: Contains OpenAPI and gRPC definitions.
    • docker/: Contains Dockerfiles for containerization.
    • internal/: Contains the core Go application code.
    • scripts/: Contains deployment and development scripts.
    • terraform/: Contains the infrastructure-as-code definitions.
    • web/: Contains the frontend JavaScript (Vue) code.
  2. Deploy Wild Workouts to Google Cloud

    master

    You can deploy the entire infrastructure using Terraform and Make. This process sets up Google Cloud Run and Firebase. During execution, you will be prompted to provide your Google Cloud project name, email, billing account, region, and Firebase location.

    Post-deployment steps:

    1. Enable Authentication: Visit the Firebase console for your project and enable the Email/Password provider at: https://console.firebase.google.com/u/0/project/[your-project]/authentication/providers.
    2. Billing: The setup defaults to the Blaze plan. You can downgrade to the Spark plan in the Firebase console if you want to stay within the free tier; the Spark plan supports all features required for this project.
    cd terraform/
    make
  3. Set up the Wild Workouts environment

    master

    Follow these steps to initialize the project infrastructure:

    1. Authorize gcloud CLI: Run the following commands to authenticate your local environment. Note that default application login is not recommended for production.

      gcloud auth login
      gcloud auth application-default login
    2. Run Infrastructure Deployment: Execute make to start the Terraform process. When prompted to confirm applying changes, type yes.

      make

      Note on Regions: You will be prompted to pick a region for Cloud Run and Firebase. If you choose a region other than europe-west1, you must manually update the following files to match your selection:

      • ./scripts/deploy.sh
      • ./web/firebase.json
    3. Enable Firebase Authentication: You must manually enable the Email/Password provider in the Firebase console as instructed by the make output: a. Open the Firebase Console. b. Select the Wild Workouts project. c. Navigate to Authentication. d. Select the Sign-in method tab. e. Click on Email/Password, switch it to Enabled, and click Save.

    gcloud auth login
    gcloud auth application-default login
    
    make
  4. Run the Wild Workouts stack with Docker Compose

    master

    The project uses a docker-compose.yml file to orchestrate the full application stack, including the web frontend, various microservices (trainer, trainings, users), a Firestore emulator, and a MySQL database.

    To run the stack, ensure you have a .env file in the root directory, as most services depend on it for configuration. The services are bound to 127.0.0.1 to prevent external exposure.