🖥️ Static Websites vs Dynamic Websites
We already learned about:
• Frontend
• Backend
• Servers
• Databases
• How browsers communicate with servers
Now let's understand an important difference:
Static website vs Dynamic website
1️⃣ What Is a Static Website?
A static website delivers webpages whose content is generally fixed unless someone changes the underlying files.
For example:
index.html
about.html
contact.html
style.css
script.js
When a user requests a page, the server can simply provide the relevant files.
Browser
↓
Request
↓
Server
↓
HTML/CSS/JS files
↓
Browser
Examples
• Personal portfolio
• Company information page
• Documentation site
• Landing page
• Basic blog
can be built as a static website.
2️⃣ What Is a Dynamic Website?
A dynamic website can generate or retrieve content based on the user, request, stored data, or application logic.
For example, consider an online shopping website.
Two users might see different information because the application retrieves data based on their accounts, preferences, cart, or orders.
A simplified flow:
Browser
↓
Request
↓
Backend
↓
Database
↓
Backend processes data
↓
Response
↓
Browser
🛒 Real-World Example
Imagine an online store.
Static approach
A product page might contain:
Phone
₹25,000
Available
The information is written directly into the webpage files.
If the price changes, someone needs to update the content.
Dynamic approach
The product information can be stored in a database:
Product ID: 101
Name: Phone
Price: ₹25,000
Stock: 18
When someone visits the product page:
Browser
↓
Request product 101
↓
Backend
↓
Database
↓
Product information
↓
Backend
↓
Browser
The webpage can then display the current information.
3️⃣ Static Doesn't Mean "No JavaScript"
This is an important point.
A static website can still use JavaScript.
For example, a static website could have:
A menu that opens when clicked
• Animations
• A calculator
• Form validation
• Interactive components
So:
Static does not mean "not interactive."
It mainly refers to how the content is delivered and generated.
4️⃣ Dynamic Doesn't Mean "Everything Changes"
A dynamic website doesn't mean that every part of the page changes constantly.
It means that some content or behaviour can be generated or retrieved dynamically.
For example, a product website may have:
• Header → Mostly the same
• Navigation → Mostly the same
• Product information → Retrieved dynamically
• User information → Retrieved dynamically
• Cart → User-specific
🧩 Static vs Dynamic
Static Website | Dynamic Website
Content generally comes from predefined files | Content can be generated or retrieved dynamically
Often simpler architecture | Usually more application logic
May not require a database | Often uses a database
Good for many informational sites | Useful for interactive data-driven applications
Easier to start with | Usually more complex
Neither approach is automatically appropriate for every website. The choice depends on the application's requirements.
5️⃣ What About a Blog?
A blog can use either approach.
Static blog
Posts can be generated into HTML pages during a build process.