π Why Database Application Architecture?
Database applications are often built using multi-tier architectures to separate concerns like user interface, business logic, and data storage. This structure improves scalability, maintainability, and security.
<div class="infographic-dbtree" id="dbtreeWrap">
<style>
.infographic-dbtree {
--ink: #1a1a1a;
--ink-soft: #5c5c5c;
--paper: #ffffff;
--paper-alt: #f6f3ee;
--accent: #2563eb;
--accent-soft:#e3ebfd;
--line: #ddd6c9;
background: var(--paper);
color: var(--ink);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
padding: 2.5rem 1.5rem;
border-radius: 14px;
box-sizing: border-box;
max-width: 760px;
margin: 0 auto;
}
.infographic-dbtree[data-theme="dark"] {
--ink: #e8e6e1;
--ink-soft: #9a968c;
--paper: #121212;
--paper-alt: #1e1e26;
--accent: #5b8def;
--accent-soft:#202942;
--line: #2c313d;
}
.infographic-dbtree * { box-sizing: border-box; }
.dbtree-eyebrow {
font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
color: var(--accent); font-weight: 700; margin: 0 0 0.4rem; text-align: center;
}
.dbtree-title { font-size: 1.4rem; font-weight: 700; margin: 0 0 1.75rem; text-align: center; letter-spacing: -0.01em; }
.dbtree-root-row { display: flex; justify-content: center; margin-bottom: 4px; }
.dbtree-root {
background: var(--accent); color: #fff; font-weight: 800; font-size: 1rem;
text-align: center; border-radius: 8px; padding: 0.8rem 1.6rem; line-height: 1.25;
}
.fan-svg { display: block; width: 100%; height: 46px; }
.mobile-arrow { display: none; justify-content: center; margin: 2px 0 6px; }
.conn-line { fill: none; stroke: var(--ink-soft); stroke-width: 2.2; }
.conn-arrow { fill: var(--ink-soft); }
.dbtree-columns { display: flex; gap: 0.6rem; align-items: stretch; }
.tree-col { flex: 1; display: flex; flex-direction: column; align-items: stretch; }
.tier-box {
font-weight: 700; font-size: 0.85rem; line-height: 1.25;
background: var(--paper-alt); color: var(--accent); border: 2px solid var(--accent-soft);
border-radius: 8px; padding: 0.75rem 0.5rem; text-align: center;
}
.branch-row { display: flex; justify-content: center; }
.branch-row svg { display: block; }
.desc-box {
background: var(--accent-soft); border: 1px solid var(--line); border-radius: 8px;
padding: 0.75rem 0.8rem; font-size: 0.8rem; line-height: 1.45;
}
@media (max-width: 620px) {
.fan-svg { display: none; }
.mobile-arrow { display: flex; }
.dbtree-columns { flex-direction: column; gap: 1.1rem; }
}
</style>
<p class="dbtree-eyebrow">DBMS Architecture</p>
<h2 class="dbtree-title">Single, Two & Three-Tier Architecture</h2>
<div class="dbtree-root-row">
<div class="dbtree-root">DBMS<br>Architecture</div>
</div>
<svg class="fan-svg" id="fanSvg" viewBox="0 0 300 46" preserveAspectRatio="none"></svg>
<div class="mobile-arrow">
<svg width="20" height="26" viewBox="0 0 20 26">
<line class="conn-line" x1="10" y1="0" x2="10" y2="16" stroke-width="2.2"/>
<polygon class="conn-arrow" points="10,24 5,14 15,14"/>
</svg>
</div>
<div class="dbtree-columns" id="dbtreeColumns"></div>
</div>
<script>
(function () {
var wrapper = document.getElementById('dbtreeWrap');
// Dark mode detection β body attribute wins, then cookie, then light default
var bodyAttr = document.body.getAttribute('data-darkmode');
var dark;
if (bodyAttr === 'true') {
dark = true;
} else if (bodyAttr === 'false') {
dark = false;
} else {
var match = document.cookie.match(/(?:^|;\s*)darkMode=([^;]+)/);
dark = match ? match[1] === 'true' : false;
}
if (dark) wrapper.setAttribute('data-theme', 'dark');
var tiers = [
{
label: 'Single Tier\nArchitecture',
detail: 'All the components β client, server, and database β of the DBMS reside on a single machine.'
},
{
label: 'Two Tier\nArchitecture',
detail: 'Follows a client-server architecture where the server provides DBMS functionality that the client accesses using APIs.'
},
{
label: 'Three Tier\nArchitecture',
detail: 'Adds an Application Layer in addition to Client and Server, to provide load balancing and enhance DBMS security.'
}
];
// --- Fan connector: root stem splitting into 3 branches (desktop only) ---
var fanSvg = document.getElementById('fanSvg');
fanSvg.innerHTML =
'<path class="conn-line" d="M150 0 V15 M50 15 H250 M50 15 V32 M150 15 V32 M250 15 V32"/>' +
'<polygon class="conn-arrow" points="50,38 45,30 55,30"/>' +
'<polygon class="conn-arrow" points="150,38 145,30 155,30"/>' +
'<polygon class="conn-arrow" points="250,38 245,30 255,30"/>';
var columns = document.getElementById('dbtreeColumns');
tiers.forEach(function (t) {
var col = document.createElement('div');
col.className = 'tree-col';
var box = document.createElement('div');
box.className = 'tier-box';
box.innerHTML = t.label.replace('\n', '<br>');
var branch = document.createElement('div');
branch.className = 'branch-row';
branch.innerHTML =
'<svg width="20" height="34" viewBox="0 0 20 34">' +
'<line class="conn-line" x1="10" y1="0" x2="10" y2="24" stroke-width="2.2"/>' +
'<polygon class="conn-arrow" points="10,32 5,22 15,22"/>' +
'</svg>';
var descBox = document.createElement('div');
descBox.className = 'desc-box';
descBox.textContent = t.detail;
col.appendChild(box);
col.appendChild(branch);
col.appendChild(descBox);
columns.appendChild(col);
});
})();
</script>.demo {
font-family: system-ui, sans-serif;
padding: 16px;
}
.demo h1 {
color: #2563eb;
margin: 0 0 8px;
}
.demo p {
color: #4b5563;
margin: 0;
}document.querySelector('.demo h1')?.addEventListener('click', () => {
alert('Hello from live preview!');
});<div class="infographic-tierarch" id="tierWrap">
<style>
.infographic-tierarch {
--ink: #1a1a1a;
--ink-soft: #5c5c5c;
--paper: #ffffff;
--paper-alt: #f6f3ee;
--accent: #2563eb;
--accent-soft:#e3ebfd;
--line: #ddd6c9;
--success: #1a8a5f;
--success-soft: #e1f5ec;
--danger: #c0392b;
--danger-soft: #fbe9e7;
background: var(--paper);
color: var(--ink);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
padding: 2.5rem 1.5rem;
border-radius: 14px;
box-sizing: border-box;
max-width: 760px;
margin: 0 auto;
}
.infographic-tierarch[data-theme="dark"] {
--ink: #e8e6e1;
--ink-soft: #9a968c;
--paper: #121212;
--paper-alt: #1e1e26;
--accent: #5b8def;
--accent-soft:#202942;
--line: #2c313d;
--success: #4fd8a8;
--success-soft: #123528;
--danger: #e57373;
--danger-soft: #3a2222;
}
.infographic-tierarch * { box-sizing: border-box; }
.tier-eyebrow {
font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
color: var(--accent); font-weight: 700; margin: 0 0 0.4rem; text-align: center;
}
.tier-title { font-size: 1.45rem; font-weight: 700; margin: 0 0 1.5rem; text-align: center; letter-spacing: -0.01em; }
.tier-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin-bottom: 1.5rem; }
.tier-tab {
font: inherit; font-size: 0.82rem; font-weight: 700;
background: var(--paper-alt); color: var(--ink); border: 1px solid var(--line);
border-radius: 999px; padding: 0.5rem 1rem; cursor: pointer;
transition: border-color .15s, background .15s, color .15s;
}
.tier-tab:hover { border-color: var(--accent); }
.tier-tab.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tier-diagram {
display: flex; align-items: center; justify-content: center;
background: var(--paper-alt); border: 1px solid var(--line); border-radius: 12px;
padding: 1.2rem; margin-bottom: 1rem; min-height: 240px;
}
.tier-diagram svg { display: block; max-width: 100%; height: auto; }
.flow-line {
stroke: var(--ink-soft); stroke-dasharray: 6 5;
animation: diagDash .9s linear infinite;
}
@keyframes diagDash { to { stroke-dashoffset: -22; } }
.tier-panel {
background: var(--paper-alt); border: 1px solid var(--line); border-radius: 12px;
padding: 1.4rem 1.5rem;
}
.tier-panel.is-fading { animation: tierFade .35s ease; }
@keyframes tierFade { from { opacity: 0.2; } to { opacity: 1; } }
.tier-panel > *:last-child { margin-bottom: 0; }
.tier-panel-title { font-size: 1.1rem; font-weight: 700; margin: 0 0 0.6rem; color: var(--accent); }
.tier-desc { font-size: 0.88rem; line-height: 1.55; margin: 0 0 1rem; }
.tier-section-label {
font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em;
color: var(--ink-soft); font-weight: 700; margin: 0 0 0.4rem;
}
.tier-list { margin: 0 0 1rem; padding-left: 1.1rem; font-size: 0.85rem; line-height: 1.5; }
.tier-list li { margin-bottom: 0.3rem; }
.tier-example {
background: var(--paper); border: 1px solid var(--line); border-radius: 8px;
padding: 0.7rem 0.9rem; font-size: 0.84rem; line-height: 1.5; margin: 0 0 1rem;
}
.tier-proscons { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.tier-proscons-col { border-radius: 8px; padding: 0.75rem 0.9rem; }
.tier-proscons-col.pros { background: var(--success-soft); }
.tier-proscons-col.cons { background: var(--danger-soft); }
.tier-proscons-col h4 {
font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em;
margin: 0 0 0.5rem;
}
.tier-proscons-col.pros h4 { color: var(--success); }
.tier-proscons-col.cons h4 { color: var(--danger); }
.tier-proscons-col ul { margin: 0; padding-left: 1.1rem; font-size: 0.84rem; line-height: 1.5; }
.tier-proscons-col li { margin-bottom: 0.3rem; }
@media (max-width: 560px) {
.tier-proscons { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
.infographic-tierarch *, .infographic-tierarch *::before, .infographic-tierarch *::after {
animation-duration: 0.001ms !important; transition-duration: 0.001ms !important;
}
}
</style>
<p class="tier-eyebrow">DBMS Architecture</p>
<h2 class="tier-title">Single-Tier vs. Two-Tier vs. Three-Tier</h2>
<div class="tier-tabs" id="tierTabs"></div>
<div class="tier-diagram" id="tierDiagram"></div>
<div class="tier-panel" id="tierPanel"></div>
</div>
<script>
(function () {
var wrapper = document.getElementById('tierWrap');
// Dark mode detection β body attribute wins, then cookie, then light default
var bodyAttr = document.body.getAttribute('data-darkmode');
var dark;
if (bodyAttr === 'true') {
dark = true;
} else if (bodyAttr === 'false') {
dark = false;
} else {
var match = document.cookie.match(/(?:^|;\s*)darkMode=([^;]+)/);
dark = match ? match[1] === 'true' : false;
}
if (dark) wrapper.setAttribute('data-theme', 'dark');
var A = 'stroke:var(--accent)';
function clientIcon(x, y) {
return '<g transform="translate(' + x + ',' + y + ')">' +
'<rect x="0" y="0" width="46" height="34" rx="3" fill="none" style="' + A + '" stroke-width="2"/>' +
'<line x1="16" y1="34" x2="16" y2="42" style="' + A + '" stroke-width="2"/>' +
'<line x1="30" y1="34" x2="30" y2="42" style="' + A + '" stroke-width="2"/>' +
'<line x1="10" y1="42" x2="36" y2="42" style="' + A + '" stroke-width="2"/>' +
'</g>';
}
function dbIcon(x, y) {
return '<g transform="translate(' + x + ',' + y + ')">' +
'<path d="M2 8 C2 4 12 1 22 1 C32 1 42 4 42 8 V34 C42 38 32 41 22 41 C12 41 2 38 2 34 Z" fill="none" style="' + A + '" stroke-width="2"/>' +
'<path d="M2 8 C2 12 12 15 22 15 C32 15 42 12 42 8" fill="none" style="' + A + '" stroke-width="2"/>' +
'</g>';
}
function bigDbIcon(x, y, w, h, line1, line2) {
var rx = w / 2, cap = h * 0.16;
return '<g transform="translate(' + x + ',' + y + ')">' +
'<path d="M0 ' + cap + ' C0 ' + (cap * 0.3) + ' ' + (rx * 0.5) + ' 0 ' + rx + ' 0 C ' + (rx * 1.5) + ' 0 ' + w + ' ' + (cap * 0.3) + ' ' + w + ' ' + cap +
' V ' + (h - cap) + ' C ' + w + ' ' + (h - cap * 0.3) + ' ' + (rx * 1.5) + ' ' + h + ' ' + rx + ' ' + h +
' C ' + (rx * 0.5) + ' ' + h + ' 0 ' + (h - cap * 0.3) + ' 0 ' + (h - cap) + ' Z" fill="none" style="' + A + '" stroke-width="2.2"/>' +
'<path d="M0 ' + cap + ' C0 ' + (cap * 1.7) + ' ' + (rx * 0.5) + ' ' + (cap * 2) + ' ' + rx + ' ' + (cap * 2) +
' C ' + (rx * 1.5) + ' ' + (cap * 2) + ' ' + w + ' ' + (cap * 1.7) + ' ' + w + ' ' + cap +
'" fill="none" style="' + A + '" stroke-width="2.2"/>' +
'<text x="' + rx + '" y="' + (h / 2 + 14) + '" text-anchor="middle" style="fill:var(--accent); font-weight:700; font-size:12px; font-family:inherit;">' + line1 + '</text>' +
'<text x="' + rx + '" y="' + (h / 2 + 30) + '" text-anchor="middle" style="fill:var(--accent); font-weight:700; font-size:12px; font-family:inherit;">' + line2 + '</text>' +
'</g>';
}
function serverIcon(x, y) {
return '<g transform="translate(' + x + ',' + y + ')">' +
'<rect x="0" y="0" width="46" height="12" rx="2" fill="none" style="' + A + '" stroke-width="2"/>' +
'<rect x="0" y="15" width="46" height="12" rx="2" fill="none" style="' + A + '" stroke-width="2"/>' +
'<rect x="0" y="30" width="46" height="12" rx="2" fill="none" style="' + A + '" stroke-width="2"/>' +
'<circle cx="7" cy="6" r="1.6" style="fill:var(--accent)"/>' +
'<circle cx="7" cy="21" r="1.6" style="fill:var(--accent)"/>' +
'<circle cx="7" cy="36" r="1.6" style="fill:var(--accent)"/>' +
'</g>';
}
function label(x, y, text, anchor) {
return '<text x="' + x + '" y="' + y + '" text-anchor="' + (anchor || 'middle') + '" ' +
'style="fill:var(--ink-soft); font-size:11px; font-family:inherit;">' + text + '</text>';
}
function arrowLine(x1, y1, x2, y2, size) {
var dx = x2 - x1, dy = y2 - y1;
var len = Math.sqrt(dx * dx + dy * dy) || 1;
var ux = dx / len, uy = dy / len;
var s = size || 8;
function tri(tipX, tipY, dirX, dirY) {
var baseX = tipX - dirX * s, baseY = tipY - dirY * s;
var perpX = -dirY, perpY = dirX;
var lx = baseX + perpX * s * 0.55, ly = baseY + perpY * s * 0.55;
var rx = baseX - perpX * s * 0.55, ry = baseY - perpY * s * 0.55;
return tipX + ',' + tipY + ' ' + lx.toFixed(1) + ',' + ly.toFixed(1) + ' ' + rx.toFixed(1) + ',' + ry.toFixed(1);
}
return '<line x1="' + x1 + '" y1="' + y1 + '" x2="' + x2 + '" y2="' + y2 + '" class="flow-line" stroke-width="2"/>' +
'<polygon points="' + tri(x1, y1, -ux, -uy) + '" style="fill:var(--ink-soft)"/>' +
'<polygon points="' + tri(x2, y2, ux, uy) + '" style="fill:var(--ink-soft)"/>';
}
var diagrams = {
tier1:
'<svg viewBox="0 0 260 170" width="260" height="170">' +
'<rect x="8" y="8" width="244" height="130" rx="10" fill="none" style="' + A + '" stroke-width="2" stroke-dasharray="5 4"/>' +
clientIcon(35, 40) + label(58, 96, 'Client') +
arrowLine(90, 57, 150, 57) +
dbIcon(155, 37) + label(176, 96, 'Server') +
label(130, 155, 'One device β everything included') +
'</svg>',
tier2:
'<svg viewBox="0 0 320 250" width="320" height="250">' +
clientIcon(10, 15) + label(33, 66, 'Client') +
clientIcon(10, 100) + label(33, 151, 'Client') +
clientIcon(10, 185) + label(33, 236, 'Client') +
arrowLine(60, 32, 190, 117) +
arrowLine(60, 117, 190, 117) +
arrowLine(60, 202, 190, 117) +
bigDbIcon(190, 75, 110, 84, 'Database', 'Server') +
'</svg>',
tier3:
'<svg viewBox="0 0 430 250" width="430" height="250">' +
clientIcon(10, 15) + label(33, 66, 'Client') +
clientIcon(10, 100) + label(33, 151, 'Client') +
clientIcon(10, 185) + label(33, 236, 'Client') +
arrowLine(60, 32, 190, 117) +
arrowLine(60, 117, 190, 117) +
arrowLine(60, 202, 190, 117) +
serverIcon(190, 96) + label(213, 158, 'App Server') +
arrowLine(236, 117, 300, 117) +
bigDbIcon(300, 75, 110, 84, 'Data', 'Source') +
'</svg>'
};
var tiers = [
{
label: 'Tier-1', full: 'Single-Tier (Monolithic)',
desc: 'Everything β user interface, business logic, and database β resides on a single machine.',
characteristics: ['Simple and easy to develop.', 'Suitable for small or standalone systems.'],
example: 'Microsoft Access or SQLite-based desktop applications.',
pros: ['Fast for single users.', 'Low cost.'],
cons: ['Not scalable.', 'Poor security.', 'Difficult to maintain.']
},
{
label: 'Tier-2', full: 'Two-Tier (Client-Server)',
desc: 'Splits the system into two layers β a Client for the interface and application logic, and a Server running the database management system.',
characteristics: ['Clients send requests (SQL) to the database server.', 'The server processes data and sends responses back.'],
example: 'A web app where the frontend (UI + logic) runs in the browser, and the database sits on a server.',
pros: ['More scalable than Tier-1.', 'Easier to manage the database centrally.'],
cons: ['Logic is mixed with the UI.', 'Still limited scalability.', 'Business-rule changes require client updates.']
},
{
label: 'Tier-3', full: 'Three-Tier',
desc: 'Divides the application into three separate layers: Presentation (client UI), Application (middle-tier business logic), and Data (database server).',
characteristics: ['Most common in modern web and enterprise applications.', 'Enables clean separation of concerns.'],
example: 'A web app with an HTML/CSS/JS frontend, a Node.js/Python/Java backend, and a MySQL/PostgreSQL database.',
pros: ['Highly scalable and secure.', 'Easier to update and maintain.', 'Better performance with load balancing.'],
cons: ['More complex and costly to set up.', 'Requires careful coordination between layers.']
}
];
var diagramKeys = ['tier1', 'tier2', 'tier3'];
var tabsEl = document.getElementById('tierTabs');
var diagramEl = document.getElementById('tierDiagram');
var panel = document.getElementById('tierPanel');
var buttons = [];
function listHtml(items) {
var html = '';
items.forEach(function (it) { html += '<li>' + it + '</li>'; });
return html;
}
function renderPanel(i) {
var t = tiers[i];
diagramEl.innerHTML = diagrams[diagramKeys[i]];
var html = '<h3 class="tier-panel-title">' + t.label + ' β ' + t.full + '</h3>';
html += '<p class="tier-desc">' + t.desc + '</p>';
html += '<p class="tier-section-label">Characteristics</p>';
html += '<ul class="tier-list">' + listHtml(t.characteristics) + '</ul>';
html += '<p class="tier-section-label">Example</p>';
html += '<p class="tier-example">' + t.example + '</p>';
html += '<div class="tier-proscons">';
html += '<div class="tier-proscons-col pros"><h4>β Pros</h4><ul>' + listHtml(t.pros) + '</ul></div>';
html += '<div class="tier-proscons-col cons"><h4>β Cons</h4><ul>' + listHtml(t.cons) + '</ul></div>';
html += '</div>';
panel.innerHTML = html;
panel.classList.remove('is-fading');
void panel.offsetWidth;
panel.classList.add('is-fading');
}
tiers.forEach(function (t, i) {
var btn = document.createElement('button');
btn.type = 'button';
btn.className = 'tier-tab' + (i === 0 ? ' is-active' : '');
btn.textContent = t.label;
btn.addEventListener('click', function () {
buttons.forEach(function (b) { b.classList.remove('is-active'); });
btn.classList.add('is-active');
renderPanel(i);
});
tabsEl.appendChild(btn);
buttons.push(btn);
});
renderPanel(0);
})();
</script>.demo {
font-family: system-ui, sans-serif;
padding: 16px;
}
.demo h1 {
color: #2563eb;
margin: 0 0 8px;
}
.demo p {
color: #4b5563;
margin: 0;
}document.querySelector('.demo h1')?.addEventListener('click', () => {
alert('Hello from live preview!');
});π Summary Table:
Feature | Tier-1 | Tier-2 | Tier-3 |
|---|---|---|---|
Layers | 1 | 2 | 3 |
Separation | None | UI+Logic vs. DB | UI / Logic / DB |
Scalability | Low | Medium | High |
Maintainability | Poor | Moderate | Excellent |
Example | MS Access | Client-Server Apps | Web Apps (e.g., Amazon, Gmail) |