Skip to main content
Knowledge Hub · Give Back Initiative

HUB_STATUS: OPERATIONAL // 20_YRS_OF_KNOWLEDGE · FREE_ACCESS

Two Decades of Engineering Knowledge,Given Back. For Free.

Thousands of interview questions, real-world errors with root-cause solutions, reusable code archives, and structured learning paths — built through 20 years of actual engineering.

One lamp can light a hundred more without losing its own flame. This knowledge hub is not a product. It is not a funnel. It is a contribution — to every developer who once searched alone at 2 AM for an answer that did not exist anywhere on the internet. It exists now. Here.

"A lamp loses nothing by lighting another lamp. This is why this knowledge exists — not to be held, but to be shared."
— Debasis Bhattacharjee
3,500+
Interview Questions

Across 18 languages & frameworks

1,200+
Debug Solutions

Real errors. Root-cause fixes.

800+
Code Snippets

Copy-paste ready. Production tested.

24
Learning Paths

Beginner → Advanced, structured

Section IV · Knowledge Domains

DOMAINS_MAPPED // PHP · JS · PYTHON · AI · SECURITY · ARCHITECTURE

Explore the Ecosystem

View All Domains →
01 · DOMAIN
Interview Questions

Categorized by language, role, and difficulty. From junior to architect-level. With curated model answers built from real hiring experience.

3,500+ questions Explore →
02 · DOMAIN
Error & Debug Archive

Searchable archive of real runtime errors, stack traces, and exceptions — each with root cause analysis and tested fix. Like Stack Overflow, but curated.

1,200+ solutions Explore →
03 · DOMAIN
Code Snippet Library

Reusable, production-tested code patterns across PHP, Python, JavaScript, VB.NET, SQL and more. No fluff — just working implementations.

800+ snippets Explore →
04 · DOMAIN
System Design Notes

Architecture patterns, design principles, scalability thinking, and real-world system breakdowns explained from an engineer who has built them.

150+ case studies Explore →
05 · DOMAIN
Learning Paths

Structured progression from beginner to professional — curriculum-style roadmaps with sequenced topics, milestones, and recommended resources.

24 paths Explore →
06 · DOMAIN
Security & Ethical Hacking

Penetration testing concepts, vulnerability patterns, OWASP deep dives, and defensive coding practices drawn from real security consulting work.

200+ topics Explore →
Section V · Interview Preparation

INTERVIEW_PREP: ACTIVE // JUNIOR · MID · SENIOR · ARCHITECT

Questions & Answers

All 1,774 Questions →
Q·001 Can you explain how JWTs are used in API authentication and what the main benefits are compared to traditional session-based authentication methods?
API authentication (OAuth/JWT) Language Fundamentals Mid-Level

JWTs, or JSON Web Tokens, are used for stateless authentication in APIs, where the server generates a token with user claims and sends it to the client. The client then includes this token in subsequent requests, allowing for easy scalability and reduced server load since no session information is stored on the server side.

Deep Dive: JWTs enhance API authentication by enabling stateless interactions between clients and servers. Each token contains three parts: a header, payload, and signature, which can encapsulate user claims and expiration time. Since the server does not need to maintain session state, it simplifies scaling by allowing the API to be distributed across multiple instances without synchronization issues. Additionally, JWTs can be validated using the public key of the signing algorithm, ensuring data integrity and authenticity. One key consideration is token expiration; without a proper renewal strategy, there’s a risk of users being logged out unexpectedly, potentially impacting user experience.

Real-World: In an e-commerce web application, when a user logs in, the server generates a JWT containing the user's ID and roles. This token is sent to the client and stored in local storage. For subsequent API calls, such as retrieving order history, the client includes this JWT in the Authorization header. The server verifies the token and extracts the user's identity, serving the appropriate data without needing to check a session store, thereby improving performance under load during high traffic events.

