How athishsreeram/gogenetic works
Project type and purpose
• This is a code-generation CLI tool (written in Go) for scaffolding microservice projects in Go or Java. It reads business-entity TOML files and generates full microservice codebases in various architectural styles (CRUD, CQRS/ES, file-output, etc.).
File structure
Top-level components:
• arch/ – architecture definitions (Go/Java)
• config/ – configuration loader and TOML schemas
• data/ – internal data models (e.g., Clidata)
• gogenetic-cli/ – top-level CLI entrypoint and flag parsing
• gogfile/ – template engine, file writer, per-language/per-arch templates
• gogexec/ – subprocess execution support (e.g., for Liquibase scripts)
• gog.go / gog.sh – main runner scripts
• toml/ – sample business spec files
• Makefile / scripts / SQL – build and auxiliary scripts
README for additional insights
• Workflow: load TOML → load Go templates → merge data → generate scaffold
• Supported languages: Go, Java
• Supported architectures: CRUD, CRUD-object, ES (sync/async, with/without CQRS), file
Main components and their interactions
a. User / CLI Layer
• gogenetic-cli: parses command‐line flags (outDir, tomlFiles, lang, archType, templateFile)
• gog.go / gog.sh wrappers: shell entrypoints
b. Configuration Layer
• config: reads gogconfig.toml and individual business TOML specs
• data: maps TOML into in-memory business models
c. Architecture Resolver
• arch: based on lang & archType, selects the correct arch implementation (goarch or javaarch)
d. Template Engine & File Generator
• gogfile:
– Loads templates (under gogfile/template/<lang>/<archType>)
– Applies Go’s text/template on business data
– Writes files to outDir
e. Execution Layer (optional)
• gogexec: can call out to external tools (e.g., Liquibase via liquibase.sh)
f. Supporting assets
• SQL schema (GOGENETIC_SCHEMA.sql)
• Sample TOML specs (toml/)
• Shell scripts, Makefile
Architectural patterns and design principles
• Modular layering: CLI → Config → Arch Resolver → Template Engine → Output
• Language‐agnostic core interfaces in arch and config packages
• Separation of concerns: business model parsing vs. code generation vs. external execution
Final checklist
• Clear, unique labels for every component
• Notes for extension points (e.g., “add new lang here”)
• Boundary markers for OS‐level (shell scripts) vs. Go runtime