A modern, full-featured online medicine e-commerce platform built with Next.js 16, TypeScript, and Tailwind CSS 4.
MediStore provides a seamless shopping experience for customers, a powerful dashboard for sellers to manage medicines and orders, and a comprehensive admin panel for platform-wide management.
The application is live and accessible at the following URL:
- Live Demo
- Features
- Tech Stack
- Project Structure
- Prerequisites
- Installation
- Environment Variables
- Running the Project
- Authentication & Authorization
- Route Architecture
- UI Components
- API Proxy & Backend Integration
- Animations
- Deployment
- Scripts
- License
- Product Browsing β Browse medicines by category, brand, and search
- Shopping Cart β Add/remove medicines, adjust quantities
- Checkout Flow β Complete order placement with a streamlined checkout
- Order Tracking β View order history and individual order details
- User Profile β View and manage account information
- Seller Dashboard β Overview of sales, orders, and medicine inventory with parallel slots (
@medicines,@orders) - Add Medicine β Create new medicine listings
- Update Medicine β Edit existing medicine details
- Order Management β View and manage incoming orders
- Admin Dashboard β Platform-wide overview with charts and statistics (powered by Recharts)
- User Management β View and manage all registered users
- Order Management β Monitor and manage all orders across the platform
- Category Management β Create and manage medicine categories
- Home Page β Hero section, featured products, categories, brands, testimonials, blog, FAQ, newsletter, and promotional banners
- Shop β Full product listing and browsing
- Login / Register β Secure user authentication with animated Lottie visuals
- Static Pages β Contact, FAQ, Privacy Policy, Refund Policy, Shipping Policy, Terms & Conditions
- 404 Page β Custom "Not Found" page
- Dark / Light Mode β System-aware theme toggling via
next-themes - Responsive Design β Mobile-first layout with responsive navigation and sidebar
- Smooth Animations β Powered by Framer Motion and GSAP
- Lottie Animations β Animated JSON visuals on login and registration pages
- Toast Notifications β User feedback with Sonner
- Image Carousels β Embla Carousel with autoplay for hero/slider sections
| Category | Technology |
|---|---|
| Framework | Next.js 16 (App Router) |
| Language | TypeScript 5 |
| Styling | Tailwind CSS 4 + tw-animate-css |
| UI Components | Shadcn UI (Radix UI primitives) |
| Authentication | Better Auth |
| Env Validation | @t3-oss/env-nextjs |
| Animations | Framer Motion, GSAP, Lottie React |
| Charts | Recharts |
| Carousel | Embla Carousel + Swiper |
| Icons | Lucide React, React Icons |
| Notifications | Sonner |
| Theming | next-themes |
| React | React 19 |
mediStore_frontend/
βββ public/ # Static assets
β βββ homeImage/ # Home page images
β βββ logo/ # Brand logos
β βββ sliderImage/ # Carousel / slider images
β βββ capsule.png # Decorative asset
β
βββ src/
β βββ animation/ # Lottie JSON animation files
β β βββ Login.json # Login page animation
β β βββ Registration.json # Registration page animation
β β
β βββ app/ # Next.js App Router
β β βββ layout.tsx # Root layout (ThemeProvider + Toaster)
β β βββ globals.css # Global styles & Tailwind directives
β β βββ loading.tsx # Global loading state
β β βββ not-found.tsx # Custom 404 page
β β β
β β βββ (public)/ # Public route group (no auth required)
β β β βββ page.tsx # Home page
β β β βββ layout.tsx # Public layout (Navbar + Footer)
β β β βββ login/ # Login page
β β β βββ register/ # Registration page
β β β βββ shop/ # Shop / product listing
β β β βββ profile/ # User profile
β β β βββ (others)/ # Static info pages
β β β βββ contact/
β β β βββ faq/
β β β βββ privacy/
β β β βββ refundPolicy/
β β β βββ shipingPolicy/
β β β βββ terms/
β β β
β β βββ (customer)/ # Customer route group (auth required)
β β β βββ layout.tsx # Customer layout
β β β βββ cart/ # Shopping cart
β β β βββ checkout/ # Checkout flow
β β β βββ orders/ # Order history & details
β β β βββ page.tsx # Orders list
β β β βββ [id]/ # Individual order detail
β β β
β β βββ seller/ # Seller route group (auth required)
β β β βββ layout.tsx # Seller layout (Sidebar)
β β β βββ dashboard/ # Seller dashboard
β β β βββ addMedicine/ # Add new medicine
β β β βββ updateMedicine/ # Update existing medicine
β β β βββ (dashboard)/ # Parallel routes
β β β βββ @medicines/ # Medicines slot
β β β βββ @orders/ # Orders slot
β β β
β β βββ (admin)/ # Admin route group (auth required)
β β βββ admin/
β β βββ page.tsx # Admin dashboard (charts & stats)
β β βββ layout.tsx # Admin layout (Sidebar)
β β βββ users/ # User management
β β βββ orders/ # Order management
β β βββ categories/ # Category management
β β
β βββ components/
β β βββ ui/ # Shadcn UI components (24 components)
β β β βββ accordion.tsx βββ button.tsx βββ card.tsx
β β β βββ dialog.tsx βββ dropdown-menu.tsx
β β β βββ input.tsx βββ label.tsx βββ select.tsx
β β β βββ sheet.tsx βββ sidebar.tsx βββ table.tsx
β β β βββ navigation-menu.tsx βββ ...more
β β β
β β βββ home/ # Homepage section components
β β β βββ HeroSection.tsx
β β β βββ FeaturedProducts.tsx
β β β βββ CategoriesSection.tsx
β β β βββ BrandSection.tsx
β β β βββ TestimonialsSection.tsx
β β β βββ BlogSecion.tsx
β β β βββ FAQSection.tsx
β β β βββ HowItWorksSection.tsx
β β β βββ NewsletterSection.tsx
β β β βββ PromoSection.tsx
β β β βββ banner.tsx
β β β βββ themeToggleSwitch.tsx
β β β
β β βββ shared/ # Shared layout components
β β β βββ navbar1.tsx # Main navigation bar
β β β βββ Footer.tsx # Site footer
β β β βββ LoadingPage.tsx # Loading skeleton
β β β βββ app-sidebar.tsx # Dashboard sidebar
β β β βββ SidebarHeader.tsx
β β β βββ SidebarUserCard.tsx
β β β
β β βββ login-form.tsx # Login form component
β β βββ signup-form.tsx # Registration form component
β β βββ search-form.tsx # Search bar component
β β βββ version-switcher.tsx
β β
β βββ hooks/
β β βββ use-mobile.ts # Custom hook for mobile detection
β β
β βββ lib/
β β βββ auth.ts # Server-side auth configuration
β β βββ auth-client.ts # Client-side auth (Better Auth)
β β βββ utils.ts # Utility functions (cn helper)
β β
β βββ provider/
β β βββ themeProvider.tsx # next-themes ThemeProvider wrapper
β β
β βββ services/
β β βββ user.service.ts # User session service (server-side)
β β
β βββ utils/
β β βββ SectionContainer.tsx # Reusable section wrapper
β β
β βββ env.ts # Environment variable validation (Zod)
β βββ proxy.ts # Route protection middleware
β
βββ .env # Environment variables
βββ components.json # Shadcn UI configuration
βββ next.config.ts # Next.js configuration (API rewrites)
βββ postcss.config.mjs # PostCSS configuration
βββ tailwind.config.ts # Tailwind CSS configuration
βββ tsconfig.json # TypeScript configuration
βββ package.json # Dependencies and scripts
- Node.js β v20.0.0 or higher
- npm β v10.0.0 or higher (or use
yarn/pnpm/bun) - Backend API β A running instance of the MediStore Backend (see Backend Integration)
-
Clone the repository
git clone https://github.com/your-username/mediStore_frontend.git cd mediStore_frontend -
Install dependencies
npm install
-
Set up environment variables (see Environment Variables)
-
Start the development server
npm run dev
-
Open in browser
Navigate to http://localhost:3000
Create a .env file in the project root with the following variables:
# Backend API base URL
backendBaseUrl=https://your-backend-url.com
# Frontend base URL (used by Better Auth)
frontendBaseUrl=https://your-frontend-url.com
# Better Auth URL
BETTER_AUTH_URL=https://your-frontend-url.com
# Public backend URL (client-side access)
NEXT_PUBLIC_backendBaseUrl=https://your-backend-url.com| Variable | Description | Required |
|---|---|---|
backendBaseUrl |
Base URL of the MediStore backend API | β Yes |
frontendBaseUrl |
Base URL of this frontend application | β Yes |
BETTER_AUTH_URL |
URL for Better Auth session management | β Yes |
NEXT_PUBLIC_backendBaseUrl |
Public backend URL accessible from the client | β Yes |
Note: Environment variables are validated at runtime using
@t3-oss/env-nextjswith Zod schemas insrc/env.ts.
# Development server (with hot reload)
npm run dev
# Production build
npm run build
# Start production server
npm start
# Run ESLint
npm run lintMediStore uses Better Auth for authentication, with session management handled server-side through cookies.
- Client-side:
authClientis initialized insrc/lib/auth-client.tsusingcreateAuthClientfrombetter-auth/react - Server-side: Sessions are verified by forwarding cookies to the backend's
/api/auth/meendpoint viasrc/services/user.service.ts - Route Protection: The middleware in
src/proxy.tsintercepts requests to protected routes and enforces role-based access
| Role | Accessible Routes | Restricted From |
|---|---|---|
| CUSTOMER | /cart, /checkout, /orders, /profile |
/admin/*, /seller/* |
| SELLER | /seller/dashboard, /seller/addMedicine, /seller/* |
/admin/*, /cart, /orders |
| ADMIN | /admin/*, /admin/users, /admin/orders |
/seller/*, /cart, /checkout |
/cart, /checkout, /orders/*, /profile, /seller/*, /admin/*
Unauthenticated users are redirected to /login. Users accessing routes outside their role are redirected to their respective dashboard.
MediStore uses Next.js App Router with route groups to organize pages by access level:
| Route Group | Path Prefix | Description | Auth Required |
|---|---|---|---|
(public) |
/ |
Home, shop, login, register, info pages | β No |
(customer) |
/ |
Cart, checkout, orders | β Yes |
(admin) |
/admin |
Admin dashboard, users, orders, categories | β Yes |
seller |
/seller |
Seller dashboard, medicine management | β Yes |
The seller dashboard at seller/(dashboard) uses Next.js parallel routes with named slots:
@medicinesβ Displays medicine inventory@ordersβ Displays order overview
Both render simultaneously in the seller dashboard layout.
The project uses 24 Shadcn UI components built on top of Radix UI primitives:
| Component | Component | Component |
|---|---|---|
| Accordion | Alert | Avatar |
| Badge | Breadcrumb | Button |
| Card | Dialog | Dropdown Menu |
| Field | Input | Label |
| Navigation Menu | Scroll Area | Select |
| Separator | Sheet | Sidebar |
| Skeleton | Sonner (Toast) | Spinner |
| Table | Textarea | Tooltip |
The home page is composed of 12 modular section components:
HeroSectionβ Main hero banner with call-to-actionFeaturedProductsβ Highlighted medicine productsCategoriesSectionβ Browse by medicine categoryBrandSectionβ Featured pharmaceutical brandsTestimonialsSectionβ Customer reviews and testimonialsBlogSecionβ Health and wellness blog postsFAQSectionβ Frequently asked questions (accordion)HowItWorksSectionβ Step-by-step guideNewsletterSectionβ Email subscription formPromoSectionβ Promotional bannersbannerβ Top announcement bannerthemeToggleSwitchβ Dark/light mode toggle
navbar1β Main responsive navigation barFooterβ Site-wide footerLoadingPageβ Full-page loading skeletonapp-sidebarβ Collapsible dashboard sidebar (admin & seller)SidebarHeaderβ Sidebar header with brandingSidebarUserCardβ User info card in sidebar
MediStore Frontend acts as a proxy to the backend API using Next.js rewrites configured in next.config.ts:
async rewrites() {
return [
{
source: "/api/auth/:path*",
destination: `${process.env.backendBaseUrl}/api/auth/:path*`,
},
{
source: "/api/:path*",
destination: `${process.env.backendBaseUrl}/api/:path*`,
},
];
}This means:
- All requests to
/api/*on the frontend are forwarded to the backend - Auth-specific routes (
/api/auth/*) are matched first for priority - The backend URL is configured via the
backendBaseUrlenvironment variable - No API routes exist in the frontend itself β all data comes from the external backend
MediStore uses three animation libraries for a rich, interactive experience:
| Library | Usage |
|---|---|
| Framer Motion | Page transitions, component mount/unmount animations, hover effects |
| GSAP | Complex timeline animations, scroll-triggered effects |
| Lottie React | JSON-based vector animations on login & registration pages |
Lottie animation files are stored in src/animation/:
Login.json(~227 KB) β Animated visual on the login pageRegistration.json(~53 KB) β Animated visual on the registration page
This project is live and deployed on Vercel:
π Production URL: https://medi-store-frontend-khaki.vercel.app/
To deploy your own instance:
- Fork this repository
- Import the project on Vercel
- Configure the environment variables in the Vercel dashboard
- Deploy!
# Build the production bundle
npm run build
# Start the production server
npm startNote: Ensure your hosting platform supports Node.js and Next.js server-side rendering.
| Script | Command | Description |
|---|---|---|
dev |
npm run dev |
Start development server |
build |
npm run build |
Create production build |
start |
npm run start |
Start production server |
lint |
npm run lint |
Run ESLint for code quality |
This project is private and not licensed for public distribution.
Built with β€οΈ by Md Abu Syeed Abdullah
