Discount codes
L2–L4
Level range
8
Sprints
36
Tasks
Backend and frontend
Built as
What you’ll build
A shop that takes discount codes. Buyers see exactly what a code takes off before they order, and no mix of codes can make an order free. A code stops working as soon as its last use is taken, and a refund gives back what was actually paid.
A skill in every sprint
You show you have it in a pull request your team reviews, then explain it in a walkthrough.
Authentication
You can register and sign in a user, keep a request authenticated without asking for the password again, and explain where the credential lives in the browser and why there rather than somewhere else.
A cart that survives
You can add, change and remove items, keep the cart across a logout and login, and show a total that reflects prices as they are now.
Discount codes
You can apply a valid code, refuse an invalid one with a reason, and show that a single-use code cannot be used twice.
An order that moves through states
You can move an order through its states, refuse a transition that should not happen, and show the history of how it got where it is.
Going live
Somebody who has never met you can open a URL and use the product — and you can say what is different about the copy running there, where its secrets come from, and what you do when a release turns out to be wrong.
8 sprints, 36 tasks
Every sprint has a goal and a set of tasks. Open a sprint to see the tasks you will pick up.
- Sprint 01
Knowing who is shopping
A buyer can create an account and come back to it, and nobody can give themselves a shop account.
4 tasks
- Let a buyer create an account and be signed in straight away
- Let a buyer sign back in and stay signed in overnight
- Let a buyer sign out on a shared laptop and leave nothing behind
- Stop anyone creating a shop account from the sign-up form
- Sprint 02
A basket worth discounting
A buyer can fill a basket that is still there tomorrow, and see a total made of lines they can check.
4 tasks
- Let the shop list items with prices that buyers can see
- Keep a buyer's basket when they close the laptop
- Show the basket's working, not just a total
- Tell the buyer when a price in their basket has changed
- Sprint 03
Codes that come off
The shop writes a code with rules, a buyer applies it, and a code that does not apply is refused with a reason the buyer can act on.
5 tasks
- Let the shop write a code and see its rules in plain words
- Let a buyer apply a code and see exactly what it took off
- Refuse a code that does not apply, with a reason the buyer can act on
- Make a code's dates mean London time on the shop's own clock
- Make the server refuse code changes from anyone but the shop
- Sprint 04
Two codes, one basket
A second code either combines by a rule the shop set or is refused with the reason, and no mix of codes takes the order to nothing.
5 tasks
- Let the shop decide whether a code can be combined with others
- Tell a buyer which code is already on the basket when a second is refused
- Apply combined codes in one fixed order: percentages first
- Stop any mix of codes taking the goods below zero or touching postage
- Check every code again whenever the basket changes
- Sprint 05
The price on the order
A basket becomes an order at the price the buyer was shown, and the order shows how that price was reached.
4 tasks
- Turn a basket into an order at the price on the screen
- Record on each order exactly how its price was reached
- Check every code again before an order is placed
- Allow only forward moves between order stages, and record each one
- Sprint 06
When a code runs out
A code with a limit stops at the limit, including when the last two uses arrive at the same moment.
4 tasks
- Let the shop set usage limits on a code and watch the count
- Count a code's use when the order is placed, not when the code is typed
- Prove that two buyers cannot both take a code's last use
- Hold a one-per-customer code to one use per account
- Sprint 07
Taking the discount out
A refund returns what was paid, for a whole order or part of one, and the code's use count follows a rule the shop can see.
5 tasks
- Refund a whole order for exactly what was charged
- Refund one line for its share of what was paid
- Refund a partial return without taking back the discount
- Keep a refunded order's code use spent, and say so
- Show the buyer what came back on their order and why
- Sprint 08
Open for business
A stranger can reach the shop at its own address and run the whole promotion there, on a clock that agrees with the codes.
5 tasks
- Put the shop on a host that strangers can reach
- Read every setting and secret from the environment
- Make the live shop agree with the codes about time and money
- Have someone else run the whole promotion on the live shop
- Make a bad release quick to undo, and failures visible
Read before you build
Senior engineers read the docs before they touch the code. Every Blueprint comes with short documents on the product and its world, the kind a team hands a new hire. Read them well and you ask sharper questions and walk into every review prepared.
What you are building
The product, the two kinds of people who use it, and why a discount code is a set of rules, not just a form.
How a shop's promotion actually works
Shop knowledge you may not have: margin, what a code is made of, and why shops worry about their own promotions.
More commerce Blueprints
Corner shop storefront
An online shop for one small corner shop. The shelf shows what is really in stock, a basket is still there the next day, the shop never takes money for something it does not have, and the shopper can follow their order until they collect it.
Food ordering with options
Online ordering for one restaurant, where a dish is a set of choices, not a single price. A size sets the price, extras add to it, some extras only come on some sizes, and the total is worked out by the server from what the customer chose, never taken from the browser.
Restock waitlist
A waiting list for things a small shop has sold out of. People ask to be told when a thing comes back. When three come back, the stock goes to people in the order they asked. Each unit is held long enough for the person to act, is offered to nobody behind them until that time ends, and is never offered to the same person twice.
Not the one for you?
Every Blueprint is planned the same way, across health, shopping, money, education and more.
Browse all BlueprintsBuild discount codes.
Start your free week. Adaeze runs your kickoff, and Lars reviews every pull request.
Start today, for free