Welcome aboard the Going-Merry-Go! Inspired by the iconic ship from the anime One Piece, this project is a robust and flexible Go project starter kit. It's designed to help you quickly set up your Go applications with the right structure and essential tools.
โโโ app
โ โโโ bootstrap # Contains initialization logic for starting the application
โ โโโ registry # Manages dependency injection or service registration
โโโ bin # Holds executable files and scripts for running the application
โโโ cmd
โ โโโ grpc # Entry point for starting the gRPC server
โ โโโ restapi # Entry point for starting the REST API server
โ โโโ scheduler # Entry point for the scheduler service
โ โโโ worker # Entry point for worker processes or background jobs
โโโ config # Configuration files for the application
โโโ constant
โ โโโ ctxkey # Constants for context keys used across the application
โ โโโ rediskey # Redis-related key constants
โ โโโ restkey # Constants specific to the REST API
โโโ database
โ โโโ migrations # Database migration scripts to manage schema changes
โ โโโ seeders # Seed data for initializing the database with default values
โโโ docs
โ โโโ vscode-ext # Documentation for Visual Studio Code extensions or related setup
โโโ gen
โ โโโ grpc
โ โ โโโ greating # Auto-generated code for the "greating" gRPC service
โ โ โโโ health # Auto-generated code for the health check gRPC service
โ โโโ pkl
โ โโโ appconfig # Generated code for application configuration
โ โโโ grpcconfig # gRPC configuration details
โ โโโ httpconfig # HTTP server configuration details
โ โโโ jwtconfig # JWT (JSON Web Token) configuration settings
โ โโโ logconfig
โ โ โโโ timeformat # Time format settings for logging
โ โโโ minioconfig # MinIO (object storage) configuration
โ โโโ mysqlconfig # MySQL database configuration
โ โโโ natsconfig # NATS (messaging system) configuration
โ โโโ otelconfig # OpenTelemetry configuration for distributed tracing
โ โโโ redisconfig # Redis database configuration
โโโ internal
โ โโโ entity # Data models and entities used in the application
โ โโโ grpc
โ โ โโโ interceptor
โ โ โ โโโ stream # Stream interceptors for gRPC requests
โ โ โ โโโ unary # Unary interceptors for gRPC requests
โ โ โ โโโ util # Utility functions for gRPC interceptors
โ โ โโโ service # gRPC service implementations
โ โโโ http
โ โ โโโ dto # Data Transfer Objects for HTTP requests and responses
โ โ โโโ handler # Handlers for processing HTTP requests
โ โ โโโ interceptor # Interceptors for HTTP requests
โ โ โโโ middleware # Middleware components for HTTP processing
โ โ โโโ router # Routing logic for HTTP endpoints
โ โโโ provider
โ โ โโโ api # API providers or service interfaces
โ โ โโโ attribute # Attribute-related logic or utilities
โ โ โโโ impl # Implementation of the providers
โ โโโ repo
โ โ โโโ api # API for the repository layer
โ โ โโโ attribute # Attribute-related logic for the repository layer
โ โ โโโ impl # Implementation of repositories
โ โโโ scheduler # Scheduler logic for timed or recurring tasks
โ โโโ service
โ โ โโโ api # Service interfaces
โ โ โโโ attribute # Attribute-related logic for services
โ โ โโโ impl # Implementation of services
โ โโโ worker
โ โโโ pub # Publishing logic for worker processes
โ โโโ sub # Subscription logic for worker processes
โโโ pkg
โ โโโ xfilter # Utility for data filtering
โ โโโ xhttpin # Helper functions for HTTP input processing
โ โโโ xhttputil # Utilities for working with HTTP
โ โโโ xlazy # Lazy evaluation utilities
โ โโโ xlogger # Logging utilities and helpers
โ โโโ xresponse # Utility for handling HTTP responses
โ โโโ xtracer # Tools for distributed tracing
โ โโโ xvalidate # Input validation utilities
โโโ pkl # Placeholder for Pickle files for configuration
โโโ protos # Protocol buffer (.proto) files for defining gRPC services
โโโ storage
โโโ assets # Static assets such as images or other resources
โโโ logs # Log files generated by the applicationThe project is organized to support different modules such as REST API, gRPC, Pub/Sub, and Cron Jobs, making it easier for you to develop scalable and maintainable applications.
- APP HTTP/1.1 - REST API โ
- APP HTTP/2 - gRPC โ
- APP Nats.io - Worker Pub/Sub โณ (In Progress)
- APP CronJob - Scheduler Cron Job โณ (In Progress)
Here's a quick look at what's done and what's still in progress:
- ๐๏ธ Base Structural Directory: Well-organized code structure to get you started quickly.
- โ๏ธ Setup Basic Generator Configuration: Tools to generate handlers, services, and more.
- ๐ง Registry Dependency, Repository, and Service: Dependency injection setup.
- ๐ HTTP Handler and Router Loader: Load and manage routes effortlessly.
- ๐ก๏ธ HTTP Interceptor Handler: Middleware to handle requests seamlessly.
- ๐ DTO Validation: Validate incoming data with ease.
- ๐ฆ DB Migrations and Seeders: Database migration and seeding tools.
- ๐ Logging: Integrated logging for better observability.
- ๐ Makefile Runner: Simple command runners for building and testing.
- ๐ Open Telemetry Integration: Track and monitor your services.
- ๐ณ Docker Integration: Containerize the application.
- ๐ Open API Generator Docs: Auto-generate API documentation.
- โ๏ธ CMD Generator: Tool to generate handlers, middleware, routers, repos, and services.
- ๐งช Unit Tests: Comprehensive unit testing setup.
To get started with Going-Merry-Go, follow these steps:
# Clone the repository
git clone https://github.com/Mind2Screen-Dev-Team/going-merry-go.git
# Navigate to the project directory
cd going-merry-go
# Install dependencies and set up the project
make setup
# Run the application
make go-run app=restapiThe Makefile provides a set of commands to help you manage and interact with your Go project efficiently. Below is a list of the available commands:
make setup: Sets up the project by installing necessary tools likeprotoc-gen-go,protoc-gen-go-grpc,goose, andpkl-gen-go.
make go-tidy: Cleans up thego.modfile by removing unnecessary dependencies.make go-run app=<application>: Runs the specified application.make go-build app=<application>: Builds the specified application.make go-gen-proto: Generates Go code from.protofiles.
make migrate-up: Migrates the database to the most recent version.make migrate-up-by-one: Migrates the database up by one version.make migrate-down: Rolls back the database version by one.make migrate-status: Displays the migration status of the database.make migrate-create n=<migration_name> t=<sql|go>: Creates a new migration file.
make seeder-up: Runs the seeders to populate the database.make seeder-down: Rolls back the seeders by one version.make seeder-create n=<seeder_name> t=<sql|go>: Creates a new seeder file.
make print-path: Displays the currentPATHenvironment variable.make migrate-help: Provides help on migration commands.make go-help: Provides help on Go commands.
# Setup your project workspace
make setup
# Generate Go code from protobuf files
make go-gen-proto
# Run a Go application (example: restapi)
make go-run app=restapi
# Migrate the database to the latest version
make migrate-up
# Create a new migration file
make migrate-create n=create_users_table t=sqlThese commands make it easy to manage your Go application, including its dependencies, database migrations, and proto file generation.
For detailed documentation and advanced usage, please refer to the Wiki page.
This project is licensed under the MIT License. See the LICENSE file for details.
We welcome contributions! Feel free to submit issues, fork the repository, and send pull requests.
Give a โญ๏ธ if you like this project!
For more information or support, you can reach out to us.
