Not every website needs a database. Static site generators (SSGs) build your entire site as plain HTML files at build time. No database, no server-side processing, no complexity. Here is when this approach wins.
How Static Site Generators Work
- Write content in Markdown files
- Define templates with HTML/JSX
- Run the build command
- Output: plain HTML, CSS, and JavaScript files
- Deploy to any web server or CDN
No database. No PHP. No runtime processing. Just files.
Popular Static Site Generators
| Generator | Language | Speed | Learning Curve |
|---|---|---|---|
| Next.js (SSG mode) | React/TypeScript | Fast | Moderate |
| Hugo | Go | Fastest (builds) | Moderate |
| Astro | TypeScript | Fast | Easy |
| 11ty (Eleventy) | JavaScript | Fast | Easy |
| Gatsby | React | Slow (builds) | Moderate |
Performance: Static vs Dynamic
Static (Pre-built HTML)
Browser → CDN → HTML file (already built)
- Time To First Byte: 10-50ms
- No database queries
- No server-side processing
- Scales to unlimited traffic
- 100% cacheable
Dynamic (WordPress, Drupal)
Browser → Server → PHP → Database → HTML (built on request)
- Time To First Byte: 200-800ms
- Database query on every page load
- Server-side processing required
- Scaling requires more servers
- Caching helps but adds complexity
Static sites are 5-20x faster in Time To First Byte.
Security
Static Sites
Attack surface: essentially zero. There is no database to inject SQL into, no admin panel to brute force, no server-side code to exploit. HTML files on a CDN are the most secure web architecture possible.
Dynamic CMS
WordPress alone accounts for 90% of CMS hacks. Attack vectors include:
- SQL injection
- Cross-site scripting (XSS)
- Plugin vulnerabilities
- Brute force login attempts
- File upload exploits
Dynamic sites require security plugins, firewalls, login protection, and constant vigilance.
Cost
Static Site Hosting
- Vercel: Free (100GB bandwidth)
- Netlify: Free (100GB bandwidth)
- Cloudflare Pages: Free (unlimited bandwidth)
- AWS S3 + CloudFront: ~$5/month for most sites
Static hosting is essentially free for most business websites.
Dynamic CMS Hosting
- Shared hosting (WordPress): $10-30/month
- Managed WordPress: $30-100/month
- VPS (custom CMS): $20-100/month
- Enterprise: $200-2,000/month
The Content Editing Question
This is where dynamic CMS platforms have traditionally won. WordPress has a visual editor. Markdown files require a text editor.
But the gap has closed:
Modern Content Options for Static Sites
Headless CMS + Static Generation: Use Sanity, Contentful, or Strapi for content editing. Build static pages from CMS content. Non-technical editors get a visual CMS. The output is still static HTML.
Git-based CMS: Tools like Tina CMS provide visual editing for Markdown content. Editors see a WYSIWYG interface. Changes commit to Git and trigger a rebuild.
Markdown with Frontmatter: For developer-managed content, Markdown with YAML frontmatter is simple and version-controlled. This blog post you are reading uses this approach.
When Static Wins
- Marketing websites: Corporate sites, landing pages, company pages. Content changes infrequently.
- Blogs: Markdown-based blogging with static generation is fast and secure.
- Documentation: MDX-based documentation sites (Next.js, Docusaurus).
- Portfolio sites: Image-heavy sites benefit from static optimization.
- High-traffic sites: No scaling concerns. CDN handles millions of requests.
When Dynamic Wins
- User-generated content: Comments, forums, social features need real-time database writes.
- E-commerce with real-time inventory: Product availability changes constantly.
- Dashboards and applications: User-specific data requires server-side logic.
- Content that changes every minute: News sites with breaking updates.
- Search with real-time filtering: Complex filtering requires server-side queries.
The Hybrid Approach (Best of Both)
Next.js supports all rendering strategies in one application:
- Static Generation (SSG): Marketing pages, blog posts, landing pages
- Incremental Static Regeneration (ISR): Pages that update periodically
- Server-Side Rendering (SSR): Personalized or real-time pages
- Client-Side Rendering (CSR): Interactive dashboard components
One framework, multiple strategies. Choose per-page based on content needs.
This is what we use. Marketing pages are static for speed and security. Dynamic features use server-side rendering. The best of both worlds.
Our Architecture
We build with Next.js using static generation for content pages and server-side rendering for dynamic features. The result: the speed and security of static with the flexibility of dynamic when needed.
Contact us to discuss the right architecture for your website.