r/Backend • • 1d ago

Just bought DDIA. Any tips?

Post image
376 Upvotes

Just bought DDIA. Any tips?


r/Backend • • 5h ago

How are you checking email addresses during signup when using AWS SES? Are you relying on format checks or using a separate verification service?

5 Upvotes

I was checking our email logs recently because we've had more messages bouncing than usual. We're using SES to send transactional emails from our web app and at first I thought something had changed with the setup. I went through the DNS records and sending configuration but couldn't find anything obviously wrong then I took another look at our signup process. Right now, we only check if the email follows the correct format. Someone could easily enter an address with a typo or one that doesn't actually exist and still get through.

We're not sending thousands of emails every day so even a handful of bad addresses can make a noticeable difference to our bounce rate. I'm wondering if it's worth adding an email verification API before accepting new accounts. How are you handling this in your own applications? Do you verify addresses before sending anything through SES or is the built-in handling enough to keep things under control?


r/Backend • • 16h ago

Is migrating from MongoDB to PostgreSQL worth it?

28 Upvotes

TL;DR: Running an EdTech platform with 600K+ users on MongoDB. Our data is heavily relational, and while regular API queries perform well, complex analytical queries are becoming painful to write and execute. Considering migrating to PostgreSQL and looking for advice on migration and production hosting.

Current setup:

\\- Node.js, MongoDB, and Mongoose.

\\- MongoDB Atlas (fully managed).

\\- 600K+ registered users and around 15K daily active users.

\\- An EdTech platform somewhat similar to Udemy or Coursera.

When the backend's foundations were laid, I was a junior working primarily on the frontend, so I wasn't involved in the database decision. It's been 1 year since we've been building this product.

Something that has been bothering me for a while is that we're essentially treating MongoDB like a relational database.

\\- Strict schemas and validations across collections.

\\- Heavily relational data with references between collections.

\\- Extensive use of aggregation pipelines and "$lookup".

\\- Very little reliance on MongoDB's schema flexibility.

To be fair, MongoDB has served us well. Our indexes are in place, most endpoints perform well, and we haven't faced any critical performance issues.

However, complex analytical queries for internal dashboards are a different story. Some involve joining up to 10 collections, take over 60 seconds, or occasionally time out despite optimization. Writing and maintaining these aggregation pipelines is also becoming increasingly painful.

I've experimented with MongoDB's transactions but didn't particularly enjoy the experience. I'd also like stronger database level relational integrity and better transaction management.

I feel PostgreSQL would have been a more natural fit for our data model from the beginning.

What I'd like advice on:

  1. Is migration justified? Given that MongoDB works well for most of our workloads, would migrating to PostgreSQL be worth the effort, or should I address the analytical workload separately?
  2. Migration strategy: If I proceed, how should I approach migrating a live production database at this scale? Any articles, case studies, or resources would be appreciated.
  3. PostgreSQL hosting: One thing I genuinely appreciate about MongoDB Atlas is how little I have to worry about infrastructure, backups, updates, and maintenance. What's the equivalent experience for PostgreSQL?
  4. Self-hosted vs. managed: How do you guys run PostgreSQL in production? Do you self-host it on a private EC2 instance or use something like AWS RDS, Neon, or another managed provider?

I've worked with relational databases on smaller projects, but never operated PostgreSQL in production at this scale.

I don't want to migrate just because I prefer PostgreSQL, but I also don't want to ignore what might be a fundamental architectural mismatch simply because things work today.

Would love to your thoughts and suggestions on this!


r/Backend • • 16h ago

How do you run PostgreSQL and Redis in production?

17 Upvotes

Title:

TL;DR: Migrating to PostgreSQL and introducing Redis for a production application with 600K+ users and around 30K DAUs. Looking for advice on hosting, managed services, and operational best practices.

We've been building a product for over a year using Node.js, Express.js, and MongoDB. We've now decided to migrate to PostgreSQL and replace our basic in memory caching with Redis.

One thing I genuinely love about MongoDB Atlas is how little I have to worry about the database itself. Backups, security, updates, scaling, and maintenance are largely taken care of. I just pay for it and focus on building the product.

Now that we're moving to PostgreSQL, I'm looking for a similar experience. I'm also introducing Redis since our current in-memory cache gets wiped with every deployment.

My questions:

- Do you self-host PostgreSQL and Redis or use managed services?

- Which managed providers do you use and recommend?

- If self-hosted, how do you handle security, backups, availability, and maintenance?

- Is the cost saving of self-hosting worth the operational responsibility?

Our backend runs on AWS EC2, so RDS and ElastiCache seems like natural choices but I've not used them till date and want to know all the other options and pick the best one accordingly to our needs and preferences.

