any
)src/
โโโ api/ # API logic abstraction
โโโ components/ # UI components (ProductCard, Header, CartBadge...)
โโโ context/ # Cart context provider (React context API)
โโโ layouts/ # App layout with dynamic header
โโโ pages/
โ โโโ index.tsx # Redirect to /product-list/1
โ โโโ cart.tsx # Cart page
โ โโโ product-list/
โ โโโ [page].tsx # Paginated product list
โ โโโ index.tsx # Redirect to first page
โโโ styles/
โ โโโ globals.css
โโโ types/
โ โโโ medicine.ts # Type for Medicine
โโโ utils/
โ โโโ price.ts # Format price utility
/product-list/[page]
) using ISRmenu
or back
) with shadow/
and /product-list
to default pageInstall:
npm install --save-dev json-server
Run:
npx json-server --watch db.json --port 3001
Test:
curl -H "Accept: application/json" http://localhost:3001/medicines?_page=2&_limit=4
Make sure X-Total-Count
is included in the response header.
master
: production-ready codedevelop
: development base branchgit checkout -b feature/your-feature-name
# work, commit, and merge into develop
git checkout -b bugfix/your-bug-name
# fix, commit, and merge into develop
git checkout master
git merge develop
git tag -a v1.0.0 -m "Initial release"
any
"scripts": {
"dev": "next dev --turbopack",
"build": "next build",
"start": "next start",
"lint": "next lint",
"serve": "json-server --watch db.json --port 3001"
}
npm run dev
npm run build
npm run start
npm run lint
npm run serve
Follow these steps to run the project locally:
Clone the repo
git clone https://github.com/your-username/pharmacy-shop.git
cd pharmacy-shop
Install dependencies
npm install
Run mock API (in a separate terminal tab)
npm run serve
Run development server
npm run dev
Visit http://localhost:3000
to access the app.
Parisa Mollazadeh โ Frontend Developer :)