Journal
Writing
Opinionated engineering notes—security, scalability, correctness, and the interfaces between humans and machines. No listicles—just explanations you can reuse in prod and in interviews.
Filter
Featured
All posts
- PerformanceAugust 12, 20266 min read
Cache-Aside Pattern with Node.js and Redis
Implement cache hits, database fallback, TTLs, invalidation, tenant-safe keys, and graceful Redis failure handling in Node.js.
RedisNode.jscachingdata consistency - NetworkingAugust 12, 20266 min read
Configure Cloudflare DNS on Ubuntu
Configure Cloudflare's resolver on an Ubuntu device and separately manage authoritative Cloudflare DNS records for a domain.
CloudflareDNSUbuntuNetworkManager - InfrastructureAugust 12, 20266 min read
Deploy a FastAPI OCR Service with Docker and Tesseract
Package a FastAPI OCR endpoint with Tesseract, safe upload handling, health checks, limits, and production verification.
FastAPIDockerTesseract OCRPython - PlatformsAugust 12, 20268 min read
Deploy a Next.js Application on Vercel
Import a Next.js repository into Vercel, configure builds and environments, connect a domain, inspect logs, and verify production behavior.
Next.jsVerceldeploymentenvironment variables - InfrastructureAugust 12, 20267 min read
Deploy a Node.js Application on DirectAdmin or cPanel Shared Hosting
Evaluate shared-hosting Node.js support and deploy through cPanel Passenger or DirectAdmin Nginx Unit with realistic platform limits.
Node.jscPanelDirectAdminshared hosting - InfrastructureAugust 12, 20266 min read
Deploy a Node.js Application with PM2 and Nginx
Build and run a Node.js application with PM2, proxy it through Nginx, preserve client headers, and verify the deployment safely.
Node.jsPM2Nginxdeployment - PlatformsAugust 12, 20269 min read
Set Up Google Analytics 4 and Search Console for Next.js
Add consent-aware GA4 measurement and configure Search Console ownership, sitemaps, inspection, and indexing checks for a Next.js site.
Next.jsGoogle Analytics 4Search ConsoleSEO - SecurityAugust 12, 20267 min read
JWT Access and Refresh Token Strategy
Design short-lived access tokens and rotating refresh-token sessions with revocation, browser protections, and key rotation.
JWTrefresh tokensauthenticationweb security - DatabaseAugust 12, 20267 min read
Migrate WordPress Content to PostgreSQL
Export WordPress content and media, map it into PostgreSQL, build an idempotent importer, and preserve URLs and SEO signals.
WordPressPostgreSQLdata migrationSEO - DatabaseAugust 12, 20267 min read
Handle Dates and Time Zones in Node.js and PostgreSQL
Model instants, local schedules, Nepal Time, date-only values, and API timestamps without server-time-zone surprises.
Node.jsPostgreSQLtime zonesdate handling - DatabaseAugust 12, 20266 min read
Back Up and Restore PostgreSQL for a Production Application
Plan logical PostgreSQL backups with pg_dump and pg_restore, secure retention, version compatibility, and tested recovery.
PostgreSQLbackupsdisaster recoverypg_restore - DatabaseAugust 12, 20267 min read
PostgreSQL Transactions with Prisma
Choose between nested writes, sequential operations, and interactive Prisma transactions while handling concurrency and retries correctly.
PostgreSQLPrismatransactionsconcurrency - DatabaseAugust 12, 20266 min read
Prevent Overlapping Time-Based Bookings in PostgreSQL
Use half-open timestamp ranges and an exclusion constraint to prevent concurrent bookings for the same resource.
PostgreSQLbooking systemsrange typesdata integrity - InfrastructureAugust 12, 20268 min read
Store and Serve User-Uploaded Images in Node.js
Accept, validate, store, serve, replace, and back up public images without exposing private documents or trusting upload metadata.
Node.jsExpressMulterfile uploads - DatabaseAugust 12, 20266 min read
VAT-Inclusive vs VAT-Exclusive Calculation in Nepal
Calculate, store, round, and verify VAT-inclusive and VAT-exclusive prices for Nepalese billing software.
Nepal VATinvoicingJavaScriptdecimal arithmetic - NetworkingAugust 8, 202612 min read
Fix CORS Errors in Express and Next.js
Why CORS errors show up in the browser console, what the browser is actually hiding from you, and how to fix them correctly in Express and Next.js without opening every origin in production.
CORSExpressNext.jsAPI design - Frontend architectureAugust 8, 20268 min read
Fix Next.js Image 400 Errors in Production
Why next/image requests return 400 Bad Request for remote images, how remotePatterns matching actually works, and how to tell an optimizer problem from an image-hosting problem.
Next.jsnext/imageimage optimizationproduction debugging - SecurityAugust 8, 20269 min read
Fix Nodemailer TLS Certificate Hostname Errors
What ERR_TLS_CERT_ALTNAME_INVALID means when Nodemailer connects to an SMTP server, why it happens, and how to fix it without disabling certificate verification.
NodemailerTLSSMTPNode.js - DatabaseAugust 8, 20269 min read
How to Fix Prisma Schema Drift Without Losing Production Data
A diagnosis-first procedure for reconciling Prisma migration history and production schema state with backups, restored-copy rehearsals, and controlled deployment.
PrismaPostgreSQLdatabase migrationsschema drift - DatabaseAugust 8, 20269 min read
PostgreSQL Connection URL Explained, Piece by Piece
A component-by-component breakdown of the PostgreSQL connection URL — user, password, host, port, database, and query parameters — plus safe environment-variable handling.
PostgreSQLPrismadatabase connectionenvironment variables - DatabaseAugust 8, 20269 min read
PostgreSQL Connection Pooling: Direct Connection vs Pooler
Compare direct PostgreSQL connections, application-side pools, and external poolers for persistent Node.js, serverless, Prisma, and migration workloads.
PostgreSQLPrismaNode.jsconnection pooling - DatabaseAugust 8, 20267 min read
PostgreSQL SSL Modes Explained for Node.js and Prisma
Understand PostgreSQL sslmode choices, certificate and hostname verification, and the differences between libpq, node-postgres, Prisma, and hosted providers.
PostgreSQLPrismaNode.jsTLS - DatabaseAugust 8, 20268 min read
Prisma Migrate Dev vs Deploy vs DB Push
Choose the correct Prisma schema command for development, prototyping, and CI/CD without confusing direct schema sync with versioned migrations.
PrismaPostgreSQLdatabase migrationsCI/CD - DatabaseAugust 8, 20268 min read
Prisma Migration Baseline for an Existing Database
Why Prisma Migrate reports the schema is not empty on an existing database, and how to baseline it correctly without a destructive reset.
PrismaPostgreSQLdatabase migrationsschema management - DatabaseAugust 8, 20266 min read
How to URL-Encode Special Characters in PostgreSQL Connection Strings
Encode PostgreSQL usernames and passwords safely without breaking the scheme, host, port, database name, or query parameters.
PostgreSQLPrismaNode.jsdatabase connection - SystemsMay 5, 20262 min read
Distributed systems basics adults revisit under pressure
Partial failures, clock lies, consensus tradeoffs, idempotency at money boundaries, and load shedding vocabulary operators actually recognize.
distributed-systemsreliabilityconsensusfallacies - InfrastructureMay 1, 20262 min read
Docker networking for engineers who resent memorizing buzzwords
Bridge overlays, NAT and published ports, embedded DNS versus external discovery, and debugging paths beyond restart theater.
DockerKubernetesnetworkingobservability - PlatformsApril 25, 20262 min read
Edge runtime explained — locality, isolation, and the limits of v8 snippets
What shifts when handlers run closer to users: cold starts, memory ceilings, cryptography constraints, and why edge does not magically delete physics.
EdgelatencyNext.jsreliability - SystemsApril 18, 20262 min read
Event-driven architecture without losing operational discipline
Outboxes versus brittle dual-writes, idempotent consumers, poison queues, and drawing lines between choreography and orchestration.
messagingreliabilitysagasobservability - PerformanceApril 10, 20262 min read
Caching strategies that survive invalidation reality
TTL alone is not a design. Layer CDN, proxy, application, and data caches with explicit ownership of staleness budgets and measurable hit quality.
cachingRedisCDNstaleness - SecurityApril 2, 20262 min read
JWT authentication without mythology — rotations, revocation, and session ergonomics
Symmetric versus asymmetric verification, JWKS fleets, leaky storage pitfalls, and when opaque cookies outperform bearer tokens.
JWTsessionsOAuthAPI design - Frontend architectureMarch 25, 20262 min read
Server Actions in Next.js — boundaries, security contracts, and cache semantics
What crosses the network, how Actions relate to RPC ergonomics over POST, and the checklist for parity with disciplined API handlers.
Next.jsReactsecurityforms - NetworkingMarch 18, 20262 min read
WebSockets vs HTTP — connection economics, backpressure, and when streaming wins
Framing the transport choice as an operations problem: fan-out, heartbeats, scaling stateful sockets, and falling back to SSE or polling without shame.
WebSocketHTTP/2SSEscaling - DataMarch 12, 20263 min read
Database indexing beyond B-trees — selectivity, partial indexes, and write amplification
How query planners pick indexes, when covering indexes beat heap fetches, and the operational cost every extra index hides.
PostgreSQLperformancequery-plansstorage