I've used PostgreSQL for smaller projects but never operated it in production at this scale.

I'd love to hear what you guys actually use in production, your experience with different providers, and what you'd recommend based on our scale.


r/Backend • • 7h ago

Getting laid off with 2 years of experience. What should I focus on next?

2 Upvotes

Just got a message from management saying I’m being laid off. I’m honestly not sure what to do next or where to start preparing.

I have about two years of experience as a software developer mostly on the backend. My frontend skills are decent but I’m much more comfortable with backend work.

Should I improve my frontend skills so I can apply for full-stack roles and broaden my job search? Or should I double down on backend development or go deeper into generative AI and AI agents? I’d appreciate any advice on what to prioritize right now.


r/Backend • • 16h ago

How do you guys test your backends in production?

6 Upvotes

I'm a junior engineer working in a small team. We've been building a product for around 8 months using Express.js, and shipping features has always been our biggest priority.

One thing I've been noticing lately is that as our codebase grows, shipping a new feature occasionally breaks something that was previously working. Sometimes we don't even realize it until a user reports it.

We have a handful of basic tests, but nothing comprehensive enough to give us confidence when shipping new features or refactoring existing code.

I want to change that.

I've heard about unit testing, integration testing, end-to-end testing, smoke testing, and load testing, but my practical experience beyond basic tests is pretty limited.

I'd love to understand:

- What kinds of tests do you actually write for your backends?

- How do you decide what to test and what not to test?

- How do you introduce testing into an existing codebase without slowing down development significantly?

- What tools and frameworks do you use?

- How do you structure your testing suite and integrate it into CI/CD?

I'd particularly appreciate practical resources, open-source repositories with good testing practices, or engineering articles that demonstrate how these things are done in real projects.

I don't want to write tests just to increase a coverage percentage. I want to reach a point where we can ship features and refactor code without constantly worrying about what we might have broken.

Would love to hear how you guys approach this in your daily work.


r/Backend • • 8h ago

Auto scaling made our Node.js API worse until we fixed the Redis layer. How do you handle this?

1 Upvotes

We run a Node/Express + MongoDB backend behind an auto scaling group. On paper, "add more instances under load" sounds like the fix. In practice, it exposed problems that were hidden when we had 2 instances:

1. In-memory state doesn't survive scaling

  • Sessions, rate limits and local caches lived inside each instance.
  • A user hitting instance B got different behavior than on instance A.
  • We moved all of it to Redis. That solved consistency, but made Redis a single point of failure.

2. Cache stampede on scale-out

  • New instances start with a cold cache, so they all hit MongoDB at once.
  • We saw Mongo CPU spike exactly when traffic spiked, the worst time.
  • Mitigations we tried: request coalescing, TTL jitter, and stale-while-revalidate.

3. Connection pool exhaustion

  • 10 instances × pool size 100 = 1,000 connections to Mongo.
  • Autoscaling to 30 instances took the DB down, not the app.
  • We now size pools per instance based on the max fleet size.

4. Rate limiting across instances

  • Per-instance limits are meaningless once you scale horizontally.
  • Redis-backed sliding window works, but Lua scripts are needed to keep it atomic.

5. Scaling on the wrong metric

  • CPU-based scaling was too slow for bursty traffic.
  • Queue depth and p95 latency worked better for us, especially for BullMQ workers.

6. Graceful shutdown

  • On scale-in, instances got killed mid-request.
  • Handle SIGTERM, stop accepting new connections, drain in-flight requests, then exit.

What I'm still unsure about:

  • Redis Cluster vs a single primary with replicas: is the added complexity worth it below a certain scale?
  • Do you pre-warm caches on deploy/scale-out, or accept the cold start?
  • How do you load test scale-out behavior realistically, not just steady-state throughput?

Would like to hear how others have dealt with this, especially anyone running this on Kubernetes (HPA) vs plain EC2 ASG.


r/Backend • • 13h ago

Adding one cache server can send 18× the traffic to your database.

Thumbnail gallery
2 Upvotes

r/Backend • • 1d ago

I Thought I Knew Backend Development Until I Started Building

24 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 • • 15h ago

