Skip to content

maryammagdy123/fresh_cart

Repository files navigation

🛒 Fresh Cart

A modern e-commerce web app built with Next.js + TypeScript.
Designed with a clean UI, smooth user experience, and powerful functionality.


📌 Features

🛍️ Product Browsing

  • Browse products and categories with dynamic filtering and search.

🛒 Cart Management

  • Add, remove, and update items in the shopping cart seamlessly.

🔒 User Authentication

  • Register and Login functionality with protected routes for authenticated users.

📦 Orders

  • View user orders and order history in a clean interface.

📱 Responsive Design

  • Fully responsive for desktop, tablet, and mobile devices.

⚛️ State Management

  • Efficient state handling using Context API or Redux Toolkit.

✨ Animated UI

  • Smooth UI animations using Framer Motion for better user experience.

🔔 Notifications

  • Toast messages for success, warnings, and error feedback.

🛡️ API Handling

  • Robust API error handling to prevent crashes and improve reliability.

🚀 Performance Optimization

  • Code splitting and optimized loading for faster performance.

🛠 Tech Stack

  • Next.js (with App Router)
  • TypeScript
  • React Hooks & Context API or Redux Toolkit
  • Tailwind CSS for styling
  • Framer Motion for animations
  • React Hot Toast for notifications
  • Fetch API for API calls
  • ESLint + Prettier for code quality
  • Config files: next.config.ts, tsconfig.json, etc.

🚀 Getting Started

Prerequisites

  • Node.js (v18 or higher)
  • npm, yarn, or pnpm package manager

Installation

# Clone the repository
git clone https://github.com/maryammagdy123/fresh_cart.git
cd fresh_cart

# Install dependencies
npm install
# or
yarn install
# or
pnpm install

# Run the development server
npm run dev
# or
yarn dev
# or
pnpm dev

Then open http://localhost:3000 in your browser to view the app.


🧩 Folder Structure

fresh_cart/
├── public/                 # Static assets (images, favicon, etc.)
├── src/
│   ├── app/                # App router pages (Next.js)
│   ├── components/         # Reusable components
│   ├── context/            # Global state management
│   ├── hooks/              # Custom React hooks
│   ├── pages/              # Page routes (if using Pages Router)
│   ├── services/           # API calls (Axios / Fetch)
│   ├── types/              # TypeScript interfaces & types
│   ├── utils/              # Helper functions
│   ├── styles/             # CSS / Tailwind files
│   └── ...                 # Other configs / constants
├── package.json
├── tsconfig.json
├── next.config.ts
└── README.md

🔐 Authentication

  • Register new users
  • Login existing users
  • Protect private routes
  • Redirect unauthenticated users
  • JWT or API-based authentication (stored securely in cookies or local storage)

🛒 Cart & Orders Management

  • Add/remove items from the cart
  • Update item quantities
  • Checkout process connected to API
  • Display user orders history
  • Dynamic price calculation and totals

🧪 Code Quality & Testing

  • Code linting with ESLint and formatting with Prettier
  • Handle all edge cases (loading, empty states, error responses)

🛡 Error Handling

  • Use try…catch for all async operations
  • Handle server-side errors (e.g., error.response.data.message)
  • Network error detection
  • Show friendly Toast messages for all issues
  • Provide fallback UI for critical failures

📦 Deployment

  • Easy deployment via Vercel (recommended for Next.js)

  • Set environment variables (API URLs, keys, etc.)

  • Build and start commands:

    npm run build
    npm run start
  • Add SEO meta tags and Open Graph images for better discoverability


🚧 Future Improvements

  • Advanced search & filtering (by price, category, rating)
  • Admin dashboard for managing products
  • Multi-language support (i18n)
  • Product image uploads
  • Performance optimization (lazy loading, caching)

📄 License

MIT License

Copyright (c) 2025 Maryam Magdy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction...