- Stack
- HTML, CSS and JavaScript, no dependencies
- In numbers
- 8 pages, 42 products, 4 keys in
localStorage - Hosting
- Static files on GitHub Pages
What it is
DECKED is a fictional Venice Beach skate shop. You can browse products, filter by category, add items to a cart, and go through a demo login and checkout. The cart and order history stay in the same browser between visits. No real account is created and no payment is taken.
I built it with plain HTML, CSS, and vanilla JavaScript. There is no framework, no build step, and no backend.
The problem
I wanted the shopping flow to carry on from one page to the next while keeping the site as static files on GitHub Pages.
The biggest problem was that DECKED is a multi-page site. Every time you click a link, the page reloads and JavaScript starts over. The cart on the home page and the cart on the checkout page are not the same running script, so they have to share data some other way.
The decisions
Storing the data
To solve the reloading problem, I used localStorage. The site saves everything it needs to remember under four keys. When a page loads, it reads these keys. When something changes, it updates them right away.
| Key | What it holds |
|---|---|
| decked_cart | Product IDs and quantities |
| decked_user | Name and email, or nothing |
| decked_orders | Number, date, items, total |
| decked_stock | Any stock levels I overrode |
Instead of saving the whole product in the cart, I only save the product ID and the quantity. The name, price, and image always come from the main product list. This keeps the data simple and stops the cart from showing old prices if I update the catalogue.
Sharing the cart across pages
The header, mobile menu, footer and cart drawer are written once, in a layout script that every page loads and that drops them into three placeholders. A second shared script fills the drawer from the saved cart, updates the item count in the header and checks for a saved demo user. The first version pasted that markup into all eight pages, and two accessibility labels had already gone missing from seven of them. With everything in one place, a fix happens once.
Fake login and checkout
Registration asks for a name, email, and password, but only saves the name and email. Login also requires a password field to be filled in, but does not check it against anything. It saves the email and builds a display name from it. For example, jordan.vega@email.com becomes Jordan Vega. This lets me build the screens and redirects without pretending they are real authentication.
Checkout and the account page need a user to be logged in. If a visitor tries to go there without logging in, the site sends them to the login page first, then brings them back to checkout. The page to return to travels in the link, so the login page only ever follows two destinations, checkout or the account page, and ignores anything else it is given.
Finishing the order
When the user finishes checkout, the site creates a fake order number, adds shipping, and saves the order to localStorage. Then it clears the cart and shows a success message.
The card fields come filled with sample values and cannot be edited, so nobody types real payment details and the browser has nothing to autofill.
The order keeps a copy of the item names and prices at checkout, so later catalogue edits do not rewrite it. It stays available until the browser's saved data is cleared. Orders are shared within that browser, not separated into real user accounts.
A second pass
Months after calling it finished, I went back through the shop the way a stranger would. The login page was following any address placed in its link, including other sites, and the name and email typed at registration were being written into the page as raw HTML. Both are closed now: only two destinations are accepted, and everything a visitor types is escaped before it is shown.
var nextParam = new URLSearchParams(window.location.search).get('next');
window.location.href = nextParam === 'checkout.html' ? 'checkout.html' : 'account.html';
js/pages/login.js: whatever the link says, login leads to one of two pages.The same pass showed that the product cards took focus from the Tab key but could not be opened with it. They are real links now. The cart drawer takes focus when it opens, closes on Escape and stays out of the tab order while shut, and the animations stop for visitors who ask for reduced motion.
What I would do differently
For a real shop, accounts, prices, stock, and orders would need to be checked and stored on a server. Browser storage can be edited or cleared by the visitor. Payments would also need a payment provider rather than this simulated checkout.
I would also check keyboard access, and anything a visitor can type, while building and not afterwards. The second pass found problems that had been there since the first day, and none of them was hard to fix once someone looked.
More work on the home page, or the stack behind each project on the CV.