Skip to main content
Web ApplicationCompleted

Amazon Clone: E-commerce Frontend Built on Next.js

A frontend-first clone of Amazon.com.tr built to practice shipping a real e-commerce surface with the Next.js App Router, TypeScript, Tailwind, and a small but realistic state and form layer.

DeveloperMustafa Kürşad Başer
Started: Sep 2024Completed: Nov 2024
Amazon Clone: E-commerce Frontend Built on Next.js

This is a frontend-only clone of Amazon.com.tr built with the Next.js App Router and TypeScript. It works through the parts of an e-commerce site that are easy to hand-wave and take real work in the browser: search, a cart that survives a refresh, protected pages that send you back where you were after login, saved addresses, and a checkout that ends in an order you can find again. The interface is in Turkish, prices are formatted as Turkish lira, and the whole site builds to static files.

What it does:

  • Catalog: A home page grid, a page per product and a page per category, all pre-rendered at build time from a typed product list. Categories, their URL slugs and their counts are derived from the products, and the header menu and the product breadcrumb link to them. An unknown product or category returns the not-found page
  • Search: The header box opens a results page for the query. Matching runs in the browser over title and category, every word has to appear, and text is lowercased with Turkish casing rules and stripped of diacritics, so IPHONE, ıphone and iPhone all find the Apple iPhone 13. A query with no match shows an empty state
  • Cart: Add with a quantity, change it, remove items. Adding a product already in the cart raises its quantity instead of adding a second line
  • Accounts and addresses: Register, log in, log out, and an account page with tabs for details, addresses and orders. The first address saved becomes the default, and checkout opens with it pre-filled
  • Checkout and orders: Three steps, address, payment and review, each unlocked by the one before. Placing an order empties the cart and opens a confirmation page, and orders are listed per user with the date in Turkish and a coloured status badge

How state is handled: There is no server. Three Zustand stores, for the cart, the session and orders, are each persisted to localStorage. Totals are computed from the cart when read, so there is no stored total to drift. An order copies each item's title, price, quantity and image at the moment it is placed, so later catalog changes cannot rewrite past orders. While a statically exported page hydrates, the persisted stores still report their empty initial state, so the guards on checkout and the account pages wait until the component has mounted before redirecting. Otherwise a reload would bounce a signed-in visitor to login.

Passwords: Accounts live in localStorage too, so the password itself is never written there. Registration derives a PBKDF2-SHA-256 hash through the Web Crypto API with a random 16-byte salt and 600,000 iterations, the OWASP figure, and stores the algorithm, iteration count, salt and hash together. Login re-derives with the stored parameters and compares in constant time, and the persisted session holds a profile with the credentials stripped. This keeps the password out of storage. It does not make accounts kept in a browser secure, and the code comments say so.

Forms: Every form uses React Hook Form with a Zod schema and Turkish error messages. The card fields mask input as you type: digits in groups of four, MM/YY for the expiry, three digits for the CVV.

Stack:

  • Next.js 13.5 with the App Router, configured for static export
  • TypeScript, Tailwind CSS, and shadcn/ui on Radix primitives
  • Zustand, because the global state here is small and Zustand is enough
  • React Hook Form with Zod, date-fns with the Turkish locale, Lucide icons

Limits:

  • The card fields are formatted but not validated or stored; only the chosen method reaches the order
  • Every order stays pending. The order store can change a status, but nothing calls it
  • The Buy Now button and the shortcuts in the lower header bar are not wired up, the search box is hidden on narrow screens, and the catalog holds four products

Project Gallery

Tech Stack

Next.js 13TypeScriptTailwind CSSshadcn/uiZustandReact Hook FormZodLucide Icons