Automated Folder Structure & Dependency Management for Go Projects
Structura is a powerful CLI tool designed to automate the creation of consistent and production-ready folder structures for Golang projects. It supports multiple frameworks, including Gin, Echo, Fiber, and Chi, and offers flexible YAML-based configuration for managing dependencies and customizing project layouts.
Whether you're building a RESTful API or a microservice, Structura handles:
- Folder structuring
- Dependency installation
- Environment setup
- Custom configurations via YAML
- Multiple Architectures: MVC, MVCS, Hexagonal, and more
- Auto-Generates Folders & Boilerplate Files: (e.g.,
env.go,.env) - Dependency Management: Installs
viper,logrus,gin,echo, etc., usinggo get - YAML Configuration: Flexible and customizable project initialization
- Cross-Platform Compatibility: Works on Windows, Linux, and macOS
Install Structura using go install:
go install github.com/ShyamSundhar1411/structura-go@latestCompatibility: Go >=1.18
Create a new Go project with the desired architecture:
structura-go init myproject --framework ginFor Echo:
structura-go init myproject --framework echoFor Fiber:
structura-go init myproject --framework fiberFor Chi:
structura-go init myproject --framework chiIf you already have a project, you can simply generate the structure:
structura-go initWhen you run structura-go init, it generates the following folder structure:
/myproject
├── bootstrap
│ ├── env.go
├── config
│ ├── config.go
├── internal
│ ├── handlers
│ │ ├── user_handler.go
│ ├── models
│ │ ├── user.go
│ ├── services
│ │ ├── user_service.go
├── .env
├── main.go
├── go.mod
├── go.sum
Architecture Variations:
MVC:models,services,handlers,routesMVCS: Addsserviceslayer for business logic separationHexagonal: Addsadaptersandportsfolders for dependency inversion
We welcome contributions!
To contribute:
- Fork the repository
- Create a new feature branch
- Commit your changes
- Open a Pull Request (PR)
Structura is licensed under the MIT License.
Feel free to use, modify, and distribute it.
If you encounter any issues or have suggestions, feel free to open an issue on GitHub.