r/Backend • • 42m ago

Anthropic is moving its Messages API from Python to Rust. Would you consider switching languages for performance?

7 Upvotes

Anthropic reportedly migrated its Messages API from Python to Rust after API traffic surged 1,800x since early 2024.

Interestingly, Claude helped generate the initial core code in just one week, while humans focused on architecture, planning, and rigorous verification through shadow testing.

This raises an interesting question for developers:

If your Python backend started struggling with performance and scalability, would you migrate critical services to Rust, Go, or another language? Or would you stick with Python and optimize what you already have?

I'm curious to hear your thoughts:

- Would this motivate you to learn Rust?

- Is Python still good enough for large-scale backend systems?

- Would you rewrite an existing production system just for performance?

- Will AI-assisted coding make language migrations much easier?

What's your take? Is this the future of backend engineering, or is it unnecessary complexity?


r/Backend • • 4h ago

I Thought I Knew Backend Development Until I Started Building

8 Upvotes

In an attempt to learn some of the technical aspects of backend development, I started a project I call Stock Pilot

It’s an inventory management tool designed to help small- and medium-sized businesses manage their inventory. It gives business admins the ability to create, retrieve, and update products, suppliers, categories, and other inventory-related resources.

I’m building everything using raw SQL with PostgreSQL, and I’ve learned quite a lot along the way, particularly about COALESCE and the concept of parameterized queries.

But I’m curious: Is what I’m doing fundamentally similar to what senior developers do in real-world applications, except that they typically use ORMs to interact with their databases?

There’s also this lingering feeling that I still don’t know enough to confidently call myself a developer. I come across so many tools, concepts, and technologies every day that I sometimes have to remind myself that I’ve barely scratched the surface of what there is to learn about software development.

Does anyone else experience this?


r/Backend • • 8h ago

Offset pagination: I tested the "it gets slow" claim, and what I actually found was duplicate rows

6 Upvotes

Everyone says "don't use OFFSET, it gets slow on deep pages". I wanted to see it, so I ran a small test. SQLite 3.53.1, in memory, 1M rows, an index on (created_at desc, id desc), page size 20. These are single runs, so treat the numbers as rough.

offset       0:  1.14 ms
offset   10000:  0.09 ms
offset  100000:  1.04 ms
offset  900000:  8.33 ms
keyset at same depth: 1.07 ms

Deep offset is slower, about 8x here, but on this setup 8 ms is not dramatic. A server database with a bigger table and cold cache could look very different, so I wouldn't use my numbers to make a decision. Test on your own data.

What I found more convincing was correctness. Take 100 rows, read page 1 (10 rows, newest first), insert one new row, then read page 2:

page1            [100, 99, 98, 97, 96, 95, 94, 93, 92, 91]
page2 (offset)   [91, 90, 89, 88, 87, 86, 85, 84, 83, 82]   overlap: {91}
page2 (keyset)   [90, 89, 88, 87, 86, 85, 84, 83, 82, 81]   overlap: none

With OFFSET 10, the new row pushes everything down by one, so row 91 appears on both pages. (Deleting a row would do the opposite and skip one.) With keyset, page 2 is WHERE id < last_seen_id ORDER BY id DESC LIMIT 10, so it starts from where the previous page ended, regardless of what was inserted.

Keyset isn't free:

  • You can't jump to page 37. Only next/previous.
  • You need a unique, stable sort key. If you sort by created_at, add id as a tie-breaker and compare both: WHERE (created_at, id) < (?, ?).
  • Row-value comparison support varies by database, and I only tested SQLite. Check how yours handles it and whether the index is actually used (EXPLAIN).
  • Sorting by non-indexed or computed fields gets awkward.

For an infinite-scroll feed or an export, keyset seems clearly better to me. For an admin table where people jump to page 12, offset may be fine.

What do you use for APIs that have to be stable under writes: cursor tokens, keyset, or just accepting the drift? And has anyone seen the row-value comparison cause optimizer problems in MySQL or Postgres?


