HomeChallengesRepsProblemsLeaderboardTake a challenge
TRACK 03

ASP.NET Core + APIs

The editor becomes C#, and the preview becomes the response your endpoint has to return.

56 challenges21 free19h of build time1 graded by running your code
Before you start

The later sprints here are about the framework, not the language — they assume you can already read and write C#. If you cannot yet, C# Foundations is the way in: six refactors covering the exact choices the rest of this track takes for granted.

Persistence with EF Core

The Write Side teaches these in JavaScript with no ORM in the way. This is the same set, where you actually work.

  1. The query that ran four hundred timesA list endpoint that looks like one query and is four hundred. Fix it twice: once by projecting to exactly what the response needs, and once for the case where whole entities really are required.Intermediate · 20 min
  2. Tracking, and when not toSomebody read that AsNoTracking is faster and put it everywhere, including on the method that saves. Decide per path: reads do not track, writes must, and the report that reaches the same row twice needs the identity map without the snapshots.Intermediate · 20 min · Pro
  3. The migration that lost a columnThe scaffolder saw a renamed property and generated a drop and an add. It would have passed review and deleted every customer name in production. Rewrite it so the data survives, and so adding a required column works on a table that already has rows.Advanced · 20 min · Pro
  4. Where the transaction endsAn order, an outbox message and a ledger entry, written by two SaveChanges calls with a crash-shaped gap between them. Decide where the unit of work actually ends and make the gap impossible.Advanced · 20 min · Pro
  5. The concurrency tokenTwo people reserve the last unit of stock within a second of each other and both succeed. Give the row a version, let the second write fail, and turn that failure into something the caller can act on.Advanced · 20 min · Pro

Services That Fail Politely

The other service is down, slow, or saying something twice. Make yours cope.

  1. The API only your laptop can callWorks on every laptop, blocked in production, and the laptop version lets any website call the API as the signed-in user. Configure CORS once, properly, for every environment.Beginner · 15 min
  2. Anyone’s wallet, for anyone who asksChange the id in the URL and you can read another customer’s balance. The credit endpoint does not need a token at all. Close both, and answer with the status code that tells the client the truth.Intermediate · 20 min
  3. Retry, breaker, timeout — in that orderAll the right resilience policies, stacked in the wrong order. The timeout caps all five retries together, the breaker is rebuilt on every request so it never opens, and a 404 gets retried five times.Intermediate · 25 min
  4. The receipt sent to the wrong phoneOrder confirmations arrive, but on somebody else’s screen. The hub is a singleton that sends to whoever touched it last, and the query-string token is accepted on every URL.Intermediate · 20 min
  5. Asking Catalogue on every orderOrders calls Catalogue for a price on every purchase, so Catalogue being down means nobody can buy anything. Keep a local copy of the bundles, updated by Catalogue’s events, including the ones that arrive twice or in the wrong order.Intermediate · 25 min
  6. Retrying what can never succeedAn empty wallet is retried three times, fifteen seconds apart, before the order is told. A redelivered debit charges the customer twice. Retry only what waiting can fix, and make the debit safe to receive more than once.Advanced · 25 min · Pro
  7. The order that never undoesAn order spans two services: Fulfilment puts the bundle on the line, then Wallet takes the money. When the payment fails, the customer keeps the bundle for free, because the failure never reaches the order and nothing is undone. Trace it first, then fix it.Advanced · 35 min · Pro
  8. Paid, and given nothingEvery order now has a deadline, and it works. Until Wallet is slow rather than down: its reply arrives after the deadline has already revoked the bundle. The customer is charged for nothing, and the saga ignores the proof.Advanced · 30 min · Pro

Works on One Server

Two replicas behind a load balancer, and everything that quietly assumed there was only one.

  1. Behind the load balancerThe API now sits behind a load balancer that ends HTTPS and adds a path prefix. Requests redirect to HTTPS forever, every customer shares one rate-limit bucket, and generated links lose /wallet.Beginner · 15 min
  2. Logged out by the other podSign in, refresh, signed out. Each pod made its own encryption keys, so a cookie from one is noise to the other, and the session lives in one pod’s memory. Share both, through one Redis connection.Intermediate · 20 min
  3. The receipt that stayed on the other podOrder receipts arrive about half the time. The customer is connected to one pod, the order finishes on the other, and that pod has nobody to send to. Connect the pods to each other.Intermediate · 15 min
  4. Half the pods show the old priceA bundle is repriced and, for ten minutes, the price depends on which pod you ask. Each pod caches in its own memory and nothing tells it to stop. Cache in two levels, and let the event drop the stale copy.Intermediate · 25 min
  5. The reset code only one pod knowsPassword reset works half the time: the code is held in one pod’s memory and checked by whichever pod gets the next request. It also works as many times as you like. Store it where every pod can see it, for a limited time, for one use.Intermediate · 20 min · Pro
  6. Two pods, two reportsA background job runs in every replica, so the ops team gets every report twice, and one exception ends the job for good. Make the pods take turns, make the job happen once per interval, and keep it alive.Advanced · 25 min · Pro
  7. When Redis is goneRedis blips for twenty seconds and every pod of both services restarts, purchases fail because a popup could not be sent, and a full Redis evicted the encryption keys. Decide in advance how each feature fails.Advanced · 25 min · Pro