https://github.com/egocentryk/graphql-code-first-approach
Code-first approach to creating GraphQL APIs with Nest. It contains GraphQL concepts, tips & tricks, and patterns to create your own enterprise-grade GraphQL APIs.
https://github.com/egocentryk/graphql-code-first-approach
dataloader field-resolver graphql interfaces middleware resolvers scalar-types subscriptions typescript
Last synced: 10 months ago
JSON representation
Code-first approach to creating GraphQL APIs with Nest. It contains GraphQL concepts, tips & tricks, and patterns to create your own enterprise-grade GraphQL APIs.
- Host: GitHub
- URL: https://github.com/egocentryk/graphql-code-first-approach
- Owner: egocentryk
- Created: 2025-02-27T14:32:06.000Z (11 months ago)
- Default Branch: dev
- Last Pushed: 2025-03-02T14:40:07.000Z (11 months ago)
- Last Synced: 2025-03-02T15:23:09.609Z (11 months ago)
- Topics: dataloader, field-resolver, graphql, interfaces, middleware, resolvers, scalar-types, subscriptions, typescript
- Language: TypeScript
- Homepage:
- Size: 528 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Project description
Code-first approach to creating GraphQL APIs with [Nest](https://github.com/nestjs/nest). It contains GraphQL concepts, tips & tricks, and
patterns to create your own enterprise-grade GraphQL APIs.
## Project setup
```bash
$ pnpm install
```
## Docker
```bash
$ docker-compose up -d
```
-d flag stands for detached mode: run containers in the background
## GraphQL operation types
### Queries
```graphql
{
coffees {
id
name
brand
flavors {
id
name
}
createdAt
}
}
query ($coffeeId: ID!) {
coffee(id: $coffeeId) {
id
name
brand
flavors {
name
}
createdAt
}
}
{
drinks {
... on Tea {
name
}
... on Coffee {
name
brand
}
}
}
```
### Mutations
```graphql
mutation {
createCoffee(
createCoffeeInput: {
name: "Caramel Coffee"
brand: "Jacobs"
flavors: ["carameal", "sweat", "creamy"]
type: AMERICANO
}
) {
id
name
brand
flavors {
name
}
createdAt
}
}
mutation {
updateCoffee(
id: 1
updateCoffeeInput: { name: "Cappuccino", flavors: ["milky"] }
) {
name
flavors {
name
}
}
}
mutation {
removeCoffee(id: 1) {
name
}
}
```
### Subscription
```graphql
subscription {
coffeeAdded {
id
name
brand
}
}
```
## Deployment
Check out [Mau](https://mau.nestjs.com), Nest official platform for deploying NestJS applications on AWS.
## Resources
Check out a few resources that may come in handy when working with NestJS:
- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.
- Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks.
- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).
## License
Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).