Thanks for your interest.
Create a React
and Node.js
backend application using GraphQL
.
- Fork this repo to your own account.
- Build the application as per the Instructions below.
- This application needs to be written fully in
TypeScript
. Define types as much as possible. Do not useany
type. - We'll be looking for clean code as much as possible.
- Once done, please commit your code to your forked repo and share the link with us.
Good luck
Folder structure is up to you. You can use the following structure:
├── backend
│ ├── src
│ │ ├── index.ts
│ │ ├── schema.ts
│ │ ├── resolvers.ts
│ │ └── data.json
│ ├── package.json
│ ├── tsconfig.json
│ └── ...
├── frontend
│ ├── src
│ │ ├── index.tsx
│ │ ├── App.tsx
│ │ ├── pages
│ │ │ ├── listing.tsx
│ │ │ └── detail.tsx
│ │ └── ...
│ ├── package.json
│ ├── tsconfig.json
│ └── ...
├── README.md
└── ...
- Read the Sample data using the
File system
module. You can create adata.json
file and read the data from it. - Create a
GraphQL
server usingApollo Server
and expose the data as follows:- Create a
Query
type with aclients
field that returns the list of clients. - Create a
Client
type with the following fields:id
name
age
gender
additionalInfo
- Create a
AdditionalInfo
type with the following fields:company
email
phone
address
- Create a
- Create a
React
application usingVite
. - Read data from the
GraphQL
server using Apollo client and render the data as follows:- Store read data in a global state using React context or Redux/Redux toolkit.
- Create a listing page that shows the
id
,name
andage
of the clients in a table. When the user clicks on thename
, navigate to a detail page. Usereact-router-dom
. Use version 6.4 or above. Usage of routeloader
,Outlet
,defer
,Awaited
andSuspense
is a plus. - Create a detail page that shows the
id
,name
,age
,gender
andadditionalInfo
of the client. - Style the pages as you see fit. Feel free to use one of the CSS frameworks below:
Some of the following are not required but will be a plus.
- Store the data in a database. You can use
PostgreSQL
orMySQL
. - Use
TypeGraphQL
to define theGraphQL
schema. - Use
Sequelize
to define the database models. - Create migrations for the database models.
- Create unit tests for the backend using
Jest
. - Create unit tests for the frontend using
Jest
andReact Testing Library
. - Use codegen to generate types for the
GraphQL
schema to be used in the frontend.
{
"clients": [
{
"id": "59761c23b30d971669fb42ff",
"age": 36,
"name": "Dunlap Hubbard",
"gender": "male",
"additionalInfo": {
"company": "CEDWARD",
"email": "[email protected]",
"phone": "+1 (890) 543-2508",
"address":
"169 Rutledge Street, Konterra, Northern Mariana Islands, 8551"
}
},
{
"id": "59761c233d8d0f92a6b0570d",
"age": 24,
"name": "Kirsten Sellers",
"additionalInfo": {
"gender": "female",
"company": "EMERGENT",
"email": "[email protected]",
"phone": "+1 (831) 564-2190",
"address": "886 Gallatin Place, Fannett, Arkansas, 4656"
}
},
{
"id": "59761c23fcb6254b1a06dad5",
"age": 30,
"name": "Acosta Robbins",
"additionalInfo": {
"gender": "male",
"company": "ORGANICA",
"email": "[email protected]",
"phone": "+1 (882) 441-3367",
"address": "697 Linden Boulevard, Sattley, Idaho, 1035"
}
},
]
}