Resend, the email API that a lot of developers use to send emails, has rewritten that API from Node.js to Go. On the same task size, a typical POST /emails request went from 58 ms to 31 ms. Each task used about 180 MB of memory instead of 1.3 GB, and at peak traffic they ran 10 tasks instead of 34.
Resend described the move on its engineering blog on 12 November 2026, including why the Node service struggled, what was hard about the port, and how they switched over without customers noticing.
TL;DR
- Seven weeks, about 140 pull requests. Resend went from an empty Go project to production traffic, and by October Go was serving all of their email API traffic.
- The Node problem was CPU work on one thread. During bursts of large requests, parsing big JSON bodies blocked the event loop, and a whole task could stop answering.
- Go roughly halved median latency.
POST /emailsfell from 58 to 31 ms and the batch endpoint from 149 to 74 ms, with lower p95 and p99 as well. - Far fewer resources. Memory per task fell from about 1.3 GB to 180 MB, CPU per request fell by about 62%, and peak traffic needed 10 tasks instead of 34.
- The hard part was matching Node's behaviour. Buffers, HTML-to-text output and a few quirks had to be rebuilt in Go and checked against the Node service request by request.
What Resend changed, and when
The email API is Resend's most important service. Every email a customer sends goes through POST /emails or the batch endpoint, which accepts up to 100 emails in one request.
According to Resend's post, the team took a new Go service "from an empty project to production traffic" over seven weeks and roughly 140 pull requests. They rolled it out to a growing random share of requests, and by October Go handled all email API traffic. The batch endpoint went from decision to production traffic in about a week.
Resend is closely tied to the JavaScript world. Its founders also created React Email, an open-source library for building emails with React components. In September 2026, CEO Zeno Rocha wrote that "we've always been a TypeScript company", but that a few months earlier Resend had moved its internal email pipeline to Go. That pipeline peaks above 7,600 requests per second with a p99 of 26 ms.
The email API came next. When Resend announced the rewrite, Rocha added: "as a Node.js dev, I wasn't on board at first. then I saw the numbers."
Why the Node service froze under load
Node runs your JavaScript on one main thread. A loop on that thread, the event loop, takes the next piece of work and runs it to the end before it picks up anything else.
That design is good at waiting. While one request waits for the database or S3, the event loop serves other requests. It falls apart when a request needs a lot of CPU, because nothing else on that process can run until the work finishes.
Their post says that during bursts of large requests "a whole task could become unresponsive", and one investigation traced it to "parsing and serializing large request bodies, including requests that were already being rejected by the rate limiter". An email with attachments can be a big JSON body, and JSON.parse on a big body is synchronous.
Here is the shape of the problem in a typical Express handler. This is an illustration, not Resend's code:
example.tstsimport express from "express"; const app = express(); // The JSON body parser runs JSON.parse on the one thread all requests share. app.use(express.json({ limit: "40mb" })); app.post("/emails", async (req, res) => { // By the time this runs, the whole body has been parsed synchronously. // While that happened, every other request on this process waited. const id = await enqueueEmail(req.body); res.status(202).json({ id }); });
One large request is fine. A burst of them, all landing on the same process, means small requests queue behind big ones, health checks time out, and the load balancer sees a task that looks dead.
Node does have ways around this, such as worker threads or splitting CPU work into a separate service. They all add code whose only job is to keep the event loop free.
How Go handles the same traffic
Go's net/http server runs each request in its own goroutine. A goroutine is a very light thread managed by the Go runtime, and the runtime spreads goroutines over several OS threads, by default one per CPU core.
If one goroutine spends 200 ms decoding a large body, it keeps one core busy while the other goroutines run on the other cores. The Go scheduler can also preempt a long-running goroutine so it doesn't starve the rest. The large request is slow, and the small requests next to it are not.
The Go version of the handler looks like this:
example.gogofunc sendEmail(w http.ResponseWriter, r *http.Request) { r.Body = http.MaxBytesReader(w, r.Body, 40<<20) // example cap: 40 MB var req SendEmailRequest if err := json.NewDecoder(r.Body).Decode(&req); err != nil { var tooBig *http.MaxBytesError if errors.As(err, &tooBig) { http.Error(w, "request body too large", http.StatusRequestEntityTooLarge) return } http.Error(w, "invalid JSON", http.StatusBadRequest) return } // Validate, store, queue. This goroutine can take its time. // Requests on other goroutines keep running on other threads. w.WriteHeader(http.StatusAccepted) } func main() { mux := http.NewServeMux() mux.HandleFunc("POST /emails", sendEmail) log.Fatal(http.ListenAndServe(":8080", mux)) }
There is no worker pool and no code to protect a shared thread. http.MaxBytesReader stops an oversized body early, and the decoder reads the body as a stream instead of loading it into a string first.
The results
Resend compared the two services during the phase of the rollout where half of the requests went to Node and half to Go. Both services ran on the same task size, so the numbers compare like for like.
Sending a single email, POST /emails:
| Latency | Node.js | Go | Change |
|---|---|---|---|
| Median | 58 ms | 31 ms | 47% lower |
| p95 | 149 ms | 107 ms | 28% lower |
| p99 | 498 ms | 420 ms | 16% lower |
The batch endpoint, up to 100 emails per request:
| Latency | Node.js | Go | Change |
|---|---|---|---|
| Median | 149 ms | 74 ms | 50% lower |
| p99 | 1,721 ms | 1,363 ms | 21% lower |
The median is the typical request. p95 means 95 out of 100 requests were faster than that number, and p99 means 99 out of 100 were. The tail numbers matter because they are the requests customers complain about, and those improved as well.
The resource numbers changed even more:

Fewer tasks and less memory per task means a smaller bill. It also means fewer moving parts during a traffic spike, because ten tasks have to scale up instead of thirty-four.
Resend also says it had to double task sizes twice during the rollout, so the Go service still needed tuning before it settled.
The hard parts of the port
Derich Pacheco, one of the engineers on the project, summed up the change as going "from a runtime that's async by default to one that's sync by default, from a permissive language to a strict one, and from types that vanish at runtime to types that don't."
A lot of the API's behaviour came from Node itself rather than from Resend's code, and customers relied on it. The team had to find each piece and rebuild it in Go.
Attachments and Node's Buffer
Resend's Node SDK accepts attachments as a Buffer, Node's type for raw bytes. When the SDK sends it, JSON.stringify turns a buffer into an object like {"type":"Buffer","data":[104,105]}. The old API turned that back into bytes with one Buffer.from() call.
Go has no Buffer. Bytes in Go are a []byte, and encoding/json expects a []byte to arrive as a base64 string. Hand it the Buffer object and decoding fails with cannot unmarshal object into Go value of type []uint8.
Resend rebuilt the conversion by hand, "JavaScript's coercion rules included". Those rules are lenient. Buffer.from turns each entry into a number, drops the fraction, and wraps it into the 0 to 255 range without an error, so 256 becomes 0, -1 becomes 255, "12" becomes 12, and "abc" becomes 0.
In Go you write that once, as a type with its own UnmarshalJSON method. This is my version, not Resend's:
example.gogo// NodeBuffer accepts a base64 string, like a plain []byte does, and also the // {"type":"Buffer","data":[...]} object that JSON.stringify makes from a Node Buffer. type NodeBuffer []byte func (b *NodeBuffer) UnmarshalJSON(raw []byte) error { var s string if err := json.Unmarshal(raw, &s); err == nil { decoded, err := base64.StdEncoding.DecodeString(s) if err != nil { return fmt.Errorf("attachment content: %w", err) } *b = decoded return nil } var nodeBuf struct { Type string `json:"type"` Data []any `json:"data"` } if err := json.Unmarshal(raw, &nodeBuf); err != nil || nodeBuf.Type != "Buffer" { return errors.New("attachment content: want a base64 string or a Node Buffer") } out := make([]byte, len(nodeBuf.Data)) for i, v := range nodeBuf.Data { out[i] = toUint8(v) } *b = out return nil } // toUint8 follows what Buffer.from does with each array entry: turn it into // a number, drop the fraction, then wrap it into 0..255. Anything that isn't // a number becomes 0. (Simplified: JavaScript parses a few more string forms.) func toUint8(v any) byte { var f float64 switch x := v.(type) { case float64: f = x case bool: if x { f = 1 } case string: f, _ = strconv.ParseFloat(strings.TrimSpace(x), 64) } if math.IsNaN(f) || math.IsInf(f, 0) { return 0 } m := math.Mod(math.Trunc(f), 256) if m < 0 { m += 256 } return byte(m) }
I ran it on [104, 105, 256, -1, 300.9, "12", true, null, "abc"] and got [104 105 0 255 44 12 1 0 0], the same bytes Node 24 gives for Buffer.from on that array. Any struct with a NodeBuffer field now accepts both shapes, and the rest of the code works with plain bytes. Node applied the rule silently, and in Go it is a named type you can read and test.
HTML to text
When a customer sends only HTML, Resend also generates a plain-text version of the email. The first Go library they tried produced reasonable text, but not the same text. Elements marked data-skip-in-text="true" showed up when they should have been left out, and links could pick up extra URL text.
Customers would see any difference in their recipients' inboxes, so Resend wrote a Go port of the exact HTML-to-text behaviour its API uses and tested it against 60 fixtures generated from the Node implementation. The first version matched all 60.
Keeping Node's quirks on purpose
Resend also kept some Node quirks deliberately. Once an API is public, its odd behaviour is part of the contract. If a customer's integration relies on a quirk, "fixing" it breaks their code, even if the new behaviour is more correct.
Code they deleted
Some code only existed because of the event loop. The email-size check, for example, had an elaborate trick to avoid scanning large bodies byte by byte, so a big email wouldn't block the thread. In Go, a slow check only slows its own goroutine. They cut the trick down to the one part that still saves real CPU.
Switching without breaking customers
The riskiest part of a rewrite is proving that the new service does the same thing as the old one.
Resend built a test harness that sends the same requests to Node and Go and compares the behaviour. It checks responses and errors, the rows written to the database, the objects written to S3, idempotency and rate limits.
Both services can return 200 OK and still behave differently. If the Go version stored a slightly different email, or wrote the attachment to S3 under another key, the customer gets a different result while every dashboard stays green.
After the harness, they rolled Go out to a random percentage of real requests and compared the status code distribution of the two services as the percentage went up. Along the way they added capacity ahead of the traffic spike that arrives at the top of every hour, gave S3 uploads per-request timeouts, and tuned the Redis connection pool.
Reddit took a similar route when it moved its comment backend from Python to Go, comparing the old and new services before switching traffic. I covered that migration in Where Is Go Used?, and From Python to Go looks at the same move from a developer's point of view.
My take
Resend comes from the JavaScript world and its API ran on Node.js, yet the team moved its most important service to Go because the numbers were better. That is the part of the story I like most.
For seven weeks of work, they got this:
- requests got about twice as fast at the median
- tasks stopped freezing during bursts of large requests
- each task used about a seventh of the memory
- peak traffic needed 10 tasks instead of 34
Node's async I/O was never the problem. An API that mostly waits on databases and queues runs fine on the event loop. The trouble started when CPU-heavy work, parsing large bodies, landed on the one thread that every request shares. Go doesn't have that single shared thread, so the same work slows one request instead of all of them.
That is why I'd pick Go for a backend service that takes heavy traffic and does real work per request. The standard library covers the HTTP server and the JSON decoding, and Resend's numbers show what that costs to run compared with Node.
If you want to write that kind of service yourself, start with HTTP & Networking for handlers and request bodies, Concurrency Fundamentals for goroutines and the scheduler, and Build a Billing REST API from Scratch to put it together into a production API. For other places Go is replacing JavaScript, see Next.js Now Runs Go and Is Go Safer Than Node.js Against Supply Chain Attacks?.
FAQ
Why did Resend move from Node.js to Go?
Their Node service could stop answering during bursts of large requests. Parsing and serializing big JSON bodies is CPU work, and in Node it runs on the single thread that serves every request, so one task could freeze. Go runs each request in its own goroutine across all CPU cores, so heavy requests no longer block the rest.
How much faster is Resend's Go API than the Node.js version?
On the same task size, median latency for POST /emails fell from 58 ms to 31 ms, p95 from 149 to 107 ms and p99 from 498 to 420 ms. For the batch endpoint, the median fell from 149 to 74 ms and p99 from 1,721 to 1,363 ms.
How much memory did Go save?
Each Node task used about 1.3 GB of memory and each Go task about 180 MB, which is about 86% less. CPU per request fell by about 62%, and at peak traffic Resend needed 10 Go tasks instead of 34 Node tasks.
Why does Go handle heavy API traffic better than Node.js?
Go runs each request in its own goroutine, and the runtime spreads goroutines across every CPU core. A request that parses a large JSON body keeps one core busy while the other requests keep running on the rest. Resend's Go service now handles peak traffic with 10 tasks instead of 34.
How do you migrate an API to a new language without breaking clients?
Send the same requests to the old and new service and compare everything they do, not only the status code. Resend compared responses, errors, database rows, S3 objects, idempotency and rate limits, then moved a growing random share of real traffic to Go while watching both services.
Sources
- Resend, "Migrating our Email API to Go" (12 November 2026): https://resend.com/blog/migrating-our-email-api-to-go
- Zeno Rocha on X, on moving Resend's internal email pipeline to Go (9 September 2026): https://x.com/zenorocha/status/2097705558564384944
- Zeno Rocha on X, on the email API rewrite (13 November 2026): https://x.com/zenorocha/status/2121298010793754796
- Node.js documentation,
Buffer.from(array): https://nodejs.org/api/buffer.html#static-method-bufferfromarray - Go standard library,
net/http(MaxBytesReader,MaxBytesError,ServeMuxmethod patterns): https://pkg.go.dev/net/http - Go standard library,
encoding/json([]byteas base64,Unmarshaler): https://pkg.go.dev/encoding/json - Reddit Engineering, "Modernizing Reddit's Comment Backend Infrastructure" (2025): https://www.reddit.com/r/RedditEng/comments/1mbqto6/modernizing_reddits_comment_backend_infrastructure/
NodeBufferoutput check: my own test with Go 1.27 and Node 24, 26 November 2026.
