# Querying users and applications which exist on two different subgraphs

**URL:** <https://community.apollographql.com/t/querying-users-and-applications-which-exist-on-two-different-subgraphs/7315>\
**Category:** Schema Design\
**Tags:** federation\
**Created:** [March 19, 2024, 11:21pm UTC](https://community.apollographql.com/t/querying-users-and-applications-which-exist-on-two-different-subgraphs/7315 "2024-03-19T23:21:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![james\_anton](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/james_anton/32/4980_2.png) [@james\_anton](https://community.apollographql.com/u/james_anton)\
**Post date:** [March 19, 2024, 11:21pm UTC](https://community.apollographql.com/t/querying-users-and-applications-which-exist-on-two-different-subgraphs/7315/1 "2024-03-19T23:21:35Z")

</div>

Hello, having a situation i can’t wrap my head around with knowledge i have so thought would post question here.

Ask:  
Create a gateway using apollo federation which will expose a data structure like below

```auto
User{
 id: string;
 tracking: string;
 firstname: string;
 email: string;
 region: string;
 applications:{ // this is an array , so multiple applications per user
  status:string;
  company: string;
 }
}

```

What i already have created  
I have created two subgraphs. One for the User entity and another for the Application entity.

User Subgraph

1. Created a resolver that takes id and tracking as parameters to find a unique user. So i also denoted these two fields as Key

Application Subgraph

1. Created a resolver that takes User as input and outputs list of all applications by that user. To find applications for the user, i will need users first name, email and region.

I looked at various existing example code and they are very simple like just having ID as keys between fields. But in my case i will need to pass whole User object which is output from querying User subgraph as input to get applications. I don’t even know if this is possible, Please shed some light

so when i looked at rest example of federation, there is a gateway and below code in posts resolver.

> <https://github.com/nestjs/nest/blob/master/sample/31-graphql-federation-code-first/gateway/src/app.module.ts>

What does the code actually do ? does it forward request to gateway, such that using the typename the gateway will now route the request to Users subgraph to query user information using the passed ID parameter ?

 ![image](https://us1.discourse-cdn.com/flex019/uploads/apollographql/original/2X/1/14d63767eeb5eb9550adbb852c3abb2d5da8a589.png)
