This is a Next.js application built by Steven Duque for a technical screening.
The application allows a user, from the stored users.json
, to login and see appointments and medications. This application
uses simple in memory storage for the sake of simplicity.
- Typescript
- GraphQL
- React hooks
- Styled components
- @testing-library/react
- Prettier
- ESLint
pages
-- Contains components that NextJS will render to pagepages/api
-- Contains api handlers - i.e., /api/graphqlappointments
-- Contains components related to appointments UImedications
-- Contains components related to medications UIusers
-- Contains user/auth related queries and context providerprimitives
-- Contains primitive styled html components to be shared throughout UIcomponents
-- Contains shared componentsroutes
-- Contains exported ROUTES and protected route HOChooks
-- Contains hooks to be shared throughout the appgraphql
-- Contains all graphql related schema codeapollo
-- Contains apollo config and HOC helpers for NextJS
Create a .env.local
containing the following environment variables:
APP_SECRET=some_app_secret_here
MAPS_API_KEY='maps-api-key-here'
APP_SECRET
is used to sign and verify the JWT token for a user.
MAPS_API_KEY
is a google maps API key used to display appointment location information and geocode addresses.
Running the development server:
npm run dev
# or
yarn dev
Open http://localhost:3000 with your browser to see the result.
The application uses a file located at /graphql/users/users.json
for basic authentication.
App user credentials:
- email:
test@test.com
- password:
Password123
Tests are ran using the Jest test runner. Test were written using @testing-library/react and test utilities from @apollo/client.
To run tests, execute the following:
npm run test
# or
yarn test
npm run lint
# or
yarn lint
- Could have used
getServerSideProps
for server side rendering - and not using apollo client on the frontend - Could have
/api/login
endpoint which hits the/api/graphql
endpoint and sets a HTTP Secure cookie