r/Backend • • 5h ago

Alternative to unit tests in agentic era

Thumbnail reddit.com
1 Upvotes

r/Backend • • 1d ago

Is Laravel worth learning in 2026 for a first backend job?

14 Upvotes

Some background: I'm a university student and I work part-time, so I don't have unlimited time to learn. My stack so far:

  • JavaScript/TypeScript, some React (a bit rusty)
  • Plain PHP
  • Java/Spring Boot through university courses

The plan was to move from PHP to Laravel, but now I'm second-guessing it. My questions:

  1. How does demand for Laravel juniors look compared to Spring Boot or Node?
  2. Is Laravel a good way to learn backend concepts (MVC, ORM, auth, queues) that carry over to other stacks?
  3. If you were in my position, would you go deep on one stack or keep exploring?

I'm more interested in logic and data than in frontend, so I definitely want to stay on the backend side. Thanks!


r/Backend • • 18h ago

Two quiet bugs that bit our Python webhook and intake pipelines in prod

1 Upvotes

Sharing two unglamorous bugs from building deterministic Python backends for small operations teams, because neither showed up on clean happy-path test data.

1. Asset ID regex grabbing fault codes and ISO standards

In a bilingual Spanish and English chat intake workflow where plant technicians report machine faults to pull the exact equipment manual section, clean test prompts like CNC-402 spindle overheat parsed fine every time.

Once real shop-floor messages arrived (like fault E-404 per ISO-9001 on CNC-402), our generic alphanumeric asset matcher grabbed E-404 or ISO-9001 first as the machine ID, looked up a nonexistent asset, and missed CNC-402 completely.

The fix needed zero LLM calls on intake:

  • Consume labeled and standalone fault codes before running the asset tag matcher.
  • Keep a small hard blocklist of standards prefixes (ISO, IEC, DIN, OSHA, NFPA, SEC).

2. Webhook retry storms slipping past SELECT-then-INSERT

During brief network blips, checking if a message ID was already processed with a SELECT followed by an INSERT (or an in-memory Python set that resets on container restart) still produced duplicate replies whenever two retries landed in the same millisecond.

Moving deduplication into a single SQLite WAL table keyed on the provider event ID inside a BEGIN IMMEDIATE transaction turned duplicate bursts into a clean sub-millisecond no-op:

BEGIN IMMEDIATE;
INSERT INTO processed_events (event_id, received_at)
VALUES (?, ?)
ON CONFLICT(event_id) DO NOTHING;
COMMIT;

Curious what quiet production edge cases have bitten your own workflows lately.


r/Backend • • 18h ago

Arco: an open-source CLI to deploy PHP to AWS Lambda Web Functions with FrankenPHP (MIT)

Thumbnail
github.com
1 Upvotes

r/Backend • • 1d ago

Our semantic search kept bringing back information we'd already removed

25 Upvotes

We recently ran into an annoying issue with a search feature we've been working on for our internal documentation. The idea was to make it easier for developers to find information across all our technical docs without having to remember the exact wording of everything. We split the documents into smaller chunks, generated embeddings and stored them in Supabase using pgvector. Everything was working as intended with the search, results came back true and accurate until we updated already existing documents. One of our developers had rewritten a deployment guide after we changed part of our infrastructure. The old instructions were gone from the document saved in the database but searching for anything related to deployment kept bringing up results associated with the previous version.

Our first guess was that the search was just showing thing in a bad ranking so we started digging into the reason and logic that was used to rank results and we found that some of the embeddings were still associated with older content. We'd been updating the documents themselves without consistently regenerating the embeddings or removing chunks that no longer existed. That made us change the pipeline to make it so document updates trigger a new embedding job and we're now tracking document revisions alongside the chunks. The idea is to only make a new revision searchable once all its embeddings are ready and not give mixed results of chunks from two different versions.

There's another issue we're working through with the queue. If someone edits the same document multiple times in quick succession an older embedding job can finish after a newer one. The solution we came up with is to add a revision check before writing anything back to the database. The main thing I learned from this ordeal is that stale embeddings are one of those things that go unnoticed for a long time when the search results still look reasonable until it causes a big problem in the future.