⚠ Common Mistakes: A common mistake developers make is not implementing proper expiration for JWTs, which can create security vulnerabilities by allowing compromised tokens to remain valid indefinitely. Another frequent error is neglecting to validate the token signature before processing requests, which can lead to unauthorized access if an attacker forges the token. Additionally, some may mistakenly believe that storing sensitive information in the payload is safe, while in reality, the entire token can be decoded, making it a risky practice.

🏭 Production Scenario: In a recent project involving a mobile application that communicates with a REST API, we faced challenges when migrating from traditional session management to JWT-based authentication. Initial user complaints about unexpected logouts highlighted the importance of managing token expiration and refresh strategies. Implementing a refresh token mechanism significantly improved user experience by allowing users to stay logged in seamlessly while still maintaining security.

Follow-up questions: What are the key components of a JWT? How would you handle token expiration and renewal in a production application? Can you explain the security implications of using JWTs? How would you mitigate common vulnerabilities associated with JWTs?

// ID: AUTH-MID-001  ·  DIFFICULTY: 5/10  ·  ★★★★★☆☆☆☆☆

Q·002 Can you explain how JSON Web Tokens (JWT) are used in OAuth 2.0 for API authentication and what the advantages are over traditional session-based authentication?
API authentication (OAuth/JWT) Frameworks & Libraries Mid-Level

JWT is used in OAuth 2.0 as a way to securely transmit information between parties. It allows for stateless authentication, meaning no session information is stored on the server, which can enhance scalability and performance.

Deep Dive: JSON Web Tokens (JWT) are compact, URL-safe means of representing claims to be transferred between two parties. In the context of OAuth 2.0, a JWT can be used as an access token, allowing a client to authenticate to a resource server without needing to reference a session stored on the server. This stateless nature means that all the necessary information for authentication is contained within the token itself, reducing server load and improving performance as you don't need to maintain session state across server instances. However, developers must ensure that tokens have a reasonable expiration time to mitigate security risks, and they should handle token revocation carefully since old tokens may linger due to their stateless nature. Additionally, JWTs can contain additional claims, which can facilitate fine-grained access control policies beyond simple permissions.

Real-World: In a mid-sized e-commerce platform, the development team implemented JWT for managing user sessions. Instead of storing session IDs on the server, they issued a JWT upon successful login that contained user roles and permissions. This allowed the frontend to handle the JWT in local storage and attach it to requests for accessing protected resources. As a result, the application scaled effectively with increased user traffic without the bottleneck of session management on their servers.

⚠ Common Mistakes: A common mistake is not validating the JWT properly, such as failing to check the expiration time or the signature. This can lead to security vulnerabilities as attackers could use expired or tampered tokens. Another frequent error is neglecting to implement proper token revocation; if a user changes their password, all associated JWTs should ideally be invalidated to prevent unauthorized access from stolen tokens. Lastly, many developers overlook the importance of secure storage for JWTs, especially in client-side applications, leading to potential XSS vulnerabilities.

🏭 Production Scenario: I once worked with a team that transitioned from session-based authentication to JWTs for our API. Initially, we faced challenges with token storage and expiration management, leading to user confusion about being logged out unexpectedly. We learned the importance of clear user feedback and proper token lifecycle management to ensure smooth user experiences. The switch ultimately improved our authentication scalability significantly, especially during high traffic events.

Follow-up questions: What are the security implications of using JWTs in a public client? Can you explain how you would revoke a JWT before it expires? How do you handle token expiration and refresh tokens in your architecture? Can you describe a scenario where using JWT might not be ideal?

// ID: AUTH-MID-002  ·  DIFFICULTY: 6/10  ·  ★★★★★★☆☆☆☆

Q·003 Can you explain how JWTs are used for authentication in APIs and some potential security risks associated with them?
API authentication (OAuth/JWT) Language Fundamentals Mid-Level

JWTs, or JSON Web Tokens, are used for authentication by allowing a server to issue a token that encodes user information and permissions, which the client then provides in subsequent requests. However, risks include token tampering, expiration management, and inadequate secret key protection.

