The engineering notebook
RSS feedBackend
Articles, practical guides, and engineering notes on Backend.
By Ashish Bhakhand 108 published articles
Explore the articles
42 articles
Reset filtersMongoDB Behind a Repository Boundary
Keep ObjectIds, query documents, and persistence models out of business logic while preserving the capabilities MongoDB is good at.
Fail Fast with Pydantic Settings
Validate environment variables, production transport security, and operational limits once during startup.
Designing API Errors: Public Messages, Internal Causes, and Stable Codes
Give clients predictable errors while preserving the technical evidence operators need to diagnose failures.
Practical Pydantic Validation Beyond Basic Field Types
Use strict objects, constrained fields, normalization, literals, and model validators without moving business logic into schemas.
Serverless Observability Without Logging Everything
Use structured events, low-cardinality metrics, and clear naming to make Lambda systems diagnosable without producing noisy or unsafe logs.
Pydantic Is a Boundary, Not Your Entire Domain Model
Separate API schemas, internal domain types, and database rows so each representation serves the job it was designed for.
Reliable SQS Workers: Retries, Partial Failures, and Dead-Letter Queues
Build Lambda consumers that expect duplicate delivery, isolate poison messages, and retry only the records that failed.
Thin FastAPI Routers: What Belongs in an Endpoint?
Use routes as typed HTTP adapters while services own decisions, transactions, and orchestration.
Idempotency Is Not Optional in Serverless Systems
Retries are normal in distributed systems. Design writes so repeated requests and messages do not repeat the business effect.