Nathaniel's blog

Posts

Thoughts on software engineering, open source, and more.

Turborepo: Scaling Your TypeScript Monorepo
TypeScriptDevOpsNext.js

Turborepo: Scaling Your TypeScript Monorepo

As your project grows from one app to multiple apps sharing packages, a monorepo becomes the natural architecture. Turborepo makes monorepos fast and manageable by orchestrating builds, caching result...

Mar 2, 20267 min read3
Drizzle ORM: Type-Safe Database Queries in TypeScript
TypeScriptDevOpsLLM

Drizzle ORM: Type-Safe Database Queries in TypeScript

Drizzle ORM is a TypeScriptfirst database toolkit that generates SQL you can actually read. Unlike Prisma (which has its own query engine) or TypeORM (which uses decorators), Drizzle maps directly to...

Feb 27, 20268 min read1
CI/CD Pipelines with GitHub Actions
DevOpsTypeScriptNode.js

CI/CD Pipelines with GitHub Actions

Continuous Integration and Continuous Deployment (CI/CD) automates the journey from code push to production. GitHub Actions makes this accessible with YAMLbased workflows that run on every commit, PR,...

Feb 24, 20267 min read2
Relay vs Apollo: Choosing a GraphQL Client
GraphQLReactNode.js

Relay vs Apollo: Choosing a GraphQL Client

Both Relay and Apollo are productiongrade GraphQL clients for React. But they have fundamentally different philosophies. After using both extensively, here's how they compare. Philosophy Apollo is fle...

Feb 21, 20267 min read6
Integrating Wallets with ethers.js and wagmi
Web3EthereumTypeScript

Integrating Wallets with ethers.js and wagmi

Wallet integration is the front door of any web3 application. Users connect their wallet, sign transactions, and interact with smart contracts — all through your frontend. Two libraries dominate: ethe...

Feb 18, 20269 min read3
Layer 2 Scaling Solutions Explained
Web3EthereumBlockchain

Layer 2 Scaling Solutions Explained

Ethereum processes about 15 transactions per second. Visa handles 65,000. That gap is why Layer 2 solutions exist — they execute transactions off the main chain while inheriting its security guarantee...

Feb 15, 20268 min read1
Building a DAO: Governance on the Blockchain
Web3BlockchainSmart Contracts

Building a DAO: Governance on the Blockchain

A Decentralized Autonomous Organization (DAO) replaces traditional corporate governance with smart contracts. Token holders vote on proposals, and the code executes the outcome. No board of directors,...

Feb 12, 20268 min read0
NFT Standards: ERC-721, ERC-1155, and Beyond
Web3Smart ContractsBlockchain

NFT Standards: ERC-721, ERC-1155, and Beyond

Nonfungible tokens are unique digital assets on a blockchain. But "NFT" is an umbrella term — underneath, there are distinct standards with different capabilities. Understanding them is essential for...

Feb 9, 20267 min read0
Understanding DeFi Protocols: AMMs, Lending, and Yield
Web3DeFiBlockchain

Understanding DeFi Protocols: AMMs, Lending, and Yield

Decentralized Finance — DeFi — replaces traditional financial intermediaries with smart contracts. No banks, no brokers, no business hours. Just code running on a blockchain, accessible to anyone with...

Feb 6, 20269 min read2
Writing Your First Solidity Smart Contract
Web3SolidityBlockchain

Writing Your First Solidity Smart Contract

Smart contracts are selfexecuting programs that live on a blockchain. Once deployed, they can't be modified — every function call is a transaction, and every state change is permanent. That's both the...

Feb 3, 202611 min read0
Docker and Kubernetes for Frontend Developers
DevOpsTypeScriptNext.js

Docker and Kubernetes for Frontend Developers

If you're a frontend developer who's never touched Docker, you're not alone. But as fullstack development blurs the lines, understanding containers is becoming essential — not just for deployment, but...

Jan 31, 20268 min read0
GraphQL Schema Design Best Practices
GraphQLTypeScriptNode.js

GraphQL Schema Design Best Practices

A welldesigned GraphQL schema is the foundation of a maintainable API. Unlike REST, where endpoints evolve independently, your schema is a contract — every type, field, and argument is part of a publi...

Jan 28, 20267 min read1
Mastering the Next.js App Router
Next.jsReactTypeScript

Mastering the Next.js App Router