Deep Dive: JWTs are structured as three parts: a header, a payload, and a signature, which together ensure that the information about the user can be securely transmitted. The server issues a JWT upon successful authentication, which the client includes in the Authorization header of HTTP requests to access protected resources. One significant security risk is that if the secret key used to sign the JWT is poorly managed or exposed, an attacker can forge tokens. Additionally, since JWTs can be long-lived, they must include proper expiration claims to mitigate the impact of stolen tokens. Implementing refresh tokens and ensuring short-lived access tokens can help minimize risk.

Real-World: In a recent project, we implemented JWTs for user authentication in a microservices architecture. Each service verified the token's signature against a shared secret, which ensured the integrity of the claims. We added an expiration time to the tokens, prompting users to re-authenticate periodically. This not only improved security but also allowed us to implement a refresh token mechanism to enhance user experience by reducing the frequency of logins.

⚠ Common Mistakes: A common mistake is neglecting to validate the signature of the JWT, which can leave the API vulnerable to attacks if an attacker sends a forged token. Another frequent issue is setting overly long expiration times for access tokens, which increases the risk of token theft remaining effective for a longer period. Developers sometimes also forget to implement proper scopes or claims in the payload, leading to broader access than intended, potentially compromising sensitive data.

🏭 Production Scenario: In a production scenario, I observed a team using JWTs for mobile API authentication. They faced a challenge when a stolen token was used to access sensitive user data because they had set long expiration times. This led to an immediate need for implementing stricter token management policies, such as reducing token lifespan and introducing refresh tokens to minimize the window of opportunity for misuse.

Follow-up questions: How do you validate a JWT on the server-side? What steps would you take to mitigate the risk associated with token storage on the client-side? Can you explain the role of refresh tokens in a JWT authentication workflow? What would you do if a JWT is compromised and how would you handle existing sessions?

// ID: AUTH-MID-003  ·  DIFFICULTY: 6/10  ·  ★★★★★★☆☆☆☆

Section VI · Error & Debug Archive

DEBUG_ARCHIVE: LIVE // REAL_ERRORS · ANNOTATED_FIXES

Real Errors. Root-Cause Fixes.

All 1,200 Solutions →
PHP ERROR E_FATAL · #DB-001
Undefined variable: $conn — PDO connection not persisted across scope
Fatal error: Uncaught Error: Call to a member function query() on null

Connection object passed by value. Fix: pass by reference or use dependency injection through constructor.

4,200 views Read Fix →
JAVASCRIPT RUNTIME · #JS-044
Cannot read properties of undefined — React state not yet populated on first render
TypeError: Cannot read properties of undefined (reading 'map')

State initialized as undefined, not empty array. Fix: initialize with useState([]) and guard with optional chaining.

7,800 views Read Fix →
SQL ERROR CONSTRAINT · #SQL-019
Foreign key constraint fails on INSERT — parent row not found in referenced table
ERROR 1452: Cannot add or update a child row: a foreign key constraint fails

Insertion order violation. Fix: insert parent record first, or disable FK checks during bulk migration with SET FOREIGN_KEY_CHECKS=0.

3,100 views Read Fix →
PYTHON IMPORT · #PY-007
ModuleNotFoundError in virtual environment — pip installed globally but not inside venv
ModuleNotFoundError: No module named 'requests'

Package installed to system Python, not active venv. Fix: activate venv first, then pip install. Verify with which python.

5,400 views Read Fix →
VB.NET RUNTIME · #VB-031
NullReferenceException on DataGridView load — DataSource bound before data fetched
System.NullReferenceException: Object reference not set to an instance

Binding fires before async fetch completes. Fix: await the data load, then set DataSource. Use BindingSource for dynamic updates.

2,700 views Read Fix →
WORDPRESS PLUGIN · #WP-012
White Screen of Death after plugin activation — memory limit exhausted on init hook
Fatal error: Allowed memory size of 67108864 bytes exhausted

Plugin loading heavy library on every request. Fix: lazy-load on relevant admin pages only. Increase WP_MEMORY_LIMIT in wp-config as temporary measure.

