pharmacy-store Tailwind Templates

Pharmacy Store

A modern, responsive web app for browsing and purchasing medicines, built with Next.js 15, React 19, TypeScript, and Tailwind CSS โ€” featuring clean architecture, and strict code quality standards.

๐Ÿ’Š Pharmacy Shop โ€“ Next.js / TypeScript / Tailwind

๐Ÿš€ Technologies

  • Next.js 15 (Page Router with ISR)
  • React 19
  • TypeScript with strict typing (no any)
  • Tailwind CSS (RTL support + professional custom theme)
  • ESLint (max 100 lines per file, strict rules)
  • json-server (mock API with pagination support)

๐Ÿ“ Project Structure

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

โœ… Implemented Features

  • Paginated medicine list (/product-list/[page]) using ISR
  • Shopping cart with full item info (name, price, image)
  • Cart context with add/remove/clear/getTotalPrice methods
  • Responsive and modular UI components
  • Fixed dynamic header (menu or back) with shadow
  • Clean UI layout with IRANSans font and custom Tailwind theme
  • Redirect logic for / and /product-list to default page

๐Ÿ”ง Mock API with json-server

Install:

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.


๐Ÿ”„ Git Flow

Main Branches:

  • master: production-ready code
  • develop: development base branch

Feature Branch:

git checkout -b feature/your-feature-name
# work, commit, and merge into develop

Bugfix Branch:

git checkout -b bugfix/your-bug-name
# fix, commit, and merge into develop

Release:

git checkout master
git merge develop
git tag -a v1.0.0 -m "Initial release"

๐Ÿงช ESLint Rules

  • Max 100 lines per file
  • No use of any
  • Enforce SOLID principles

๐Ÿ“œ Script Commands

"scripts": {
  "dev": "next dev --turbopack",
  "build": "next build",
  "start": "next start",
  "lint": "next lint",
  "serve": "json-server --watch db.json --port 3001"
}

๐Ÿ’ป Dev Server

npm run dev

๐Ÿ—๏ธ Build for Production

npm run build

๐Ÿš€ Start Production Server

npm run start

๐Ÿ” Lint Check

npm run lint

๐Ÿงช Run Mock API

npm run serve

โ–ถ๏ธ Getting Started

Follow these steps to run the project locally:

  1. Clone the repo

    git clone https://github.com/your-username/pharmacy-shop.git
    cd pharmacy-shop
    
  2. Install dependencies

    npm install
    
  3. Run mock API (in a separate terminal tab)

    npm run serve
    
  4. Run development server

    npm run dev
    

Visit http://localhost:3000 to access the app.


๐Ÿ‘จโ€๐Ÿ’ป Developed by

Parisa Mollazadeh โ€“ Frontend Developer :)

Top categories

Loading Svelte Themes