The App Router in Next.js is a groundup rethink of routing, layouts, and data fetching. If you're coming from the Pages Router, some conventions will feel familiar, but the underlying model is fundame...

Jan 25, 20269 min read0
React Server Components: A Deep Dive
ReactNext.jsGraphQL

React Server Components: A Deep Dive

React Server Components (RSC) represent the biggest architectural shift in React since hooks. They let you run components on the server, stream the result to the client, and skip shipping their JavaSc...

Jan 22, 202610 min read1
Building Type-Safe APIs with TypeScript and Zod
TypeScriptGraphQLNode.js

Building Type-Safe APIs with TypeScript and Zod

Runtime type checking has always been a pain point in TypeScript projects. You write beautiful interfaces, but the moment data crosses a boundary — an API request, a database row, a JSON file — all be...

Jan 19, 20268 min read0
Building a transparent LLM proxy with Cloudflare Workers and Hono
TypeScriptDevOpsLLM

Building a transparent LLM proxy with Cloudflare Workers and Hono

The core idea behind an LLM inference gateway is deceptively simple: intercept LLM API calls, forward them transparently, and capture data along the way. Implementing it cleanly took more thought than...

Jan 15, 20268 min read7
Six months with MCP: the good, the bad, the weird
TypeScriptDevOpsNode.js

Six months with MCP: the good, the bad, the weird

I've been building with Model Context Protocol since around early 2025, first integrating tools for an AI agent security platform, then building a multiMCP gateway. Here's where I actually stand after...

Aug 10, 20258 min read2
Context management is the real challenge in LLM engineering
TypeScriptNode.jsLLM

Context management is the real challenge in LLM engineering

Everyone talks about prompts. The more I build on top of LLMs, the more I think context management is actually the harder and more important problem. What I mean by context management A language model...

Jan 20, 20257 min read2
Cutting LLM costs by 20%: what actually moved the needle
TypeScriptNode.jsLLM

Cutting LLM costs by 20%: what actually moved the needle

We were burning through LLM API budget faster than expected. After a few weeks of profiling and experiments, we got costs down by about 20%. Here's what actually worked versus what sounded good in the...

Jul 15, 20246 min read5
Kafka at 200k DAU: what breaks and how to fix it
TypeScriptDevOpsNode.js

Kafka at 200k DAU: what breaks and how to fix it

We hit about 200k daily active users on our platform at peak. Most of the stack held up fine. Kafka was where we learned the most. Here's what I wish I'd known before we got there. Partition count mat...

Feb 10, 20247 min read3
Writing my first Solidity contract: lessons from the trenches
TypeScriptReactNode.js

Writing my first Solidity contract: lessons from the trenches

Before I joined my current company, I had exactly zero production Solidity experience. I'd read the docs, deployed a toy contract on a testnet years ago, and that was it. Three months in, I've shipped...

Aug 20, 20237 min read4
On leaving Microsoft after 18 months
TypeScriptReactDevOps

On leaving Microsoft after 18 months

Disclaimer: this is a reflection, not a complaint. A year and a half goes by faster than you'd think. When I joined, I was still fairly new to the kind of scale that a big tech company brings — hundre...

Mar 5, 20234 min read2
Migrating from C# to TypeScript: mental model shifts
TypeScriptNode.js

Migrating from C# to TypeScript: mental model shifts

I've been writing C professionally for about a year now on the backend of some ad serving systems, while also writing TypeScript on the frontend. Switching between the two throughout the day is intere...

Sep 10, 20226 min read1
What I learned running 50 A/B tests in one year
TypeScriptReactDevOps

What I learned running 50 A/B tests in one year

Running A/B tests was never something I thought I'd be doing this much. But at my current gig, we ship new experiments almost every week. After doing this for about a year, I've picked up a few things...

Mar 15, 20227 min read2
From Jobless to FAANG - My three year journey
TypeScriptReactGraphQL

From Jobless to FAANG - My three year journey

Disclaimer: this post is all about my personal experience, only representing my point of view, take it with a grain of salt. About three years ago, I was graduating from college with a CS degree. Drea...

Oct 16, 20214 min read203
How I make memes inside code
TypeScriptDevOpsNode.js

How I make memes inside code

Just another day, I was making memes on reddit, and writing code in the interval. It suddenly struck me, why can't I do both at the same time? Making memes inside code is totally possible, just make a...

Jul 31, 20214 min read270
Sorting 1 billion numbers
TypeScript

Sorting 1 billion numbers

