Skip to content

pieceowater-dev/lotof.atrace.gtw

Repository files navigation

lotof.atrace.gateway

Welcome to the Lotof ATrace Gateway project! This project provides a structure to generate, build, and run a GraphQL server using gqlgen and Docker for containerization. Below you'll find a comprehensive guide to get started with this project.

Prerequisites

Before you begin, ensure you have the following installed on your machine:

Makefile Targets

The project uses a Makefile to automate common tasks. Below are the available make targets and their functionalities:

make all

  • Description: Generates the necessary Go files for gqlgen, gRPC, and runs the server.
  • Commands:
    • Executes the gqlgen and grpcgen targets.
    • Starts the server using make run.

make gql-gen

  • Description: Generates the Go code required for your GraphQL server.
  • Commands:
    • Executes $(GQLGEN) generate to generate GraphQL server code.
    • Cleans up dependencies with go mod tidy.

make grpc-gen

  • Description: Generates Go stubs for gRPC services.
  • Commands:
    • Uses $(PROTOC) with plugins protoc-gen-go and protoc-gen-go-grpc.
    • Places the generated files in ./internal/core/grpc/generated.

make run

  • Description: Runs the GraphQL server.
  • Commands:
    • Executes go run ./cmd/server/main.go to start the server.

make build-dev

  • Description: Builds a Docker image for the development environment.
  • Commands:
    • Builds Docker image using dev.dockerfile and names it gateway-dev.

make build-main

  • Description: Builds a Docker image for the production environment.
  • Commands:
    • Builds Docker image using main.dockerfile and names it gateway-prod.

make compose-up

  • Description: Starts the services defined in docker-compose.yml.
  • Commands:
    • Runs $(DOCKER_COMPOSE) up -d to start services in detached mode.

make compose-down

  • Description: Stops and removes the services defined in docker-compose.yml.
  • Commands:
    • Runs $(DOCKER_COMPOSE) down to stop the services.

make clean

  • Description: Cleans up generated files.
  • Commands:
    • Removes the files in internal/core/grpc/generated and GraphQL-related generated files.

Getting Started

  1. Clone the repository:

    git clone https://github.com/pieceowater-dev/lotof.atrace.gtw.git
    cd lotof.atrace.gtw
  2. Install dependencies:

go mod tidy
  1. Generate GraphQL files and start the server:

    make all
  2. (Optional) To build Docker images for development or production:

    make build
  3. (Optional) To manage Docker services:

    make compose-up   # Start services
    make compose-down # Stop services

Notes

  • Customize Dockerfile as needed for your project's specific requirements.
  • The server entry point is at ./cmd/server/main.go.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

PCWT Dev Logo

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages