99designs / 99designs/gqlgen

Integrating gqlgen into a Feature-Based Project Structure

Open
#3,761 1 comment 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.