MERN Backend
Master backend development with the MERN stack — JavaScript, Node.js, Express.js, MongoDB, and more. 18 phases covering the complete MERN backend ecosystem.
Amazon SDE-1
8 phases · DSA
Java Mastery
11 phases · Java
SQL Mastery
9 phases · SQL
Frontend
14 phases · Frontend
Backend
20 phases · Backend
System Design
11 phases · Design
MERN Backend
18 phases · MERN
Projects
11 phases · Build
Your Progress
Complete all 18 phases to master this track
Phase 1: JavaScript for Backend
Master JavaScript fundamentals needed for Node.js backend development.
JavaScript Runtime
Understand how JavaScript executes in a runtime environment outside the browser.
Variables
Learn var, let, and const declarations and their scoping rules in backend code.
Data Types
Understand primitive and reference types in JavaScript for backend data handling.
Objects
Work with JavaScript objects for API request/response data and configuration.
Arrays
Master array methods for data transformation in backend services.
Functions
Understand function declarations, expressions, and first-class functions in Node.js.
Arrow Functions
Use arrow functions for concise callback syntax in Express middleware and routes.
Scope
Understand block, function, and module scope for writing reliable backend code.
Closures
Use closures for data privacy, middleware factories, and configuration patterns.
Hoisting
Understand variable and function hoisting to avoid common backend bugs.
this Keyword
Master the this keyword in different contexts: global, function, class, and module.
Destructuring
Use object and array destructuring for cleaner request handling and config extraction.
Spread Operator
Use the spread operator for copying objects, merging configs, and function arguments.
Rest Operator
Use rest parameters for flexible function signatures and route handlers.
Modules
Understand JavaScript module systems for organizing backend code.
CommonJS
Use require and module.exports in Node.js backend applications.
ES Modules
Use import and export syntax in modern Node.js applications.
Error Handling
Handle errors gracefully in async backend code with try-catch patterns.
try / catch
Use try-catch blocks for synchronous and async error handling in Express.
Custom Errors
Create custom error classes for meaningful API error responses.
Promises
Understand promises for async operations like database queries and API calls.
async / await
Write clean async code for database operations and API integrations.
Promise.all
Execute multiple async operations concurrently for better backend performance.
Promise.allSettled
Handle mixed success and failure results from concurrent operations.
Promise.race
Implement timeouts and competitive async patterns with Promise.race.
Event Loop
Understand the Node.js event loop for writing non-blocking backend code.
Call Stack
Understand how JavaScript executes code synchronously via the call stack.
Microtasks
Understand microtask queue priority with Promises and process.nextTick.
Macrotasks
Understand macrotask scheduling with setTimeout, setInterval, and I/O.
Event Emitters
Use the EventEmitter class for building decoupled backend components.
Phase 2: Node.js
Master Node.js runtime, modules, file system, streams, and core APIs.
What is Node.js?
Understand Node.js as a JavaScript runtime for server-side development.
Node.js Architecture
Understand the event-driven, non-blocking I/O architecture of Node.js.
V8 Engine
Learn how V8 compiles and executes JavaScript code at native speed.
Node.js Runtime
Understand how Node.js provides APIs beyond what V8 offers.
Single-Threaded Architecture
Understand how Node.js handles concurrency with a single-threaded event loop.
Non-Blocking I/O
Learn how Node.js handles I/O operations without blocking the main thread.
Event-Driven Architecture
Build decoupled systems using Node.js event-driven patterns.
Node.js Event Loop
Deep dive into the Node.js event loop phases and their execution order.
Node.js Modules
Use require and import to organize code into reusable modules.
npm
Manage packages and dependencies with the Node Package Manager.
package.json
Configure project metadata, dependencies, and scripts in package.json.
package-lock.json
Understand dependency locking for reproducible builds.
npm Scripts
Automate build, test, and deployment tasks with npm scripts.
Environment Variables
Manage configuration securely using environment variables.
process
Access process information, arguments, and environment in Node.js.
File System
Read, write, and manage files using the fs module.
Path
Work with file and directory paths using the path module.
HTTP Module
Create HTTP servers and make requests using the built-in http module.
Events
Use the EventEmitter and Event modules for inter-component communication.
Buffers
Handle binary data in Node.js with Buffer objects.
Streams
Process large data efficiently using readable, writable, and transform streams.
Readable Streams
Read data from sources like files, HTTP requests, and databases.
Writable Streams
Write data to destinations like files, HTTP responses, and databases.
Transform Streams
Transform data in transit with compression, encryption, and parsing.
Worker Threads
Run CPU-intensive tasks off the main thread with worker threads.
Node.js Error Handling
Handle uncaught exceptions, unhandled rejections, and process errors.
Node.js Debugging
Debug Node.js applications using built-in debugger and Chrome DevTools.
Phase 3: Express.js
Build web applications and APIs with the Express.js framework.
What is Express?
Understand Express as a minimal, flexible Node.js web framework.
Express Application
Create and configure an Express application with middleware and routes.
Project Structure
Organize Express projects with a scalable folder structure.
Routes
Define HTTP routes to handle client requests in Express.
Route Parameters
Extract dynamic values from URLs using route parameters.
Query Parameters
Handle query strings for filtering, sorting, and pagination.
Request Body
Parse and validate JSON request bodies in Express.
Response
Send appropriate HTTP responses with status codes and data.
Middleware
Use middleware functions to process requests before they reach route handlers.
Custom Middleware
Create reusable middleware for logging, validation, and authentication.
Router
Organize routes into modular, mountable router instances.
Controller
Separate request handling logic into controller functions.
Service Layer
Extract business logic into a service layer for testability.
Repository Layer
Abstract database operations behind a repository pattern.
Request Validation
Validate incoming requests using libraries like Joi or express-validator.
Error Middleware
Create centralized error handling middleware for Express.
Global Error Handling
Implement global error handlers for unhandled routes and errors.
HTTP Status Codes
Use appropriate status codes for different API response scenarios.
Response Design
Design consistent, well-structured API response formats.
API Versioning
Version your APIs to support backward compatibility.
OpenAPI / Swagger
Document your API using OpenAPI specification and Swagger UI.
Express Best Practices
Follow production best practices for building Express applications.
Phase 4: REST API Development
Design and build production-quality REST APIs with Express.js.
REST API Design
Design RESTful APIs following core REST principles and conventions.
Resource Modeling
Model your domain as resources with clear ownership and relationships.
URL Design
Design clean, consistent, and intuitive API URL structures.
HTTP Methods
Use GET, POST, PUT, PATCH, and DELETE correctly in REST APIs.
Status Codes
Return appropriate HTTP status codes for all API responses.
Idempotency
Design idempotent API operations for safe retries.
Pagination
Implement offset-based and cursor-based pagination in APIs.
Cursor Pagination
Build efficient cursor-based pagination for large datasets.
Filtering
Implement query parameter-based filtering in REST APIs.
Sorting
Add sorting capabilities to API list endpoints.
Searching
Implement search functionality with text queries and fuzzy matching.
API Versioning
Version your REST APIs using URL, header, or query strategies.
Error Response Design
Design consistent error response formats with meaningful messages.
Request Validation
Validate all incoming requests at the API boundary.
Rate Limiting
Protect APIs from abuse with rate limiting strategies.
API Documentation
Document your API endpoints, parameters, and responses.
Phase 5: MongoDB
Master MongoDB operations, queries, aggregation, and indexing.
MongoDB Introduction
Understand MongoDB as a document-oriented NoSQL database.
NoSQL Databases
Compare SQL and NoSQL databases and when to use each.
Document Databases
Understand the document model and how data is stored in MongoDB.
Collections
Organize documents into collections in MongoDB.
Documents
Work with BSON documents as the basic unit of data in MongoDB.
BSON
Understand BSON as MongoDB's binary JSON format for efficient storage.
ObjectId
Understand MongoDB ObjectId structure and generation.
MongoDB CRUD
Perform Create, Read, Update, and Delete operations in MongoDB.
Insert
Insert single and multiple documents into MongoDB collections.
Find
Query documents using find and findOne with filter expressions.
Update
Update documents using updateOne, updateMany, and replacement.
Delete
Remove documents using deleteOne and deleteMany.
Query Operators
Use comparison operators: $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin.
Logical Operators
Combine query conditions with $and, $or, $not, and $nor.
Array Queries
Query array fields using $all, $elemMatch, and positional operators.
Nested Documents
Query and update nested document fields using dot notation.
Projection
Select specific fields to return from MongoDB queries.
Sorting
Sort query results by one or more fields in ascending or descending order.
Pagination
Implement skip-limit and cursor-based pagination in MongoDB.
Aggregation
Transform and analyze data using MongoDB aggregation framework.
Aggregation Pipeline
Build multi-stage aggregation pipelines for complex data transformations.
$match
Filter documents early in the aggregation pipeline for performance.
$group
Group documents by a key and perform accumulator operations.
$sort
Sort aggregated results by specified fields.
$project
Reshape documents and include or exclude fields in aggregation.
$lookup
Perform left outer joins between collections using $lookup.
$unwind
Deconstruct array fields to process each element separately.
Indexes
Create indexes to improve query performance in MongoDB.
Compound Indexes
Design compound indexes for multi-field queries.
Text Indexes
Implement full-text search using MongoDB text indexes.
Query Performance
Analyze and optimize query performance with explain plans.
Phase 6: Mongoose
Use Mongoose ODM to model MongoDB data with schemas, validation, and middleware.
What is Mongoose?
Understand Mongoose as an ODM for MongoDB with schema-based modeling.
Schemas
Define document structure and constraints with Mongoose schemas.
Models
Compile schemas into models for interacting with MongoDB collections.
Documents
Create, read, update, and delete documents using Mongoose models.
Schema Types
Use String, Number, Date, Boolean, ObjectId, and Array schema types.
Validation
Add required, unique, enum, and custom validators to schemas.
Defaults
Set default values for schema fields using static values or functions.
Middleware
Run pre and post hooks on document operations for automatic processing.
Pre Hooks
Execute logic before save, validate, remove, and other operations.
Post Hooks
Execute logic after operations complete for logging and side effects.
Virtuals
Define computed properties that are not stored in the database.
Instance Methods
Add custom methods to individual document instances.
Static Methods
Add custom methods to the model class for shared operations.
References
Link documents across collections using ObjectId references.
Population
Automatically replace references with document data using populate.
Embedded Documents
Store related data as subdocuments within parent documents.
Transactions
Use MongoDB transactions with Mongoose for multi-document operations.
Mongoose Queries
Build complex queries using Mongoose chaining API.
Lean Queries
Use lean() for read-only queries that return plain JavaScript objects.
Mongoose Performance
Optimize Mongoose queries for production performance.
Common Mongoose Mistakes
Avoid N+1 queries, missing indexes, and other Mongoose anti-patterns.
Phase 7: MongoDB Data Modeling
Design effective MongoDB schemas with embedding, referencing, and access patterns.
MongoDB Data Modeling
Understand the principles of designing effective MongoDB schemas.
Embedding vs Referencing
Choose between embedding and referencing based on data access patterns.
One-to-One
Model one-to-one relationships using embedding or referencing.
One-to-Many
Model one-to-many relationships with embedding and population.
Many-to-Many
Model many-to-many relationships using reference arrays or junction collections.
Normalization
Apply normalization principles to reduce data duplication.
Denormalization
Use denormalization to improve read performance for common queries.
Access Patterns
Design schemas based on how data will be read and written.
Read-Heavy Design
Optimize schemas for read-heavy workloads with denormalization.
Write-Heavy Design
Optimize schemas for write-heavy workloads with normalization.
Data Duplication
Manage data duplication tradeoffs in denormalized designs.
Data Consistency
Ensure data consistency across embedded and referenced documents.
Schema Evolution
Handle schema changes and migrations in production MongoDB.
Data Modeling Interview Questions
Common MongoDB data modeling questions asked in interviews.
Phase 8: Authentication
Implement secure authentication with JWT, sessions, and role-based access.
Authentication vs Authorization
Understand the difference between verifying identity and granting access.
Registration
Build user registration with validation, hashing, and email verification.
Login
Implement login with password verification and token generation.
Password Hashing
Hash passwords securely using bcrypt before storing in the database.
bcrypt
Use bcrypt for secure password hashing with salt rounds.
Password Verification
Verify passwords against bcrypt hashes during login.
JWT
Implement JSON Web Tokens for stateless authentication.
Access Tokens
Generate and validate short-lived access tokens for API authorization.
Refresh Tokens
Use long-lived refresh tokens to obtain new access tokens.
Token Expiration
Set appropriate expiration times for access and refresh tokens.
Token Rotation
Implement refresh token rotation for enhanced security.
HTTP-Only Cookies
Store tokens in HTTP-only cookies to prevent XSS attacks.
Sessions
Implement server-side session management as an alternative to JWT.
JWT vs Sessions
Compare JWT and session-based authentication tradeoffs.
Logout
Implement secure logout by invalidating tokens or sessions.
Password Reset
Build password reset flow with email tokens and expiration.
Email Verification
Verify user email addresses with token-based confirmation.
Role-Based Access Control
Implement RBAC to restrict API access based on user roles.
Permission-Based Access Control
Implement fine-grained permissions for resource-level access control.
OAuth Basics
Understand the OAuth 2.0 protocol for delegated authorization.
Social Login Concepts
Implement Google and GitHub social login with OAuth.
Phase 9: MERN Security
Secure Node.js and Express applications against common web vulnerabilities.
OWASP Basics
Understand the OWASP Top 10 web application security risks.
NoSQL Injection
Prevent NoSQL injection attacks in MongoDB queries.
XSS
Prevent Cross-Site Scripting attacks in Express applications.
CSRF
Prevent Cross-Site Request Forgery in state-changing operations.
CORS
Configure Cross-Origin Resource Sharing for API security.
Clickjacking
Prevent clickjacking with X-Frame-Options and CSP headers.
Brute Force Protection
Implement rate limiting and account lockout for brute force prevention.
Rate Limiting
Protect APIs from abuse with express-rate-limit and Redis.
Password Security
Enforce strong password policies and secure storage practices.
JWT Security
Secure JWT implementation with proper signing and validation.
Cookie Security
Configure secure, HTTP-only, SameSite cookies.
Secure Headers
Set security headers using helmet.js middleware.
Input Validation
Validate and sanitize all user input at the API boundary.
Input Sanitization
Sanitize user input to prevent injection and XSS attacks.
Secrets Management
Manage API keys, database URIs, and secrets securely.
Environment Variables
Use environment variables to separate config from code.
HTTPS
Enforce HTTPS for all production API communication.
Secure API Design
Design APIs with security as a core architectural concern.
Phase 10: Redis and Caching
Implement caching, session storage, and distributed patterns with Redis.
Redis Introduction
Understand Redis as an in-memory data store for caching and more.
Key-Value Storage
Store and retrieve data using Redis key-value pairs.
TTL
Set time-to-live on Redis keys for automatic expiration.
Cache-Aside
Implement the cache-aside pattern for read-heavy workloads.
Read-Through
Implement read-through caching for transparent data loading.
Write-Through
Write data to cache and database simultaneously for consistency.
Cache Invalidation
Invalidate cache entries when underlying data changes.
Cache Eviction
Understand eviction policies: LRU, LFU, TTL, and random.
LRU
Implement Least Recently Used eviction for efficient cache management.
Session Storage
Store user sessions in Redis for scalable session management.
Redis Rate Limiting
Implement distributed rate limiting using Redis counters.
Distributed Locks
Implement distributed locks with Redis for resource coordination.
Cache Stampede
Prevent thundering herd problems when cache expires.
Cache Consistency
Maintain consistency between cache and database across operations.
When NOT to Cache
Identify scenarios where caching adds complexity without benefit.
Phase 11: Real-Time Backend
Build real-time features with WebSockets and Socket.IO.
Real-Time Applications
Understand when and why real-time communication is needed.
WebSockets
Understand the WebSocket protocol for full-duplex communication.
Socket.IO
Build real-time features using Socket.IO library.
WebSocket vs HTTP
Compare WebSocket and HTTP for different use cases.
Connection Lifecycle
Manage WebSocket connections from handshake to disconnection.
Rooms
Organize clients into rooms for targeted message delivery.
Namespaces
Separate socket connections into logical channels with namespaces.
Broadcasting
Send messages to all connected clients or specific rooms.
Private Messaging
Build one-to-one messaging with Socket.IO rooms.
Online Presence
Track and display user online/offline status in real-time.
Typing Indicators
Show when users are typing in real-time chat applications.
Real-Time Notifications
Push instant notifications to users via WebSockets.
Reconnection
Handle connection drops and automatic reconnection gracefully.
Scaling Socket.IO
Scale Socket.IO across multiple servers with Redis adapter.
Phase 12: Background Jobs and Queues
Process async tasks with BullMQ, Redis queues, and job scheduling.
Synchronous vs Asynchronous
Understand when to use sync vs async processing in backend systems.
Background Jobs
Move long-running tasks to background processors.
Job Queues
Implement job queues for reliable task processing.
Producers
Add jobs to queues from Express route handlers.
Consumers
Process jobs from queues with worker functions.
BullMQ
Use BullMQ for Redis-backed job queues in Node.js.
Redis-backed Queues
Leverage Redis for persistent, distributed job queues.
Retry
Implement automatic retry for failed job processing.
Exponential Backoff
Use exponential backoff to avoid overwhelming failing services.
Dead Letter Queue
Capture permanently failed jobs in a dead letter queue.
Job Idempotency
Ensure jobs can be safely retried without side effects.
Scheduled Jobs
Schedule recurring tasks with cron-like patterns.
Cron Jobs
Implement cron-based job scheduling in Node.js.
Event-Driven Architecture
Build loosely coupled systems with event-driven patterns.
Kafka Basics
Understand Apache Kafka as a distributed event streaming platform.
RabbitMQ Concepts
Understand RabbitMQ as a traditional message broker.
When to Use Queues
Identify scenarios where queues provide clear benefits.
Phase 13: Performance
Optimize Node.js applications for speed, scalability, and resource efficiency.
Node.js Concurrency
Understand how Node.js handles concurrent operations with the event loop.
CPU-Bound vs I/O-Bound
Identify whether workloads are CPU-bound or I/O-bound.
Blocking the Event Loop
Identify and fix operations that block the Node.js event loop.
Worker Threads
Use worker threads to offload CPU-intensive work.
Connection Pooling
Use connection pools for efficient database connection management.
Database Performance
Optimize database queries and indexes for fast responses.
Query Optimization
Write efficient MongoDB queries and avoid common pitfalls.
MongoDB Indexes
Design indexes that match your query patterns.
Caching
Use Redis caching to reduce database load and latency.
Pagination
Implement efficient pagination for large result sets.
Compression
Enable gzip/br compression for smaller response payloads.
Streaming
Use streams for efficient handling of large data transfers.
Load Balancing
Distribute traffic across multiple Node.js instances.
Horizontal Scaling
Scale Node.js applications by adding more server instances.
Performance Profiling
Profile Node.js applications to find bottlenecks.
Performance Debugging
Debug performance issues in production Node.js applications.
Phase 14: Testing
Write reliable tests for Node.js backends with Jest and Supertest.
Backend Testing
Understand the testing pyramid for backend applications.
Unit Testing
Test individual functions and modules in isolation.
Integration Testing
Test how modules work together with databases and external services.
API Testing
Test REST API endpoints for correct behavior and responses.
Jest
Use Jest as the primary testing framework for Node.js backends.
Supertest
Test Express HTTP endpoints using Supertest.
Mocking
Mock external dependencies for isolated testing.
Test Doubles
Use stubs, mocks, spies, and fakes in tests.
Testing Controllers
Test Express controller logic with mocked services.
Testing Services
Test business logic in the service layer.
Testing Database Logic
Test Mongoose models and database operations.
Testing Authentication
Test login, registration, and token validation flows.
Testing Authorization
Test role-based access and permission checks.
Testing Error Cases
Test error handling, validation failures, and edge cases.
Testing Async Code
Properly test async/await and Promise-based code.
Test Coverage
Measure and improve test coverage for backend code.
End-to-End Testing
Test complete user flows from HTTP request to database.
Phase 15: Observability
Monitor, log, and trace Node.js applications in production.
Logging
Implement structured logging for Node.js applications.
Log Levels
Use appropriate log levels: error, warn, info, debug, trace.
Structured Logging
Log structured JSON for machine-parseable log analysis.
Request Logging
Log incoming requests and outgoing responses with context.
Error Logging
Log errors with stack traces and contextual information.
Metrics
Collect and expose application metrics for monitoring.
Health Checks
Implement health check endpoints for load balancers.
Liveness
Implement liveness probes to detect deadlocked applications.
Readiness
Implement readiness probes for traffic routing decisions.
Monitoring
Set up application monitoring dashboards and alerts.
Distributed Tracing
Trace requests across multiple services with correlation IDs.
Request IDs
Generate and propagate unique request identifiers.
Performance Monitoring
Monitor response times, throughput, and resource usage.
Production Debugging
Debug issues in production Node.js applications.
Incident Investigation
Investigate production incidents using logs and traces.
Phase 16: Deployment
Deploy Node.js applications with Docker, CI/CD, and cloud platforms.
Development vs Production
Understand differences between dev and production environments.
Environment Variables
Manage secrets and configuration for production deployments.
Build Process
Set up build scripts for production-ready Node.js applications.
Process Management
Use PM2 to manage Node.js processes in production.
Docker Fundamentals
Understand Docker containers and their benefits for deployment.
Dockerfile
Write optimized Dockerfiles for Node.js applications.
Docker Compose
Orchestrate multi-container setups with Docker Compose.
Container Networking
Understand Docker networking for container communication.
Reverse Proxy
Use Nginx as a reverse proxy for Node.js applications.
Nginx Basics
Configure Nginx for serving and proxying Node.js apps.
CI/CD Fundamentals
Understand continuous integration and deployment pipelines.
GitHub Actions Concepts
Automate testing and deployment with GitHub Actions.
Deployment Strategies
Compare blue-green, canary, and rolling deployments.
Health Checks
Implement health checks for container orchestration.
Production Logs
Collect and analyze logs from production containers.
Rollback
Implement rollback strategies for failed deployments.
Basic AWS Concepts
Understand core AWS services for Node.js deployment.
EC2
Deploy Node.js applications on EC2 instances.
S3
Store static assets and uploads in Amazon S3.
CloudFront
Serve static content via CloudFront CDN.
Load Balancer
Use AWS ALB for distributing traffic to Node.js instances.
Managed Databases
Use managed MongoDB services like Atlas or DocumentDB.
Basic Cloud Architecture
Design production cloud architecture for Node.js apps.
Phase 17: MERN Projects
Build complete backend projects that combine all MERN stack skills.
Authentication Backend
Build a complete auth system with registration, login, JWT, and refresh tokens.
E-Commerce Backend
Build products, cart, orders, and payment APIs with MongoDB.
Real-Time Chat Backend
Build a chat API with Socket.IO, rooms, and message persistence.
URL Shortener
Build a URL shortener with analytics, rate limiting, and caching.
Notification Service
Build a notification system with email, queues, and retries.
Job Processing System
Build a job queue system with workers, retries, and monitoring.
Phase 18: MERN Interview Preparation
Prepare for backend interview questions specific to the MERN stack.
JavaScript Backend Questions
Common JavaScript questions asked in backend interviews.
Node.js Questions
Node.js architecture, event loop, and core API interview questions.
Event Loop Questions
Deep dive event loop questions commonly asked in interviews.
Express.js Questions
Express middleware, routing, and architecture questions.
REST API Questions
REST API design and implementation interview questions.
MongoDB Questions
MongoDB queries, aggregation, and indexing interview questions.
Mongoose Questions
Mongoose schemas, validation, and performance questions.
Authentication Questions
JWT, sessions, and authentication flow interview questions.
JWT Questions
JSON Web Token security, signing, and validation questions.
Security Questions
Node.js security best practices and vulnerability questions.
Redis Questions
Redis caching, sessions, and distributed systems questions.
WebSocket Questions
WebSocket and Socket.IO architecture interview questions.
Queue Questions
Job queues, BullMQ, and async processing interview questions.
Performance Questions
Node.js performance optimization interview questions.
Testing Questions
Jest, Supertest, and testing strategy interview questions.
Docker Questions
Docker containerization and deployment interview questions.
Deployment Questions
CI/CD, cloud deployment, and production operations questions.
Debugging Questions
Production debugging and incident investigation questions.
Backend Architecture Questions
System design and architecture questions for MERN backends.
Production Incident Questions
How to handle and discuss production incidents in interviews.