Backend
19 posts in this category
NestJS Telegram Alerts: Exception Filter, Jobs, and Deploy
Telegram Bot API in NestJS: TelegramModule, exception filter for 5xx alerts, BullMQ job failures, and deploy hooks — no external libraries needed.
MySQL Isolation Levels: Common Race Conditions and How to Fix Them
MySQL's default REPEATABLE READ doesn't prevent every race condition. Dirty reads, lost updates, phantom reads, write skew — which isolation level prevents which, when SELECT FOR UPDATE is the real fix, and when optimistic locking is better.
Stop Using Database Constraints as Input Validation: Use DTOs Instead
Many backends rely on NOT NULL, VARCHAR(n), and UNIQUE constraints to catch bad input. This is the wrong layer for validation — databases aren't built for it. Where validation actually belongs: the DTO layer and service layer, before data ever reaches the DB.
MySQL Deadlock: How to Read InnoDB Logs and Reduce Occurrence
MySQL auto-resolves deadlocks but randomly rolls back a transaction, causing errors at the app layer. How to read SHOW ENGINE INNODB STATUS to find exactly which row was locked, common causes, and 5 ways to reduce deadlock probability.
N+1 Query in Prisma, TypeORM, and Sequelize: How to Detect and Fix It
N+1 query causes no errors but makes APIs slow as data grows — ORM fetches a list with 1 query then fires N more for each item. How to catch it with SQL logging, count queries per request, and fix with eager loading, batching, or DataLoader.
MySQL ORDER BY + LIMIT Slow Despite Index: Filesort, Composite Index, and Cursor Pagination
ORDER BY combined with LIMIT can trigger a filesort over millions of rows even with indexes in place. How MySQL picks its execution plan, how to read EXPLAIN, and 4 practical optimization patterns.
How to upgrade NestJS 7 to 11 with AI and fewer mistakes
A practical way to upgrade an old NestJS service with AI: move one major version at a time, isolate breaking changes, review git diffs, and avoid changing business logic.
How to separate DTO, Model, and Entity in backend code
How to separate DTO, Model, and Entity in backend code so controller, service, and database layers do not get mixed together, especially with TypeORM.
How to separate backend, frontend, and QA responsibilities in a team
How to separate backend, frontend, and QA responsibilities to avoid blame, broken API contracts, unclear validation, and test cases drifting from the real system logic.
Caching strategies to reduce database load
Practical caching strategies for reducing database and API load: cache-aside, write-through, write-behind, TTLs, and invalidation.
5 VS Code extensions backend developers should install
Remote SSH, Docker, Prettier, ESLint, and Code Spell Check: five VS Code extensions for everyday backend development.
Apply SOLID to reduce coupling in large projects
A practical guide to applying SOLID in real projects to reduce coupling, avoid messy code, improve testability, and make large systems easier to extend.
Stateless vs stateful code when scaling instances
Understand stateless and stateful backend code, plus common scaling bugs like duplicate schedulers, local files, and memory state.
NestJS LogicalException and internal error codes
Standardize NestJS logic errors with message codes, LogicalException, HttpException, and internal error codes for faster debugging.
Design a consistent database with fewer data bugs
Practical database design rules for consistent data: naming, primary keys, foreign keys, unique constraints, not null, and enough normalization.
Run NestJS in production with PM2 restart and logs
Use PM2 to run NestJS on a Linux server, build the app, start it with an ecosystem file, inspect logs, restart on crashes, and restore after reboot.
BullMQ Job stalled with ElastiCache while Redis is healthy
Why BullMQ timeout and Job stalled errors happen with AWS ElastiCache Redis, and how to fix worker and connection settings.
Redis queue in NestJS with BullMQ: how to implement it
Use Redis as a queue in NestJS with BullMQ, including producer-consumer flow, retries, delayed jobs, and production notes.
NestJS Redis disconnects: configure ioredis reconnect
How to configure ioredis in NestJS to reconnect safely when Redis disconnects, TCP idle timeouts happen, or ElastiCache failover returns READONLY.