Menu

7 backend lessons I learned the hard way
📰

7 backend lessons I learned the hard way

DEV Community: microservices·Odinaka Robert Nnamani·about 15 hours ago
#eyNqcPdd
#devtomicroservices#devto#dev#backend#service
Reading 0:00
15s threshold

I'm building my first mobile app with microservices. Here are 7 backend lessons I learned the hard way.

Own your data, or nobody does.

Each service owns its own data. No shared database that every service reads and writes directly. The moment two services share a table, a change in one breaks the other, and nobody can say who owns the truth anymore.

Make retries safe.

Networks fail and clients retry. If the same request twice creates two charges, two rows, or two emails, the retry becomes the bug. The rule I keep: the same request, safely repeated, must produce the same result, with no duplicate side effect.

Put the rule in the database, not just the app.

Validation in the app is good. A constraint in the database is the one every future app, script, and service has to respect. Apps get rewritten. The database is the last writer standing.

Auth lives in one place.

One auth service, verified at the boundary. Not a login check copied into every handler, drifting a little each time it is copied.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.