Today we are going to try to sort 1 billion numbers. To be exact, they are 1 billion 32bit signed integers. Which have a size of around 4GB. Loading all of them into memory at once is possible, but no...

Jul 25, 20213 min read271
Building a high concurrency student course selection system
TypeScriptReactGraphQL

Building a high concurrency student course selection system

Intro Remember those days when your school system suck so much that you can never pick the course you want? Well, those days are no more. After learning how to design a high concurrency student course...

Jul 24, 202110 min read256
The making of a modern javascript library
TypeScriptDevOps

The making of a modern javascript library

Every 60 seconds passed in Africa, a new javascript library is created. There are a plethora of js libraries out there, and today I made another one. What Recently, I need to build some function revol...

Jun 21, 20213 min read90
How I build an app in 2 hours
TypeScriptDevOps

How I build an app in 2 hours

Yesterday I built an android app in 2 hours with without even knowing how to write in before starting to work on it. Granted, the app is really simple and I've written some demo app at around 2014 whe...

Feb 17, 20214 min read126
Typescript function return type based on parameters
TypeScript

Typescript function return type based on parameters

Typescript is all fun and games until you want some behaviour based on runtime values, recently I encountered a tricky problem: How do I type a function's return type based on the parameter value? I k...

Jan 11, 20213 min read56
Migrate to typescript - the advance guide
TypeScriptReactDevOps

Migrate to typescript - the advance guide

About a year ago I wrote a guide on how to migrate to typescript from javascript on node.js and it got more than 7k views. I did not have much knowledge on javascript nor typescript at the time and mi...

Dec 7, 202011 min read125
Use recoil in react custom hooks
TypeScriptReact

Use recoil in react custom hooks

Recoil is a hot new state management tool from Facebook that handles the state sharing problem gracefully with a minimal API. I recommend everyone check it out. It's an amazing tool that feels very re...

Jul 13, 20202 min read72
Let's talk about design patterns
TypeScriptReactDevOps

Let's talk about design patterns

What is a design pattern Design pattern is a method of solving specific problems through definition, use, and testing. It is a universal and reusable solution proposed for the repetitive problems in s...

Jul 8, 20202 min read19
Speed up your build by putting node_modules in ram
TypeScriptDevOps

Speed up your build by putting node_modules in ram

After a day of diligently copying from Stackoverflow and Google searches, you finally ready to build that 10GB Frankenstein project. You type into the console then went home and enjoy the rest of your...

Apr 2, 20204 min read15
Fix chrome extension problem

Fix chrome extension problem

Problem Sometime you want to install an extensions not from chrome store, but dragging it into the will get you this message: Solution Find your extension by id from this folder on macOS: Windows: And...

Feb 29, 20201 min read22
Migrate to Typescript on Node.js
TypeScriptReactNode.js

Migrate to Typescript on Node.js

Recently I've migrated one of my personal projects from Javascript to Typescript. The reason for migrating will not be covered here, since it's more of a personal choice. This guide is for those who k...

Oct 3, 201910 min read23
Build a Javascript async function error handler
Node.js

Build a Javascript async function error handler

Background If you are a Js developer, you probably have used and , and you love them. No more callback hell or chains. Just like writing a synchronous program. Util you run into or You begin to wrap e...

Sep 12, 20192 min read10
Getting Started with Tensorflow.js
DevOpsNode.js

Getting Started with Tensorflow.js

Computer science is no more about computers than astronomy is about telescopes. Edsger Dijkstra In order to have easy way of Machine learning in Javascript, you need , this guide will help you setup w...

Sep 2, 20192 min read9
ES-Next dynamic import
TypeScriptNode.js

ES-Next dynamic import

Problem Recently when writing a project of mine, I've written some javascript like this: I'd really like some syntax like this: Turned out there's this called that goes like: and it's supported by all...

Aug 28, 20192 min read11
City of Blinding lights-1

City of Blinding lights-1

本文本来应该在去年这个时候就完成的,只是当时一堆烦心的事情没有解决,所以也就没有写,现在再来补上。 The Wish 我最早对法国的理解,可以源自一个电影, 当然,这个电影的主题是时尚界的种种风云风雨,显然我对时尚并不太了解,也不是很感兴趣,好吧我承认我看这部电影主要是为了看,这点就不用说了,看电影肯定要看女主漂亮的。在电影中,Andrea在时尚界如鱼得水,步步高升,而她最向往的地方,就是巴黎了,...

