Skip to content

feat: add wundergraph to gateway section #1285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ exports.onCreatePage = async ({ page, actions }) => {
otherLibraries: {
Services: codeData.Services,
Tools: sortedTools,
Gateways: codeData.Gateways,
"More Stuff": codeData["More Stuff"],
},
languageList: languageList.sort((a, b) => {
Expand Down
86 changes: 86 additions & 0 deletions src/content/code/gateways/wundergraph.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
name: WunderGraph
description: WunderGraph is an open-source GraphQL Gateway that is able to compose Apollo Federation, GraphQL, REST APIs, Databases, Kafka and more.
url: https://wundergraph.com
github: wundergraph/wundergraph
---
[WunderGraph](https://wundergraph.com) composes all your APIs into a single unified GraphQL API and
allows you to expose your Graph as a [secure and type-safe JSON-RPC API](https://docs.wundergraph.com/docs/features/graphql-to-json-rpc-compiler).

To get started with WunderGraph, you can use `create-wundergraph-app` to bootstrap a new project:

```bash
npx create-wundergraph-app my-project -E nextjs-swr
```

On the client side, WunderGraph's JSON-RPC API integrates very well with frameworks like [Next.js, SWR](https://github.com/wundergraph/wundergraph/tree/main/examples/nextjs-swr) and React Query,
while one the backend, we're able to leverage the power of "Server-Side-Only GraphQL".
Handle authentication, authorization, validation, joins and more right in the Query Layer.

```graphql
mutation (
$name: String! @fromClaim(name: NAME)
$email: String! @fromClaim(name: EMAIL)
$message: String! @jsonSchema(pattern: "^[a-zA-Z 0-9]+$")
) {
createOnepost(
data: {
message: $message
user: {
connectOrCreate: {
where: { email: $email }
create: { email: $email, name: $name }
}
}
}
) {
id
message
user {
id
name
}
}
}
```

The Query above requires the user to be authenticated,
injects the user's name and email from the JWT token and validates the message against a JSON Schema.

Here's another example showcasing how we can use Server-Side GraphQL with WunderGraph's unique [join capabilities](https://docs.wundergraph.com/docs/features/cross-api-joins-to-compose-apis),
composing data from two different APIs into a single GraphQL response.

```graphql
query (
$continent: String!
# the @internal directive removes the $capital variable from the public API
# this means, the user can't set it manually
# this variable is our JOIN key
$capital: String! @internal
) {
countries_countries(filter: { continent: { eq: $continent } }) {
code
name
# using the @export directive, we can export the value of the field `capital` into the JOIN key ($capital)
capital @export(as: "capital")
# the _join field returns the type Query!
# it exists on every object type so you can everywhere in your Query documents
_join {
# once we're inside the _join field, we can use the $capital variable to join the weather API
weather_getCityByName(name: $capital) {
weather {
temperature {
max
}
summary {
title
description
}
}
}
}
}
}
```

The full [example can be found on GitHub](https://github.com/wundergraph/wundergraph/tree/main/examples/cross-api-joins).
3 changes: 2 additions & 1 deletion src/content/code/slug-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@
"client": "Client",
"server": "Server",
"tools": "Tools",
"services": "Services"
"services": "Services",
"gateways": "Gateways"
}
12 changes: 12 additions & 0 deletions src/pages/code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ const categorySlugMap = [
["Server", toSlug("Server")],
["Client", toSlug("Client")],
["Tools", toSlug("Tools")],
["Gateways", toSlug("Gateways")],
]

export function buildLanguagesContent(pageContext: any) {
Expand Down Expand Up @@ -228,6 +229,9 @@ export default ({ pageContext }: PageProps<object, GatsbyTypes.SitePageContext>)
<AnchorLink to="#services" title="Services">
<h3>Services</h3>
</AnchorLink>
<AnchorLink to="#gateways" title="Gateways">
<h3>Gateways</h3>
</AnchorLink>
</div>
</div>
</div>
Expand All @@ -253,6 +257,14 @@ export default ({ pageContext }: PageProps<object, GatsbyTypes.SitePageContext>)
</AnchorLink>
</h2>
{buildLibraryList(pageContext.otherLibraries?.Services ?? [], pageContext)}
<h2>
<a className="anchor" id="gateways"></a>
Gateways
<AnchorLink className="hash-link" to="#gateways">
#
</AnchorLink>
</h2>
{buildLibraryList(pageContext.otherLibraries?.Gateways ?? [], pageContext)}
</div>
</div>
<p>Want to improve this page? See the <a href="https://github.com/graphql/graphql.github.io/blob/source/notes/ContributingToCodePage.md">docs here</a>.</p>
Expand Down