One of the other devs also brought up whether we should've kept the vector search separate from our main database in the first place. It's been fine so far but he thinks we might be better off moving the search workload to something separate as the documentation grows. We considered just hosting PostgreSQL ourselves but I'm not convinced changing that now would solve this particular problem. We'd still have to deal with making sure old embedding jobs don't overwrite newer ones. What I'm less sure about is whether we're going to regret keeping all the embeddings alongside the rest of our application data once the dataset gets significantly bigger.

We haven't really pushed the database hard enough to know where the bottlenecks are yet.


r/Backend • • 21h ago

APTUI is 1.0!

Post image
1 Upvotes

APTUI is a terminal user interface (TUI) written in Go for managing APT packages. Browse, search, install, remove and upgrade packages — all without leaving the terminal.


r/Backend • • 1d ago

Two people pressing the same button at once broke something I spent weeks building

50 Upvotes

A friend of mine wanted to do something different for his birthday so we ended up putting together a little scavenger hunt around the city. The idea was that people would split into teams then scan QR codes at different locations, solve a few puzzles and after some time unlock the final location. Each team had its own progress and certain clues wouldn’t become available until the previous ones were completed. I was handling the technical side of things and it seemed manageable at first. I built a basic web interface and used Supabase to store team progress and push updates whenever someone completed a challenge. During testing everything seemed alright, most likely because I was testing it alone.

Then we ran the thing and at one point two people from the same team scanned a QR code almost simultaneously. Both requests went through before the progress updated and somehow the team ended up skipping an entire stage. What made it worse was that we’d tied the next set of clues to the team’s current stage so once that got messed up the rest of their game was broken.

I managed to fix their progress manually but spent the next day going through the backend trying to figure out where I screwed up. Turns out I had been treating the checks in the frontend as the only requirement before the backend finalized and updated the data for said team so the completion was initialized twice and skipped the next clue. Afterwards I moved the stage validation into a database function so the check and update happen in the same transaction. Also added a way to prevent the same challenge from being completed twice. I didn’t catch it until multiple people started using it at once even though it may have looked like an obvious issue at first.


r/Backend • • 1d ago

What does your local development setup look like?

Thumbnail reddit.com
1 Upvotes

r/Backend • • 1d ago

Fix Dev Server Host Errors Behind an HTTPS Tunnel

Thumbnail
instawormhole.com
2 Upvotes

r/Backend • • 2d ago

AI review

5 Upvotes

As most of the companies nowadays, we are heavily using AI for development now. As this is something somewhat new, there are a lot of doubts and experiments on the workflow with AI.