Aug 13, 20191 min read8
Why do I love Billie Eilish
TypeScript

Why do I love Billie Eilish

Disclaimer: the mentioned in this article is limited to admiration of a singer at the level of art, which means I appreciate their songs and other artworks and that's it. It's been a long time since I...

Aug 3, 20198 min read36
Why do people always feel more and more difficult to be happy?

Why do people always feel more and more difficult to be happy?

在这个物质极其丰富,资源无比充沛的年代,人们总是能得到更多、更好的东西,缺总感觉自己难以感受到快乐?这是为什么? 简单来说,就是人们的欲望的阀值在不断地被提升,这也就是小孩比成年人更容易满足,更容易感到快乐的原因。当你吃过米其林三星之后,肯定就难以接受路边的麻辣烫;当你看过诺兰旷世神作之后,自然难以对手撕鬼子感兴趣;当你看着电影里都是百万甚至是千万里挑一的俊男美女的时候,不知不觉就会认为日常生活中...

Jul 9, 20191 min read16
Basis of computer networks
TypeScriptGraphQLDevOps

Basis of computer networks

By learning computer networks, I've gather some most useful knowledge and put them here. What is a threeway handshake? The first handshake: Client sets SYN to 1, randomly generates an initial sequence...

Jul 8, 201927 min read2
JS asynchronous operation summary
Node.js

JS asynchronous operation summary

问题的起源 最近两天被这个异步给坑了好久,这里总结一下Javascript的异步操作。 一切都源于下面这样结构的一段代码: 你认为执行完res是什么?结果不是,也不是,而是,我也是服气了,后来才搞明白这就是所谓的 IO模型。就是说还没有执行完,就了,相当于开启了一个子进程去做的事情,使得二者并行进行了。然而JS是单线程的,因此就用了这种奇怪的异步的方式来进行。 所以我们要让它像同步代码的顺序一样执...

Jul 3, 20192 min read15
Solve PostgreSQL "duplicate key violates unique constraint" error
DevOps

Solve PostgreSQL "duplicate key violates unique constraint" error

今天VPS到期了,迁移到了香港的一个数据中心,速度飞快、延迟超低,但是数据迁移中总是出现 的错误。通过一番和的查询算是了解了原因并解决了问题。 原因 在创建了新表之后,数据的导入由于没有用语句而是直接插入,因此一些自增的的值对不上当前的最大,比如本来自增指向,而由于导入数据已经应该是了,这个时候就需要重新调整的指向位置,即: 常见问题 有时候可能已经有的被我们不小心给删了,那么需要创建新的,那就用...

Jun 15, 20191 min read11
Installing postgresql on Debian 9
DevOpsLLM

Installing postgresql on Debian 9

获取postgres 连接 查看连接信息 退出 创建用户 如果当前用户不是postgres,则 然后 远程访问 找到 ,一般在下 找到后用打开 其中找到 然后修改为 然后同一目录下找到 在其最后一行加上 完成之后重启服务

Jun 15, 20191 min read2
The new blog is officially online
Node.js

The new blog is officially online

全新Blog上线了,仔细回味,从最早的寄居在博客网站,到Hexo+Github Pages,再到现在的自己开发的CMS+全部高度Customized的,也算是"Came a long way"了吧。 说起来也算是惭愧,之前这么多些时间,写的博文也太少了点,好多还都是工具使用,什么随笔,就是乱写一气,没有多少技术,大佬看了要笑掉大牙的。 自己BottomUp写了这个博客,可谓让我十分满意了,各个细节...

May 12, 20191 min read12
SSH troubleshooting
DevOps

SSH troubleshooting

装了个,然后给我神神秘秘、鬼鬼祟祟地跑了些流程,然后我再用ssh连我的server就连不上了?出现以下提示: 我就纳闷了 ,装一个 哪来的这么多的事,直接重新生成一个ssh key得了。 要用ssh key就得用安全的,4096位走起,暴力搞肯定搞不出来了。 然后就是用扔服务器上了。 然后一试,哟~还是登不上去,熟悉的错误,熟悉的味道。。 ssh登不上去,只有服务商vnc连着改了,把里面 和都改成...

May 1, 20191 min read6
Ways to create Systemd service
DevOps

Ways to create Systemd service

创建一个文件 ,内容如下 1. 扔进 ` 2. 权限不足的话记得改权限 3. 启动服务 4. 开机时运行 5. 停止服务

Mar 16, 20191 min read4