This repository demonstrates WunderGraph Cosmo's capabilities using a simplified GitHub API model with two federated subgraphs.
flowchart TD
A["Federated Graph\n(WunderGit API)"]
subgraph B[Users Subgraph]
B1[User]
B2[Organization]
B3[Owner]
end
subgraph C[Repos Subgraph]
C1[Repository]
C2[Topics]
C3[Stargazers]
end
A --> B
A --> C
Manages user and organization data with mock data for:
- Users:
octocat
,torvalds
- Organizations:
wundergraph
,github
:
Manages user and organization data
Example Queries:
query GetUserByLogin($login: String!) {
user(login: "octocat") {
id
login
name
bio
followers
following
}
}
query GetOrganization($orgLogin: String!) {
organization(login: $orgLogin) {
id
login
name
description
members
}
}
query GetCurrentViewer {
viewer {
login
name
email
}
}
Example Mutations:
mutation {
updateUserProfile(input: {
name: "Updated Name"
bio: "New bio"
location: "New Location"
}) {
id
name
bio
location
updatedAt
}
}
mutation {
followUser(userId: "2") {
id
login
followers
isViewerFollowing
}
}
Manages repository data with mock data for repositories:
wundergraph/cosmo
wundergraph/wundergraph
torvalds/linux
octocat/Hello-World
# Get repository by owner and name
query {
repository(owner: "wundergraph", name: "cosmo") {
id
name
fullName
description
stargazerCount
forkCount
topics
}
}
# List repositories
query {
repositories(first: 5) {
id
name
fullName
stargazerCount
}
}
# Search repositories
query {
searchRepositories(query: "graphql") {
id
name
description
topics
}
}
Example Mutations:
# Create a new repository
mutation {
createRepository(input: {
name: "my-new-repo"
description: "A test repository"
visibility: PUBLIC
ownerId: "1"
}) {
id
name
fullName
createdAt
}
}
# Update repository
mutation {
updateRepository(
id: "1001"
input: {
description: "Updated description"
topics: ["graphql", "federation", "typescript"]
}
) {
id
description
topics
updatedAt
}
}
# Archive repository
mutation {
archiveRepository(id: "1001") {
id
name
isArchived
}
}