All BlueprintsCommerce

Discount codes

A promotion for one small shop: the shop writes codes with rules, a buyer sees exactly what a code took off, and the rules refuse to combine into an order the shop is paying somebody to accept.

L2–L4Level range
8Sprints
36Tasks
Backend and frontendBuilt as

What you’ll build.

By the last sprint

A shop that takes discount codes. Customers see exactly what a code takes off before they pay, and cannot stack two codes down to nothing. A code stops working the moment its last use is taken, and refunds give back what was actually paid.

What you’ll learn.

Each sprint is built around one skill. 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.

The roadmap. 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 make an account and come back to it, and nobody can issue themselves a shop account.

4 tasks
  1. A buyer can register and land signed in
  2. A buyer's account is still theirs tomorrow
  3. Signing out on a shared laptop leaves nothing behind
  4. The shop's own accounts cannot be handed out by a 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
  1. The shop has things to sell, at prices a buyer can see
  2. A basket survives the buyer closing the laptop
  3. The basket shows its working, not just a total
  4. A price that changed overnight does not change quietly
Sprint 03

Codes that come off

The shop writes a code with rules on it, a buyer applies it, and a code that does not apply is refused with the reason.

5 tasks
  1. The shop can write a code and say what it does
  2. A buyer applies a code and sees exactly what it took off
  3. A code that does not apply is refused with the reason
  4. Valid until the 31st means the shop's 31st
  5. Only the shop can write a code, and hiding the form is not enough
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 run of codes takes the basket to nothing.

5 tasks
  1. The shop decides whether a code will share a basket
  2. A refused second code says which code is already there
  3. Two codes that do combine are applied in one fixed order
  4. No run of codes takes the basket to nothing
  5. Changing the basket re-runs every code on it
Sprint 05

The price on the order

A basket becomes an order at the price the buyer was shown, and the order can show where that price came from.

4 tasks
  1. A basket becomes an order at the price on the screen
  2. An order can show where its price came from
  3. A code that expired while the basket sat is caught before the money
  4. An order only moves forwards
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 instant.

4 tasks
  1. A code can be given a budget, and the shop can watch it
  2. A use is counted when the order is placed, not when the code is typed
  3. Two buyers take the last use at the same instant
  4. One per customer means one per customer
Sprint 07

Taking the discount out

A refund returns what was paid, in whole or in part, and the code's count goes back where the shop decided it should.

5 tasks
  1. Refunding a whole order returns what was paid
  2. Refunding one line returns that line's share of the discount
  3. A partial return does not claw back a discount the shop gave
  4. A refunded use goes back on the code, or deliberately does not
  5. The buyer can see what came back 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
  1. The shop runs somewhere that is not a laptop
  2. Nothing that gets somebody in is in the repository
  3. The live shop agrees with the codes about what time it is
  4. A stranger runs the whole promotion on the live address
  5. A bad release can be undone, and a failure is visible

Read before you build. The best engineers do.

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, who it is for, and why a discount code is a rule engine rather than a form.

How a shop's promotion actually works

Domain you will not have: margin, what a code is made of, and why shops are frightened of their own promotions.

Build discount codes.

Start your free week. Adaeze runs your kickoff, and Lars reviews every pull request.