6,200 views Read Fix →
Section VII · Code Archive

Copy. Adapt. Ship.

All 800 Snippets →
PHP · PATTERN
Singleton Database Connection

Thread-safe PDO connection with single instance guarantee. Works with MySQL, PostgreSQL, SQLite.

private static ?self $instance = null;
12 uses this week View →
PYTHON · UTILITY
Rate-Limited API Client

Async HTTP client with automatic retry, exponential backoff, and per-domain rate limiting.

async def fetch_with_retry(url, max=3):
28 uses this week View →
SQL · QUERY
Recursive CTE Hierarchy

Self-referencing table traversal for category trees, org charts, and menu structures using Common Table Expressions.

WITH RECURSIVE tree AS (SELECT ...)
19 uses this week View →
JAVASCRIPT · HOOK
Custom useDebounce Hook

React hook for debouncing search inputs, form fields, and resize events. Prevents excessive API calls.

const useDebounce = (value, delay) => {
41 uses this week View →
Section VIII · Structured Learning

LEARNING_PATHS: READY // 4_TRACKS · STRUCTURED · MENTOR_GUIDED

Learning Paths

All 24 Paths →

PHP Developer: Zero to Production

Beginner

From syntax fundamentals to building RESTful APIs and WordPress plugins. Designed for complete beginners with no prior programming background.

PHP Syntax & Data Types
OOP: Classes, Interfaces, Traits
Database: PDO & MySQL
REST API Design
WordPress Plugin Development
18 modules · ~40 hrs Start Path →

Full-Stack JavaScript: React + Node

Mid-Level

Modern full-stack development with React, Node.js, Express, and PostgreSQL. Includes deployment, auth, and real project builds.

Modern ES2024 JavaScript
React: State, Hooks, Context
Node.js & Express APIs
Auth: JWT & OAuth 2.0
CI/CD & Deployment
22 modules · ~60 hrs Start Path →

Software Architecture Mastery

Advanced

Design patterns, SOLID principles, microservices, event-driven architecture, and real-world system design interview preparation.

Design Patterns: GoF 23
Domain-Driven Design
Microservices & Event Bus
Scalability Patterns
System Design Interviews
16 modules · ~35 hrs Start Path →

AI Integration for Developers

Mid-Level

Practical AI integration using Claude API, OpenAI, and MCP. Build real AI-powered applications, tools, and automation workflows.

LLM Fundamentals & Prompting
Claude API & OpenAI SDK
Model Context Protocol (MCP)
RAG Systems & Embeddings
Deploying AI-Powered Apps
14 modules · ~28 hrs Start Path →

"The best engineering knowledge is not found in textbooks — it is extracted from late nights, broken builds, angry clients, and the stubborn refusal to stop until the problem is solved."

— Debasis Bhattacharjee · Software Architect · 20 Years in Production

Section X · The Ecosystem Grows

ARCHIVE_GROWING // CONTRIBUTIONS_OPEN · LIVING_DOCUMENT

This Is a Living Archive. Not a Static Library.

Every week, new errors are documented, new interview patterns are added, and new solutions are tested in production. The knowledge hub grows because real problems keep appearing — and every answer earns its place here by actually working.

If you found a fix that saved your project, or spotted an answer that could be better — the door is always open. This ecosystem belongs to everyone who uses it.

Submit via Email
Send your question, error, or solution directly
Submit →
Leave a Testimonial
Did something here help you? Share your experience
Share →
Comment on Facebook
Find us at @iamdebasisbhattacharjee
Visit →
Get Update Alerts
Subscribe to be notified of new additions
Subscribe →
Section XI · Let's Talk

Knowledge is Free.
Mentorship is Personal.

The hub is open to everyone — but if you need structured guidance, 1-on-1 mentorship, or corporate training, that's a different conversation. Let's have it.

hello@debasisbhattacharjee.com  ·  +91 8777088548  ·  Mon–Fri, 9AM–6PM IST