Articles: TypeScript
Articles and code samples in TypeScript: design patterns, architecture and guides with working code.
- TypeScript for React and Node developers – from types to a type-safe API Tutorial · 26 min read
A hands-on TypeScript 7 guide built around one project – a dumpling shop's order dashboard in React plus a Node script. Types vs interfaces, discriminated unions, narrowing, generics, utility types, a strict tsconfig and validating API…
- Tailwind CSS v4 in React and Vite – tokens in @theme, variants with cva, dark mode and accessibility Tutorial · 18 min read
We set up Tailwind CSS v4 in a React + Vite app and build a small component set for a dumpling shop – design tokens in @theme, semantic tokens for dark mode, buttons with variants (cva + tailwind-merge), accessible form fields and a…
- Swagger and OpenAPI in practice – docs from code in NestJS and Express, a typed client and contract hygiene Tutorial · 21 min read
We document the pierogi shop API with OpenAPI – in NestJS with @nestjs/swagger (CLI plugin, response DTOs, an API key in Swagger UI, URI versioning, export without a database), in Express from Zod schemas with zod-to-openapi and…
- Login and registration in React – forms, tokens, protected routes and session refresh Tutorial · 31 min read
A complete authentication frontend in React 19 – login and registration forms with validation, an access token in memory and a refresh token in an httpOnly cookie, session restore, protected routes, retrying requests after a 401, password…
- Modern React 19 in practice – hooks, TanStack Query, forms and routing Tutorial · 25 min read
We build a complete ordering app for a dumpling shop in React 19 – components, hooks (state, effects, memo, ref, context), data fetching with TanStack Query, a form with react-hook-form and Zod, routing with React Router 8, project…
- NestJS 11 in practice – modules, DI, validation, Mongoose, queues and hexagonal architecture Tutorial · 24 min read
We move the pierogi shop's order API to NestJS 11 – modules and dependency injection, controllers and DTOs with class-validator, pipes, guards, interceptors and exception filters, Zod-validated configuration, Mongoose 9, ports and…
- MUI 7 in practice – theming, dark mode, custom components and DataGrid without the "default Material" look Tutorial · 23 min read
We build a dumpling shop's kitchen dashboard in Material UI 7 – design tokens and a CSS-variables theme, flicker-free dark mode, custom components and variants, client- and server-side DataGrid, and a form with react-hook-form and Zod.…
- Pins on Google Maps – markers, clusters and info windows Tutorial · 22 min read
A practical guide to pins in Google Maps and React – Pin variants per status, custom HTML markers, info windows, custom-styled clusters, levels of detail, syncing a list with the map viewport and performance with 1,500 points.
- Google Maps in React – API key, Map ID, geolocation, place search, pins and cost control Tutorial · 27 min read
A complete Google Maps integration for a React app with the official @vis.gl/react-google-maps library – from a restricted API key and a Map ID, through geolocation, address autocomplete (Places API New) and geocoding, to AdvancedMarker…
- REST API with Express 5 and TypeScript – from an empty folder to production Tutorial · 23 min read
We build the order API of a pierogi shop with Express 5 and TypeScript – Zod-validated configuration, routing, request validation, centralized error handling, async handlers, pino logs, CORS, Helmet, rate limiting, tests with supertest…
- Amazon SQS in practice – standard and FIFO queues, long polling, DLQ, idempotency, SNS fan-out and Lambda (Node.js, C#, Python) Tutorial · 26 min read
We move the pierogi shop's order handling to an Amazon SQS queue – a producer and consumer with AWS SDK v3, long polling, visibility timeout and heartbeats, a dead-letter queue (DLQ), idempotent processing with DynamoDB, batch sends, SNS…
- Amazon SES in practice – domain verification (DKIM, SPF, DMARC), leaving the sandbox, sending via API and SMTP, templates, bounces and deliverability (Node.js, C#, Python) Tutorial · 25 min read
We send the pierogi shop's e-mails with Amazon SES – a domain identity with Easy DKIM, a custom MAIL FROM domain for SPF, rolling out DMARC, leaving the sandbox, sending via the v2 API with AWS SDK v3 (text, templates, attachments) and…
- AWS S3 in practice – browser uploads, presigned URLs, multipart, CloudFront and costs (Node.js, C#, Python) Tutorial · 26 min read
We store pierogi photos and invoices in Amazon S3 with the AWS SDK for JavaScript v3 – a bucket with safe defaults, a least-privilege IAM policy, browser uploads via presigned POST, downloads via short-lived links and streaming, multipart…
- Backend login and registration – passwords, sessions, JWT, refresh token rotation and OAuth Tutorial · 37 min read
We build authentication for the pierogi shop API in Express 5 (plus a NestJS variant) – argon2id password hashing, short-lived JWTs and rotated refresh tokens in httpOnly cookies with reuse detection, e-mail verification, password reset,…
- Specification: business rules as objects you can combine Article · 12 min read
The Specification pattern from Domain-Driven Design: named rules with isSatisfiedBy, combining with and, or and not, one rule for validation and querying, translation to SQL via expression trees, the Criteria API and Q objects. Code in…
- Circuit breaker: turning a slow failure into a fast one Article · 11 min read
The Circuit Breaker pattern from the ground up: closed, open and half-open states, thresholds and windows, filtering business errors, working with timeouts, retries and bulkheads. Configuration in Polly, opossum, Resilience4j, gobreaker…
- Tool use: how a language model calls your application's functions Article · 17 min read
The model does not run code – it proposes tool calls that follow a schema, and your application executes them and sends the results back. The tool use loop step by step, good tool definitions, errors, parallel calls, the tool runner and…
- RAG: answers grounded in your own documents Article · 22 min read
Retrieval-Augmented Generation from basics to production – chunking, hybrid search with BM25 and RRF, reranking, cited answers with Claude, evaluation and the cases where RAG is unnecessary.
- Prompt engineering: writing instructions a model will actually follow Article · 17 min read
The anatomy of a good prompt, context instead of incantations, examples, structured outputs instead of begging for JSON, effort instead of "think step by step" and prompts treated as code – with examples in Python, TypeScript and C#.
- MCP (Model Context Protocol): one standard for connecting AI to tools and data Article · 14 min read
What the Model Context Protocol is, how the host–client–server architecture works, how tools, resources and prompts differ, how the stdio and Streamable HTTP transports work and how to write your own MCP server in Python, TypeScript and…
- Local language models: Ollama, llama.cpp, vLLM, quantization and the real trade-offs Article · 12 min read
How to run an open model on your own hardware, how much memory it really needs, what quantization and GGUF are, where generation speed comes from and when a local model makes sense instead of an API. Code in Python, TypeScript and C#.
- LLMOps: model gateways, caching, limits, observability and costs in production Article · 16 min read
What happens to an LLM application after the demo – a gateway, prompt caching, retries and fallbacks, per-customer limits, token and cost tracking, prompt versioning and safe rollouts. With code in Python, TypeScript and C#.
- LLM fundamentals: tokens, context windows and next-token prediction Article · 21 min read
How a large language model really works – from tokenization and the transformer, through context windows and sampling, to costs, hallucinations and a first API call in five languages.
- Fine-tuning language models: when it pays off, LoRA and QLoRA in practice Article · 15 min read
How fine-tuning differs from prompting and RAG, when it really makes sense, how to prepare data, how LoRA and QLoRA work and how to measure whether the tuned model is better – with code in Python, TypeScript and C#.
- Evaluating LLM applications (evals): tests for systems that are not deterministic Article · 18 min read
How to build an evaluation set, combine code checks with LLM-as-judge, count results honestly and stop regressions in CI – using a pierogi restaurant assistant, with code in Python, TypeScript and C#.
- Embeddings and vector databases: searching by meaning Article · 22 min read
What an embedding is, how to compute cosine similarity, which model to pick and how to store millions of vectors in pgvector, Qdrant or Chroma – with code in Python, TypeScript, C#, Java and Go.
- AI in Node.js and TypeScript: the Anthropic SDK, Vercel AI SDK and LangChain.js in practice Article · 13 min read
A map of the AI ecosystem for Node.js – when the provider SDK is enough, when to use the Vercel AI SDK and when LangChain.js – plus streaming to the browser, tools, agents and structured data with Zod, with production notes.
- Guardrails and security for LLM applications: prompt injection, data leaks and tool permissions Article · 16 min read
Why prompt injection has no simple fix and how to build defence in depth – the OWASP Top 10 for LLM applications, input classifiers, least-privilege tools, human in the loop and safe output handling. Code in Python, TypeScript and C#.
- AI coding assistants: from editor suggestions to an agent that opens pull requests Article · 14 min read
How to work with AI on code so you gain speed without losing quality: modes of work, project context (CLAUDE.md, AGENTS.md), the explore–plan–implement–verify cycle, change review, tests, security and automated review in CI.
- AI agents: a model in a loop with tools – and when a plain workflow is enough Article · 18 min read
How an agent differs from a single call and from a workflow, five workflow patterns, an agent loop with limits and an approval gate, context management, costs and security – illustrated by complaint handling at a pierogi restaurant.
- Visitor: new operations without changing classes Article · 16 min read
The Visitor pattern through a menu: dishes, drinks and sets stay untouched, while pricing, an allergen report or an export are separate visitor objects. Double dispatch, a comparison with pattern matching and code in five languages.
- Vertical slice architecture: code by feature, not by layer Article · 11 min read
Jimmy Bogard's Vertical Slice Architecture: every feature of the system is a separate slice from the endpoint to the database. Structure and a complete slice in C#, TypeScript, Java, Go and Python, how it combines with CQRS and the…
- Template Method: a fixed recipe, interchangeable ingredients Article · 13 min read
The Template Method pattern through importing supplier price lists: the base class fixes the order of steps, and subclasses provide parsing and optional hooks. The Hollywood principle, an inheritance-free variant in Go and code in five…
- Strategy: interchangeable algorithms instead of an if-else ladder Article · 13 min read
The Strategy pattern through courier assignment in a pierogi place: a family of interchangeable algorithms behind one interface, swapped at runtime. Code in C#, TypeScript, Java, Go and Python.
- State: an object that changes behaviour with its life stage Article · 13 min read
The State pattern through an order in a pierogi place: New, Paid, InKitchen, Delivered and Cancelled as separate objects that guard the allowed transitions themselves. A state machine without an if-else ladder, code in five languages.
- Singleton – one instance, and the reasons to hand it to a DI container Article · 10 min read
Singleton guarantees that a class has exactly one instance available to the whole application. We show thread-safe implementations in five languages and explain why today it is usually better to register the object as a singleton in a DI…
- Proxy – a stand-in that controls access to the real object Article · 11 min read
Proxy has the same interface as the real object and stands in front of it, deciding when – and whether – to pass a call on. An invoice archive example with access control and a lazy connection in C#, TypeScript, Java, Go and Python.
- Prototype – a new object as a copy of a ready-made template Article · 10 min read
Prototype creates objects by cloning a configured instance instead of building them from scratch. We explain the difference between shallow and deep copies using exam templates as an example.
- Onion architecture: the domain model in the middle, infrastructure outside Article · 11 min read
Jeffrey Palermo's Onion Architecture: four tenets, the layers of the core (model, domain services, application services), the difference between a domain service and an application service, and code in C#, TypeScript, Java, Go and Python…
- Observer: notify everyone without knowing anyone Article · 13 min read
The Observer pattern through a pierogi place's pantry: when the cheese runs out, the menu, the shopping list and alerts react on their own, and the pantry does not know they exist. Subscribing, unsubscribing, pitfalls and code in five…
- The Monolith: one application, one deployment, and why it is often the right start Article · 11 min read
What a monolith really is, when it is the best choice, how it turns into a big ball of mud and how to get out of it without a revolution. Structure in .NET, Java, Node.js, Go and Python.
- The Modular Monolith: hard boundaries without the cost of the network Article · 13 min read
One process and one deployment, but modules with a public API, their own data and communication through events. How to build it in .NET, Java (Spring Modulith), Node.js, Go and Python, and how to guard the boundaries with tests.
- Microservices: independent deployments, real costs and when it pays off Article · 11 min read
The microservice style according to Lewis and Fowler, without the marketing: boundaries by business capability, own data, synchronous and asynchronous communication, resilience, prerequisites and the road from the monolith. Code in C#,…
- Memento: a state snapshot without breaking encapsulation Article · 13 min read
The Memento pattern through a menu editor: Halina saves versions of the menu and returns to them with one click, while the history keeps snapshots without seeing what is inside. Copies instead of references, memory costs and code in five…
- Mediator: components talk through a coordinator Article · 12 min read
The Mediator pattern through the order form of a pierogi place: the delivery choice, address, time slot and button do not know each other, and the rules of their cooperation live in one place. Plus an honest look at MediatR and code in…
- Layered architecture: presentation, logic, data – and where it breaks Article · 12 min read
The oldest and most popular way of structuring business applications: closed and open layers, layers versus tiers, code in C#, TypeScript, Java, Go and Python, ArchUnit and NetArchTest tests, and the road to the hexagon.
- Iterator: walking a collection without looking inside Article · 11 min read
The Iterator pattern through orders from a delivery app fetched page by page: the loop in the report knows nothing about pagination, and pages load lazily, only when needed. Generators, yield and iter.Seq in five languages.
- Flyweight – how to fit 60,000 stadium seats in memory Article · 12 min read
Flyweight separates the state shared by many objects from the state unique to each one, and shares the former. A stadium seat map example from a ticket booking system in C#, TypeScript, Java, Go and Python.
- Factory Method – let the subclass decide what gets created Article · 11 min read
Factory Method separates the algorithm that uses an object from the decision about which exact object is created. A ticket booking example in C#, TypeScript, Java, Go and Python.
- Facade – one simple entry point to a complex subsystem Article · 11 min read
Facade exposes one convenient operation that coordinates many subsystem classes behind the scenes. An example of course enrollment with payment, access and a welcome email in C#, TypeScript, Java, Go and Python.
- Event sourcing: store the facts, not just the latest state Article · 13 min read
State as a sequence of immutable events: streams, rehydration by folding, optimistic concurrency, projections, snapshots and event versioning. An aggregate and an event store in C# (Marten), TypeScript, Java, Go and Python.
- Event-driven architecture: who publishes, who listens and what can go wrong Article · 13 min read
Event-driven architecture in practice: Fowler's four meanings of "events", choreography and orchestration, delivery guarantees, the outbox, idempotent consumers, ordering and contracts. Code in C#, TypeScript, Java, Go and Python.
- Decorator – adding behaviour layer by layer Article · 11 min read
Decorator wraps an object in another object with the same interface and adds behaviour before or after the call. An example of caching, retries and logging for an exchange rate provider in C#, TypeScript, Java, Go and Python.
- DDD strategic design: subdomains, bounded contexts and context maps Article · 12 min read
The strategic part of Domain-Driven Design in practice: the ubiquitous language, core, supporting and generic subdomains, bounded contexts, context map patterns and the anticorruption layer. Examples in C#, TypeScript, Java, Go and Python.
- CQRS: one model for changing, another for reading Article · 12 min read
Command Query Responsibility Segregation without overdoing it: from Bertrand Meyer's CQS, through three levels of CQRS, to projections and eventual consistency. Commands, queries and projections in C#, TypeScript, Java, Go and Python.
- Composite – trees in which a leaf and a branch look the same Article · 11 min read
Composite lets you treat a single object and a whole group of objects in exactly the same way. A course curriculum example with modules and lessons in C#, TypeScript, Java, Go and Python.
- Command: a request wrapped in an object Article · 12 min read
The Command pattern through a waiter's terminal in a pierogi place: every action on the ticket is an object with execute and undo, so it can be undone, redone, kept in a history and sent to a queue. Code in five languages.
- Clean Architecture: the dependency rule and use cases at the centre Article · 12 min read
Robert C. Martin's Clean Architecture without the myths: four circles, the dependency rule, input and output ports, the presenter. Structure and a use case in C#, TypeScript, Java, Go and Python, plus an honest list of costs.
- Chain of Responsibility: pass it on until someone takes care of it Article · 13 min read
The Chain of Responsibility pattern through complaints in a pierogi place: a bot, a shift manager and the owner form a chain, and a complaint travels until it reaches someone authorised. The classic variant and the middleware pipeline,…
- Builder – complex objects step by step Article · 12 min read
Builder collects an object's parameters in readable steps and hands over a finished, valid product only in build(). A catering order example in C#, TypeScript, Java, Go and Python.