What is Dev Quotes? It's a small project with a professional setup used to revisit NextJS and to try out some tools I had not tried before including CSS Modules and react-query
. Everything is written in strict TypeScript, even the tests. It connects to a public API for the quotes. You can find the API here: http://quotes.stormconsultancy.co.uk/
The project can be viewed live here: https://devquotes.vercel.app/ (version of main
branch)
First, run the development server:
npm run dev
# or
yarn dev
Open http://localhost:3000 with your browser to see the result.
API routes can be accessed on http://localhost:3000/api/quote. This endpoint can be edited in pages/api/quote.ts
.
The pages/api
directory is mapped to /api/*
. Files in this directory are treated as API routes instead of React pages.
To run the tests:
npm test
# or
yarn test
- Fetch a single quote
- Continuously fetch new quotes in a loop on a timer, indicated by a progress bar. Kind of like a slide show.
- Share quotes on Twitter, Facebook or WhatsApp
The tests can be found in the __tests__
directory. The tests are also written in TypeScript.
Jest features like fake timers and mocking have been used to skip timers and to mock requests.
React Testing Library has been used to mimic user interactions as much as possible in the tests.
- TypeScript
- ReactJS
- NextJS
- CSS modules
- Jest
- React Testing Library
- react-share
- Babel
- ESLint
- Prettier
- Husky
- Lint Staged
This is a Next.js project bootstrapped with create-next-app
.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.