To install the dependencies please follow the below steps
-
ensure you have node installed
node -v
.env.local
has the url
for wikipedia api that can be used to query the data
-
NextJs : Framework
-
Graphql: Query language
-
Apollo Graphql: Apollo Graphql for graphql client and server support
-
Tailwind css: Tailwind css for styling and building minimal UI
We use @apollo/server
and @apollo/client
in Nextjs
with app-rounter
because
apollo graphql
helps us use the graphql both on server and client effectively.
Nextjs
comes with support like :
- Built in Built-in Optimizations
- Automatic Image,
- Font, and Script Optimizations for improved UX and Core Web Vitals.
- Data Fetching
- Server Actions
- Advanced Routing & Nested Layouts,
- Client and Server Rendering etc.
-
ApolloProvider
: For creating an@apollo/client
and then a context to useuseQuery
hook to fetch data -
HistoryProvider
: used to save the search history of the user.
useDebounce
: For implementatino of debounce in the search box
searchWikiapi
: For handling the wikipedia api with client creation from @apollo/client
.
-
Created a graphql server at
api/graphql
-
user will enter the search query
-
The results are fetched from
@apollo/server
usingrelevance-based sorting
-
A loader is shown as user can understand that data is being fetched as visual feedback.
-
The search history is logged and shown as pills below the search input.
-
Pagination support in the api to help improve the performance of the app.
npm run dev
You will be able to access the app at http://localhost:3000
and graphql at http://loaclhost:3000/api/graphql
npm run build
npm run test