[{"data":1,"prerenderedAt":331},["ShallowReactive",2],{"blog-post-reading-order-for-inherited-code-en":3},{"post":4,"related":120,"latest":121,"adjacent":330},{"id":5,"title":6,"authorImage":7,"authorLink":8,"authorName":9,"body":10,"cta":103,"date":108,"description":109,"draft":110,"excerpt":7,"extension":111,"image":7,"meta":112,"navigation":113,"path":114,"seo":115,"startHere":110,"stem":116,"tags":117,"__hash__":119},"posts\u002Fblog\u002Freading-order-for-inherited-code.md","A reading order for inherited code",null,"\u002Fabout","A. Lee",{"type":11,"value":12,"toc":93},"minimark",[13,17,20,25,28,31,34,38,41,44,47,51,54,57,60,64,67,70,73,77,80,83,87,90],[14,15,16],"p",{},"Inheriting a codebase feels like being handed a novel with the first hundred pages missing. The instinct is to start reading from the beginning and hope the plot returns. That rarely works.",[14,18,19],{},"A better approach is to read for structure first. The goal is not to know every file. The goal is to build a map good enough to make one safe change, then another.",[21,22,24],"h2",{"id":23},"run-it-before-you-read-it","Run it before you read it",[14,26,27],{},"Get the application running before you form an opinion about the code. Follow the setup notes, or write them if they are missing. Open every screen. Click the main flow. Watch the logs while you do it.",[14,29,30],{},"Runtime behaviour narrows the search space. If the export button calls a queue, you know where to look. If the settings page never writes anything, you have found a question worth asking before you touch the settings code.",[14,32,33],{},"Write down every step that failed. Those failures are the first entries in your map.",[21,35,37],{"id":36},"follow-one-request","Follow one request",[14,39,40],{},"Choose one user action: sign in, save a record, start a checkout, load a report. Follow it from the click to the database and back.",[14,42,43],{},"At each boundary, write down the name of the function, the module, or the service that hands work to the next layer. You do not need to understand the implementation yet. You need the shape of the path.",[14,45,46],{},"When the path is clear, repeat it once. Two paths that share a boundary tell you where the application's real seams are.",[21,48,50],{"id":49},"find-where-money-moves","Find where money moves",[14,52,53],{},"In a commercial product, the money path deserves its own reading. Find the checkout, the payment provider call, the webhook handler, and the code that grants access after payment.",[14,55,56],{},"Then read the failure branches. What happens when the provider times out? When the same event arrives twice? When a refund lands after the file was delivered? These paths are usually shorter than the feature code and far more expensive to get wrong.",[14,58,59],{},"If you cannot find the money path, stop and find it before you change anything else.",[21,61,63],{"id":62},"read-the-tests-that-fail","Read the tests that fail",[14,65,66],{},"Do not read the whole test suite. Run it. Failures show you where the repository's assumptions and its current behaviour have drifted apart.",[14,68,69],{},"Then read a few tests that pass. A test that asserts a real outcome is documentation you can trust. A test that only checks that a function was called is a rumour.",[14,71,72],{},"If the suite is green but the application is broken, the tests are measuring the wrong thing. That is a finding, not a nuisance.",[21,74,76],{"id":75},"make-a-deletion-list","Make a deletion list",[14,78,79],{},"Before you add anything, list what can go: dead feature flags, unused dependencies, duplicate helpers, commented-out code, screens nobody can reach.",[14,81,82],{},"Deleting is the cheapest way to understand a system. Every removed path is one less thing to keep in your head. Keep the list visible and remove one item at a time, with a test or a manual check after each change.",[21,84,86],{"id":85},"write-the-map-you-wish-you-had","Write the map you wish you had",[14,88,89],{},"Keep one page in the repository: entry points, background jobs, external services, data stores, scheduled tasks, and the person or team that owns each one. Add the commands that actually work.",[14,91,92],{},"The next person may be you in a year. A good map is the kindest thing you can leave behind.",{"title":94,"searchDepth":95,"depth":95,"links":96},"",2,[97,98,99,100,101,102],{"id":23,"depth":95,"text":24},{"id":36,"depth":95,"text":37},{"id":49,"depth":95,"text":50},{"id":62,"depth":95,"text":63},{"id":75,"depth":95,"text":76},{"id":85,"depth":95,"text":86},{"title":104,"description":105,"label":106,"sku":107},"Practise on a codebase you can keep.","GutSync's source is free: a Flutter app with local storage, food data, and platform shells. Read it end to end.","Get GutSync source — free","templates-app-gutsynced-source-usd","2026-11-22","A practical sequence for taking over an unfamiliar codebase: run it, follow one request, trace the money, read the failing tests, and make a deletion list.",false,"md",{},true,"\u002Fblog\u002Freading-order-for-inherited-code",{"title":6,"description":109},"blog\u002Freading-order-for-inherited-code",[118],"taking over code","E3HlHd-76fp_VImkKVshJVhgfPshE7KCxrk4GD8wQik",[],[122,218],{"id":123,"title":124,"authorImage":7,"authorLink":8,"authorName":9,"body":125,"cta":204,"date":209,"description":210,"draft":110,"excerpt":7,"extension":111,"image":7,"meta":211,"navigation":113,"path":212,"seo":213,"startHere":110,"stem":214,"tags":215,"__hash__":217},"posts\u002Fblog\u002Ftemplate-demo-is-not-the-code.md","The demo is not the code",{"type":11,"value":126,"toc":197},[127,130,133,137,140,143,147,150,153,156,160,163,166,169,173,181,184,187,191,194],[14,128,129],{},"A live demo answers one question well: does this feel like the thing I need? It cannot answer the next question, which is whether you can still change it in six months. The demo runs on the maker's machine, with sample data, along a path that was tested for the recording.",[14,131,132],{},"The source is the part you take home. Here is what to check before you decide.",[21,134,136],{"id":135},"what-the-demo-proves","What the demo proves",[14,138,139],{},"A demo proves that a layout exists, that the main flow works, and that someone cared enough to finish the visible states. That is useful. It is also the cheapest part of a product to judge, because every template maker knows the demo will be watched.",[14,141,142],{},"It does not prove that the code is organised, that the upgrade path is short, or that the licence covers the way you plan to use it. None of those show up in a browser tab.",[21,144,146],{"id":145},"read-the-first-screen-as-an-editor","Read the first screen as an editor",[14,148,149],{},"Open the file behind the screen you just used. You are not looking for beautiful code. You are looking for boundaries.",[14,151,152],{},"Can you rename a label without opening the payment logic? Is the screen split into data loading, state, and presentation, or is all of it in one component? Are colours and spacing named once, or repeated as one-off values?",[14,154,155],{},"The answer predicts the cost of your first change better than any feature list.",[21,157,159],{"id":158},"follow-one-change-through-the-app","Follow one change through the app",[14,161,162],{},"Pick something small that you would genuinely want to change: add a field to a form, rename a route, replace an empty state, or change how a list is sorted.",[14,164,165],{},"Then count the files touched. A small change that stays in one place is a good sign. A label change that crosses five layers is a warning: every future request will cross the same five layers.",[14,167,168],{},"Templates are not supposed to remove all work. They are supposed to remove the work you did not choose.",[21,170,172],{"id":171},"check-the-boring-files","Check the boring files",[14,174,175,176,180],{},"The README and ",[177,178,179],"code",{},".env.example"," tell you whether setup was tested on a machine that was not the author's. A template without setup notes is a puzzle, not a product.",[14,182,183],{},"Run the tests. If there are none, read the scripts and see what \"build\" actually does. Look for migrations or schema files: they show whether data can move with the code. Read the dependency list for packages that are abandoned or pinned to an old framework version.",[14,185,186],{},"Finally, find the licence in the repository. Check personal and client use, deployment, and resale. A licence summary on a sales page is a convenience; the licence file is the agreement.",[21,188,190],{"id":189},"a-demo-is-a-promise-the-source-is-the-contract","A demo is a promise, the source is the contract",[14,192,193],{},"The demo says: this is the shape of the product. The source says: this is the work you are taking on.",[14,195,196],{},"Both matter. Only one of them will still be in front of you after the launch week.",{"title":94,"searchDepth":95,"depth":95,"links":198},[199,200,201,202,203],{"id":135,"depth":95,"text":136},{"id":145,"depth":95,"text":146},{"id":158,"depth":95,"text":159},{"id":171,"depth":95,"text":172},{"id":189,"depth":95,"text":190},{"title":205,"description":206,"label":207,"sku":208},"Compare the demo with the source.","Framright lists the stack, setup requirements, and licence beside the live preview. Read both before you pay.","Get Framright source — USD 79","templates-kit-framright-source-usd","2026-11-23","What to inspect in a template before you buy it: screen structure, change paths, setup notes, tests, and the licence that travels with the code.",{},"\u002Fblog\u002Ftemplate-demo-is-not-the-code",{"title":124,"description":210},"blog\u002Ftemplate-demo-is-not-the-code",[216],"choosing a codebase","9PREF6-tSvPnmrVouoejKWxROTdhe-wRIvlONY2Ah78",{"id":219,"title":220,"authorImage":7,"authorLink":8,"authorName":9,"body":221,"cta":316,"date":321,"description":322,"draft":110,"excerpt":7,"extension":111,"image":7,"meta":323,"navigation":113,"path":324,"seo":325,"startHere":110,"stem":326,"tags":327,"__hash__":329},"posts\u002Fblog\u002Fafter-the-webhook-arrives.md","After the webhook arrives",{"type":11,"value":222,"toc":308},[223,230,233,237,240,246,250,253,256,262,266,269,272,275,279,282,285,288,292,295,298,302,305],[14,224,225,226,229],{},"Most payment tutorials end in the same place: the provider posts an event, the application returns ",[177,227,228],{},"200",", and a success message appears. That is a good first afternoon. It is not the part that keeps a store running.",[14,231,232],{},"The webhook is the easy part. Everything after it is the product.",[21,234,236],{"id":235},"the-happy-path-is-one-branch","The happy path is one branch",[14,238,239],{},"A payment integration has more events than the one in the tutorial. There are pending payments, failed payments, expired sessions, refunds, partial refunds, disputes, and events that arrive out of order.",[14,241,242,243,245],{},"Write down every event the provider can send before you write the handler. Then decide what your application should do with each one. For events you do not care about, log them and return ",[177,244,228],{}," deliberately. Do not let an unknown event crash the endpoint, because the provider will retry it.",[21,247,249],{"id":248},"duplicate-events-are-normal","Duplicate events are normal",[14,251,252],{},"Providers retry. Networks drop responses. A process can write the order and die before it acknowledges the event. The same payment can therefore arrive two or three times, and that is normal operation.",[14,254,255],{},"Store the provider's event ID with a unique constraint. Process the event once. Make the side effects idempotent as well: sending a receipt twice is still a bad customer experience, even if the database row is correct.",[14,257,258,259,261],{},"Return success only after the work is durable. A ",[177,260,228],{}," before the write is a promise you have not kept.",[21,263,265],{"id":264},"refunds-move-backwards","Refunds move backwards",[14,267,268],{},"A refund is not the absence of a payment. It is a new event with its own rules.",[14,270,271],{},"Decide what happens to access after a refund. Does the buyer keep the files? Does a course enrollment close? What about a partial refund, or a dispute that is later resolved in your favour? The answers are business decisions, but the code must make them explicit.",[14,273,274],{},"Record the reason and the provider reference. Future you will need both.",[21,276,278],{"id":277},"delivery-can-fail-after-payment","Delivery can fail after payment",[14,280,281],{},"A paid order can still fail to deliver. Email bounces. A storage link expires. A background worker runs out of retries.",[14,283,284],{},"Keep payment state and delivery state separate. \"Paid\" and \"delivered\" are different facts, and an order can be one without the other. Give delivery its own retry policy, its own failure reason, and a view that shows paid orders that have not reached the buyer.",[14,286,287],{},"The worst outcome is not a failed payment. It is a successful payment that nobody notices failed to deliver.",[21,289,291],{"id":290},"replay-the-last-month","Replay the last month",[14,293,294],{},"Build a way to replay events before you need it. Start with a dry run that reports what would change. Add an audit log that records who replayed what, and when.",[14,296,297],{},"Then test with real old events, not only fresh ones from the sandbox. Production traffic contains the odd ordering, the duplicate delivery, and the customer who paid twice that no test fixture predicted.",[21,299,301],{"id":300},"monitor-the-customer-outcome","Monitor the customer outcome",[14,303,304],{},"Dashboards full of CPU graphs will not tell you whether buyers are getting their files. Track the things a customer would notice: unfulfilled paid orders, failed deliveries, signature failures, and the age of the oldest unprocessed event.",[14,306,307],{},"Alert on those. The infrastructure can be healthy while the store is quietly broken.",{"title":94,"searchDepth":95,"depth":95,"links":309},[310,311,312,313,314,315],{"id":235,"depth":95,"text":236},{"id":248,"depth":95,"text":249},{"id":264,"depth":95,"text":265},{"id":277,"depth":95,"text":278},{"id":290,"depth":95,"text":291},{"id":300,"depth":95,"text":301},{"title":317,"description":318,"label":319,"sku":320},"Start from a billing seam that is already wired.","SubSaver ships Supabase auth, the database migration, and optional Stripe billing in a Next.js project.","Get SubSaver source — USD 49","templates-app-subsaver-source-usd","2026-11-21","Why webhook handling needs idempotency, refund paths, delivery retries, replay tools, and monitoring after the first successful payment.",{},"\u002Fblog\u002Fafter-the-webhook-arrives",{"title":220,"description":322},"blog\u002Fafter-the-webhook-arrives",[328],"shipping and owning it","HXgtb5HVLuM_HpenPbAqkoFfD_IFVh9BQ8Knt8M8kkM",{"previous":218,"next":122},1795791709472]