Posts

Storybook for React: Build Components Without the App

Image
Quick answer Storybook React is a workshop that renders components on their own, outside your app, so you can see every state of a button, card, or badge without clicking through pages. You install it with npx storybook@latest init, write a story file next to each component, and open the workshop at localhost:6006. It pays off once a component has more than a couple of states, or someone else needs to see what it looks like. You open your app to check a small change to an order badge, five clicks deep. You log in, find the order, and only then see the colour. Change one prop and you repeat the whole trip. Multiply that by five states and a ten-minute tweak turns into an afternoon of clicking. That is the problem Storybook solves. It takes the component out of the app and puts it on a bench, where you flip through its states. This post sets it up in a fresh Vite and React project, builds one real badge, and shows what breaks. What I would check before using it My first check is how ...

Ollama Tutorial: Run Your First Local LLM in Python

Image
Quick answer Ollama is a free program that runs open language models on your own computer, no API key or cloud account needed. You install it, download a model with one command, and talk to it from a terminal or your own code through a local HTTP API on port 11434. This post installs Ollama on Linux, pulls a small 352 MB model, and sorts four real support tickets from Python. Picture a small software company's support inbox on a Monday morning. Four tickets waited overnight: a plan that never activated after payment, an app crashing on the settings page, a misspelled name on an invoice, and a whole team locked out since breakfast. Sorting them by hand takes a morning; a cloud AI means uploading customer data to someone else's server and paying per message. A model on your own machine changes that trade: it sorts the tickets and sends nothing outside your computer. This post shows that setup working, with real timings. What I would check before using it My first check is whe...

RabbitMQ Tutorial: An Order Queue That Never Loses Work

Image
Quick answer RabbitMQ is a message broker: one program puts a message into a queue, and another takes it out later, so slow work does not block the user. This post publishes three shop orders to a real queue with Python and pika, acknowledges the two good ones, and rejects the broken one into a dead-letter queue. It fits work that must survive a crash, and is overkill for a simple in-process job. Picture a small online shop. A customer clicks buy, and the checkout code charges the card and updates stock, all inside one web request. Then the payment gateway stalls, the request times out, the customer clicks buy again, and the card is charged twice. A queue breaks the chain. The web request only has to record the order and hand it to RabbitMQ, and a separate worker takes orders one at a time and confirms each one only when the work is done. If the worker crashes halfway, the order is still in the queue, waiting for the next worker. What I would check before using it My first check: ...

Sentry Error Tracking: Catch Bugs Before Your Users Do

Image
Quick answer Sentry error tracking collects the exceptions your Python app raises in production and groups them into issues you can triage, with the stack trace and how many users were hit. Install sentry-sdk, call sentry_sdk.init() with your project DSN as early as possible, and every unhandled exception is reported automatically. It is worth it once real users can hit errors you never see in development. Your checkout worked on your laptop. It passed review, the tests were green, and the deploy went out on a Friday afternoon. Then a customer writes on Monday that their order failed, and you have nothing to go on. No log line, no stack trace, just a screenshot and a vague description. You open the logs and find a wall of lines, most harmless, while the one line that matters sits buried in the middle. That gap, between an error happening and your team knowing about it, is the whole problem. Sentry closes it by catching the exception the moment it happens and sending you the details. ...

OpenTelemetry Python: Trace a Checkout Flow End to End

Image
Quick answer Yes. OpenTelemetry Python adds distributed tracing to a Python service with a few lines of setup: create a tracer provider, attach an exporter, and wrap each step of a request in a span. Each span records a name, timing, and attributes, and spans from one request share a trace id. Start with the console exporter, then switch to a real backend when the traces look right. A customer writes in: checkout took thirty seconds, then failed, and nobody can say where the time went. The order service says the payment call was slow. The payment service says it never saw the request. The logs from both sides exist, but they disagree about what happened first. That is the gap tracing fills. A trace follows one request across every service it touches, giving you one timeline with a name, a duration, and a few facts per step. OpenTelemetry is the shared vocabulary for that timeline, and the Python SDK is the part you wire into your own code. What I would check before using it My firs...

LangChain Tutorial: Build Your First LLM App in Python

Image
Quick answer LangChain is a Python framework for building applications powered by large language models, and in current LangChain 1.x you compose those applications with LCEL, the LangChain Expression Language, written as prompt | model | parser. This post builds a working support-ticket triage chain with that pattern, running offline with a stand-in model so you can learn the shape before spending anything on API calls. Picture a support inbox on a Monday morning. Two hundred messages arrived over the weekend: billing questions, outage reports, one customer who cannot check out. Reading each one by hand takes hours, and the urgent ones hide among the routine ones. A language model can read and sort them in seconds, but wiring that into real code means formatting prompts, calling the API, parsing replies, and handling failures. That wiring is the job LangChain is built for, and this post shows it on a small, honest example. What I would check before using it My first check is wheth...

pnpm: One Copy of Every Package, Shared Across Projects

Image
Picture a laptop that has hosted a dozen JavaScript projects. The same version of Express sits in a dozen node_modules folders. It works, and on a fast connection nobody notices, until the disk fills up or a CI runner installs everything from scratch on every push. The waste is not dramatic, it is steady: a few minutes here, a few gigabytes there, and a node_modules folder that becomes the biggest thing on the machine. pnpm goes after that waste. It keeps one copy of each package version in a shared store and links it into every project that asks for it. Is that saving worth changing how installs work? Quick answer Yes, pnpm is worth it when several JavaScript projects share the same packages. It keeps one copy of each package version in a shared store and links it into every project, so installs are faster and use less disk space. Its strict node_modules layout also exposes packages the code uses but never declared, which keeps dependency lists honest. What I would check before u...