An e-commerce web application built with NextJS 13 using the app directory making use of Server Side Rendering (SSR) and React Server Components (RSC).
Here's a snapshot of the home page of the application: View the rest of the project here.
- NextJS 13
- React
- TypeScript
- Material UI and Emotion (for styling)
- Jest and RTL (for unit and integration testing)
- Sanity (for CMS)
- Zustand (for State Management)
- React Hook Form (for form handling)
- Zod (for handling form validation)
- Clone the application.
- Install the dependencies:
npm install
- Start the development server:
npm run dev
-
Open the local server URL (http://localhost:3000) in your web browser.
-
To run the test files:
npm run test:watch
I use Sanity CMS to manage the content of this web app. I created two different projects to handle the page content
and products
data.
We need to acess the Sanity Studio (which is unique per project) to manage the data of our projects. Sanity CMS allows us to self-host and integrate Sanity Studio to our application. In other words, the Sanity Studio of these projects will be hosted under the same domain of our application.
Links to the projects:
-
Install
prettier-plugin-sort-imports
from https://github.com/trivago/prettier-plugin-sort-imports. (See this blog for more details: https://levelup.gitconnected.com/how-to-sort-imports-in-react-project-550f5ce70cbf) -
In .prettierrc.json, add the ff:
// .prettierrc.json
{
"importOrder": ["^react(.*)", "^next(.*)", "<THIRD_PARTY_MODULES>", "@/(.*)", "^[./]"],
"importOrderSeparation": true,
"plugins": ["@trivago/prettier-plugin-sort-imports"]
}
-
You can which files is not following the rules by running
prettier --check .
in your terminal. -
To update all files to use the newly defined rules, run
prettuer --write .
in your terminal.