Template engine EJS vs Eta for a new Node.js project with SSR(don't want to use NextJS), which to choose?

Thumbnail
gallery
1 Upvotes

Hi,
I am about to start a new project with SSR (Node.js); previously, I have used ejs/handlebars. Currently, I am not very familiar much eta.

eta claims to be faster than ejs, anyone worked with both?

Highly appreciate your suggestions/comments.

ejs: https://www.npmjs.com/package/ejs
eta: https://www.npmjs.com/package/eta

Thanks


r/Backend • • 15h ago

Designing HTTP API and domain errors around RFC 9457 (so clients stop parsing English error strings)

0 Upvotes

Most API teams spend weeks designing `200 OK` schemas and 10 minutes improvising `4xx`/`5xx` JSON. You end up with three different error shapes across endpoints, brittle client regexes parsing `message` strings, and occasional raw SQL errors leaking through generic 500 handlers.

Using **RFC 9457 Problem Details** (`application/problem+json`) with strict internal-to-external error mapping solves a surprising number of production headaches at once:

- Clients branch on stable `type` URIs (and structured extension fields like `retryable` or field-level validation errors), never human-readable `detail` prose.

- Retry middleware can distinguish transient infra faults from permanent domain rejections without guessing from status codes alone.

- Security boundaries stay clean because internal stack traces/driver errors map explicitly to sanitized problem types while keeping correlation IDs for server logs.

I wrote an open guide walking through the RFC 9457 structure, domain error mapping patterns, and observability pitfalls (disclosure: my site):

https://olmene.com/article/designing-api-and-domain-errors-around-rfc-9457

For teams already using Problem Details in production: do you host actual docs pages at your `type` URIs, or use `urn:` identifiers?


r/Backend • • 16h ago

Revisiting our backend architecture after 2+ years in production

1 Upvotes

TL;DR: Looking for practical resources, architecture deep dives, and well engineered open source backend repositories to study and improve our existing codebase.

We've been building a product for around 2 years and we've reached around 400k+ users. Our backend is built with Express.js.

We've been shipping like crazy over the past year and have accumulated quite a bit of technical debt. Now that the pressure to ship has eased, I finally have some breathing room to address it.

Our backend is primarily organized around routes and controllers, and responsibilities across different domains have become increasingly intertwined.

For example, payment controllers directly access user collections, while user controllers read and modify payment data. There are no clearly defined domain boundaries, and introducing new abstractions is becoming increasingly difficult.

I'm familiar with concepts like repository patterns, service layers, dependency injection, DDD, and clean architecture. What I'm struggling with is understanding how these concepts come together in a real production codebase.

What I'm specifically looking for:

- Well engineered open source backend repositories I can study.

- Courses, architecture articles, engineering blogs, or technical deep dives with actual implementations.

- Real world examples of how engineers structure large backends, manage dependencies, and handle cross-domain operations.

- Resources you've personally found valuable while architecting or refactoring a backend.

The repositories don't necessarily have to match my tech stack or product domain.

I want to emphasize that I'm looking for something concrete.

I've asked similar questions before and mostly received advice like "separate your concerns," "define domain boundaries," or "introduce abstractions." While that's valid advice, it doesn't help me understand what those decisions look like in practice.

If you recommend a particular architectural approach, I'd really appreciate a reference to a codebase, article, course or working example that demonstrates it.

I want something I can sit down with, dissect, understand, and learn from. not just a list of architectural principles.

Would really appreciate any resources that have genuinely made you a better backend engineer.


r/Backend • • 18h ago

Would you keep route/controller/service/repository layers in a small Fastify starter?

1 Upvotes

I maintain create-tigra, an MIT npm generator, and want to challenge the backend structure it gives new projects.

The API is Fastify 5 with Prisma/MySQL. Modules follow route → controller → service → repository, alongside auth/session code and Redis-backed rate limits, lockouts, and IP blocks. The frontend is a separately deployable Next.js app. Tests, CI, and Docker configuration are included.

Source: https://github.com/blessandsoul/create-tigra

The benefit I am aiming for is a predictable place for validation, business rules, and database access. The cost is extra files and layers before a small product has much logic. I would like to hear when that structure becomes useful and when it is premature.

Which boundary would you collapse first? What business rule should stay out of a repository? Which auth/session or persistence edge case would make you reject a starter until it had a regression test?

Advice, honest feedback, and a roast of the implementation are welcome. Known dependency advisories are documented in the repo; this is source review, not a claim that the baseline is production-ready.


r/Backend • • 23h ago

Hey I am Backend-developer all i know i have built many projects apply many things and concepts all i want to add payment systems that should be productional and industry accpted and with handling millions of users and by focusing this payment thing which Backend project will be great to know

1 Upvotes

r/Backend • • 1d ago

Alternative to unit tests in agentic era

Thumbnail reddit.com
1 Upvotes

r/Backend • • 1d ago

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

0 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 • • 2d ago

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

15 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 • • 1d ago

APTUI is 1.0!

Post image
2 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 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 • • 1d ago

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

Thumbnail
github.com
1 Upvotes

r/Backend • • 2d 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 • • 2d ago

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

57 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 • • 2d ago

What does your local development setup look like?

Thumbnail reddit.com
1 Upvotes

r/Backend • • 3d 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?