Integrating gqlgen into a Feature-Based Project Structure
- Dominant language
- Go
- Stars
- 10.8k
- Forks
- 1.3k
- Avg merge
- 2d 36m
- Merged PRs (30d)
- 26
Description
I'm working on a Go project that utilizes a Feature-Based (also known as Domain-Driven Design or Vertical Slices) project structure. Our goal is for each feature (e.g., users, products, orders) to encapsulate all its related components, including GraphQL schema definitions, resolvers, models, and business logic.
A typical project structure for us looks like this:
```
.
├── go.mod
├── go.sum
├── main.go
└── internal/
├── app/ (main application setup)
├── config/
└── features/
├── users/
│ ├── graph/
│ │ ├── users.graphqls
│ │ ├── users.resolvers.go
│ │ └── users.models.go
│ ├── service/
│ │ └── users.go
│ └── repository/
│ └── users.go
├── products/
│ ├── graph/
│ │ ├── products.graphqls
│ │ ├── products.resolvers.go
│ │ └── products.models.go
│ ├── service/
│ └── repository/
└── orders/
├── graph/
│ ├── orders.graphqls
│ ├── orders.resolvers.go
│ └── orders.models.go
├── service/
└── repository/
```
How can gqlgen be instructed to generate resolvers and models directly into their respective feature-specific directories instead of a single top-level graph folder? For instance, I'd like users.resolvers.go and users.models.go to be generated within features/users/graph/
Contributor guide
Assessment
This issue has not been assessed yet.