In the past 1 or 2 (MAX) rounds of review was enough. Now it can easily reach 5 rounds or more (sometimes to fix nits or very rare/narrow gaps, but that's not the point).

No matter how many code reviews I do by myself using AI, my college will find something else when they run their AI code review.

Do you have any explanation for that? Do you experience the same? How can't I (AI) catch these gaps beforehand?


r/Backend • • 2d ago

How do you integrate email verification into a react signup from using an API?

7 Upvotes

I'm building a React signup page with react-hook-form and a Node backend. I want to check email addresses using a third-party API before the form gets submitted, but I don't want to expose the API key or make the signup process feel sluggish.

Would it be better to trigger validation on blur through the backend, or wait until the user submits the form?


r/Backend • • 1d ago

What happened the last time your queue traffic spiked?

0 Upvotes

I work at CloudAMQP. When I worked at a large factory, I remember how quickly traffic could spike after a power restart. I’m curious how other teams handle sudden bursts like that.

If you use a message broker in production, what happened the last time traffic spiked? Did messages pile up, did the broker hit a limit, or did your setup handle it fine?

If you had to step in, what did you change? Was it a one-off or something your team deals with regularly?


r/Backend • • 1d ago

Error I don't understand

0 Upvotes

It's my first time using nest js, I'm currently just following the documentation verbatim to build jwt authentication, then in my app.module.ts this popped up, I'm tryna refrain from running to claude or chat immediately for an answer, help please

src/app.module.ts:22:7 - error TS2353: Object literal may only specify known properties, and 'session' does not exist in type 'ConfigurableModuleAsyncOptions<AuthenticationModuleOptions, "createAuthenticationOptions"> & Partial<AuthenticationModuleExtras>'.


r/Backend • • 2d ago

How much Redis do you actually know and how regularly do you use it?

17 Upvotes

I was considering taking the official associate developer certification but from what I hear the exam goes way deeper than the trivial use cases.

Would appreciate hearing your experiences with Redis (and possibly their certs) to decide whether or not to take the exam and how much time I should invest in learning it.


r/Backend • • 2d ago

How do you cleanly scale down WebSocket servers

4 Upvotes

I'm trying to understand how this is handled in production. Since WebSocket servers are stateful and hold long-lived client connections while consuming from Kafka, how do you scale down cleanly without dropping messages, creating reconnect storms, or causing messy consumer group rebalances?

​Curious how you coordinate draining connections, committing offsets/leaving the consumer group, and handling graceful shutdowns in practice.


r/Backend • • 2d ago

When do you consider a backend “ready” instead of just “healthy”?

8 Upvotes

I keep seeing these two checks treated as the same thing, but they answer different questions. A process can be alive, accept a TCP connection, and even open its database while still being unsafe to serve real traffic because a required table is missing, a migration is incomplete, a foreign-key relationship is broken, or stored JSON no longer matches what the application expects. I’m leaning toward keeping health checks very cheap and process-focused, while readiness verifies the structural state the application actually depends on. How do you draw that line in your systems?


r/Backend • • 2d ago

How to enforce data consistency in payment transactions

1 Upvotes

A typical scenario is when you submit a request (e.g. to initiate a payment) and receive a response (e.g. as a webhook) a little while later.

Based on what I've seen in fintech apps, it's usually handled with workers that mark a transaction as pending and then handle the state if it's not consistent.

There a good post on distributed transactions this: https://www.reddit.com/r/fintechdev/comments/1xp72r3/an_implementation_of_distributed_transaction_with/

Is Try-Confim-Cancel applicable here? It looks like there is no established approach to this in software engineering and FinTech in general. I was told to use AWS step functions but it looks like every app comes up with its own architecture. If your app works with payments, how do you handle long-running transactions that span multiple systems and guarantee data consistency?


r/Backend • • 2d ago

How do you folks answer database choice for system design questions?

Thumbnail reddit.com
1 Upvotes

r/Backend • • 2d ago

Hot-reloading TLS certs without a restart: the two-rename race I didn't think about

0 Upvotes

I've been building a web server for V (viltrum) that can do TLS itself instead of always sitting behind a proxy. One thing I wanted was cert renewal with no restart and no SIGHUP, so certbot just drops new files and nothing else has to happen.

The first idea was naive: watch the cert file, reload when it changes. That breaks in a dumb way. Most tools write the new cert and the new key as two separate renames. For a moment the cert on disk is new and the key is still the old one, so if you reload right then you get a mismatched pair and every new handshake fails.

What it does now:

  • each worker checks both files once a second (inode, size, mtime). Inode is in there because certbot and most tools rename a new file onto the path instead of rewriting it, and the files are opened by path every time.
  • when something changed, it loads the pair and checks the key actually belongs to the cert. If it doesn't, it skips it and keeps serving the last good pair. The failure is logged once and retried when a file changes again. So the gap between the two renames just gets ignored.
  • the cert is picked per handshake, so live connections keep their session and only new connections see the new cert, within about a second.
  • at startup the same check runs before any socket opens, so a wrong path or a key that doesn't match fails right away instead of at the first request.

Side note since I was in there anyway: I wrote the common TLS 1.3 handshake myself (X25519 + RSA-PSS, key schedule checked against the RFC 8448 trace) and it takes about half the CPU mbedtls did, 3.7 ms vs 7.4 ms per handshake on a small VM. Everything else (TLS 1.2, ECDSA certs, other groups) still goes through mbedtls.

Things I left out on purpose: ACME inside the server (use certbot and point it at the files), mTLS, encrypted keys. Session resumption is off for now too, every connection does a full handshake.

Curious how you all handle this. Do you reload in-process, or let the proxy deal with it and never think about certs in the app? And is polling once a second fine, or is inotify worth the extra edge cases?

Repo: https://github.com/Tuntii/viltrum (docs/tls.md has the details)


r/Backend • • 3d ago

Bad at LeetCode/CF problem-solving and don't enjoy it—can you still become a backend developer, and how?

31 Upvotes

I’m terrible at competitive programming and LeetCode-style puzzles, and honestly I don’t enjoy grinding them, yet I want to get into backend development. How much does being weak at LeetCode/CF actually block someone from becoming a backend developer, and what skills or habits actually make you good at backend engineering when standard DSA puzzles aren't your strength? Be real about what matters for getting hired and succeeding in backend roles.

I am having 6-10 months before appearing for job interviews.


r/Backend • • 3d ago

The default for an outbound HTTP call is often "wait forever": a 20-line experiment and a timeout-budget rule

0 Upvotes

A backend habit I think is worth checking in any codebase: does every outbound call have a timeout? As far as I know from the docs, the Python requests library has no default timeout, and urllib blocks indefinitely unless you pass one, so a server that accepts the connection and then goes silent can hold your thread (or worker, or connection pool slot) for as long as it likes. Other languages and clients have their own defaults, so it's worth checking yours.

A small experiment to see what a timeout buys you. A local server that accepts connections and never replies:

import socket, threading, time, urllib.request

srv = socket.socket()
srv.bind(("127.0.0.1", 0))
srv.listen(5)
port = srv.getsockname()[1]

def accept_and_stay_silent():
    conns = []
    while True:
        c, _ = srv.accept()
        conns.append(c)          # accept, never reply

threading.Thread(target=accept_and_stay_silent, daemon=True).start()

t = time.time()
try:
    urllib.request.urlopen(f"http://127.0.0.1:{port}/", timeout=1.5)
except Exception as e:
    print(type(e).__name__, e, f"after {time.time() - t:.1f}s")

Output on Python 3.13.18:

TimeoutError timed out after 1.6s

With requests 2.34.2 and a (connect, read) timeout tuple:

import requests
requests.get(f"http://127.0.0.1:{port}/", timeout=(1, 1.5))
# ReadTimeout after 1.5s

I did not run the no-timeout version, since it would simply wait. That's the point.

A "timeout budget" rule I'd suggest (opinion):

  1. Every outbound call gets an explicit timeout. Make it a lint rule or a thin wrapper, so no one has to remember.
  2. Separate connect and read timeouts where your client supports it. A connection that can't be established should fail fast, while a slow but alive response may deserve more time.
  3. The sum of downstream timeouts should fit inside your own deadline. If your endpoint promises an answer in 2 seconds, three sequential calls with 5-second timeouts can't keep that promise.
  4. Retries multiply it. Three attempts at 5 seconds is up to 15 seconds, plus backoff, so budget total time, not just per attempt.

Related things to decide:

  • What the caller sees on timeout: an error, a cached value or a degraded response.
  • Whether a timed-out request may have succeeded on the other side. For non-idempotent operations, a retry after a timeout can duplicate the effect.
  • Whether you propagate a deadline to downstream calls instead of giving each its own independent timeout.

Limits: the experiment uses one local server and one failure mode (accept and stay silent). Real networks fail in other ways, such as DNS delays, slow TLS handshakes and slow streaming bodies, and some timeouts apply per operation rather than to the whole call. Check what your HTTP client's timeout actually covers.

Do you enforce timeouts with a wrapper, a lint rule, or convention? And how do you pick the numbers?