v0.2PHP + SQLite · MIT · No trackers

A self-hosted blog in one script tag.

TinyBlog is a single PHP file with a SQLite database and a one-line JavaScript embed. Render a feed, a single post, or a subscribe box on any site — publishing and data stay on your host, not a vendor cloud.

  • MIT licensed
  • Runs on PHP 8 shared hosting
  • No trackers on readers
2 files
to deploy
~250 KB
one PHP file, no deps
0 external
requests on your blog
5-min
cPanel install

Read the source — it's one file

acme-goods.com/journal live widget
From the journal
This is the actual widget, rendering the actual JSON.
store-page.html
<script
  src="https://blog.example.com/tinyblog-widget.js"
  data-tb-config='{"site":"store-1",
    "endpoint":"https://blog.example.com/api",
    "widgetType":"feed","maxItems":5}'>
</script>

// That's the whole client-side integration.
// Posts render from JSON your PHP host serves —
// prepared SQL, CORS allowlist, no third parties.

Who it's for

A blog for sites that already exist.

For a store, portfolio, docs site, or product-updates feed, a full CMS or a hosted platform is often too much. TinyBlog adds the blog without rebuilding the site.

Online stores

Publish buying guides, launches, and stories beside your products, without a monthly blog-app subscription.

Product & SaaS teams

Run a changelog or product-updates feed on your marketing site or docs, with RSS and JSON Feed built in.

Agencies & freelancers

Drop one small backend onto a client's existing hosting and hand them a browser admin. No plugin treadmill.

Portfolios & docs sites

Add a notes or updates section to a static site. No build step, no framework, no new host.

How it works

The whole system, on one sheet.

No CMS fleet, no vendor cloud. One PHP app writes to SQLite, renders canonical pages and RSS, and serves the JSON the embed reads.

Node 01

Any site

one <script> tag

One <script> tag renders feed, post, or subscribe. Zero dependencies, no build step.

feedpostsubscribe
Node 02

Your PHP host

tinyblog.php + SQLite

tinyblog.php + SQLite: admin, posts, uploads, subscribers, settings. Data never leaves your account.

/admindata/uploads/
Node 03

Reader surface

canonical pages

Canonical post pages, tag & search, RSS and sitemap, plus a CORS-allowlisted JSON API for the widget.

/post/{slug}feed.xmlsitemap.xml
  • Prepared SQL, CSRF tokens, and an origin allowlist on every hop
  • No third-party scripts, fonts, or analytics on your blog
  • Full JSON export for backups and moving hosts

Setup

From cPanel to a live feed in minutes.

Upload one folder, enable PHP 8, and the app creates its own database. Then write and embed.

01 / Deploy

Upload & go

Drop the files on any PHP 8 host with PDO SQLite. The app creates data/tinyblog.db on first run — no migrations to run by hand.

02 / Login

Edit credentials in .env

Set admin email/password from cPanel File Manager, then log in at /admin to write posts, upload media, and manage settings.

03 / Embed

One tag, any page

Paste the script on an allowed site. It fetches only the JSON the widget needs and renders it inline. Admin → Add to site builds the snippet for you.

04 / Audit

Read the whole path

Set admin credentials before public launch, prefer password hashes, remove recovery credentials after use, and force HTTPS.

# clone the repo (backend + widget + docs)
git clone https://github.com/tanzir71/tinyblog

# upload to a PHP 8 host, make data/ and uploads/ writable,
# then open /admin to create the first admin account
chmod 755 data uploads
PHP 8+ · PDO SQLite · no Composer, no build stepApache rewrite and file-protection rules included

The embed

One widget, three modes.

Feed, single post, or subscribe box from one script tag, plus a small “What’s new” badge for headers and navbars. Light, dark, card, or inherit themes with CSS-variable overrides, and everything it renders is sanitized first.

widgetType: "feed"

Feed

Recent posts with optional excerpts and reading time. Paginated responses keep long archives light.

widgetType: "post"

Single post

Render one post by slug: release notes inside your app, or a story on a product page.

widgetType: "subscribe"

Subscribe

A site-scoped signup box with rate limiting, double opt-in confirmation, and one-click unsubscribe.

ConfigendpointsitesiteKeyslugmaxItemsshowExcerpttheme: light | dark | card | inheritaccentlocalecontainer
APIinit()on("loaded")on("error")openPost(slug)

Features

Everything a small blog needs — nothing it doesn't.

Feature-rich where it counts for readers and SEO, deliberately narrow everywhere else.

Publish

Markdown posts

Server-sanitized Markdown with tags, slugs, and auto excerpts. Raw HTML is escaped, never executed.

save_post()
Discover

Canonical SEO pages

Static-style post pages with Open Graph and social meta, plus tag listings and prepared-statement search.

/post/{slug}
Syndicate

RSS + sitemap

Standards-compliant feed.xml and sitemap.xml generated straight from your posts.

/feed.xml
Embed

One widget, four modes

Feed, single post, subscribe box, or a “What’s new” badge from one script tag, themeable with CSS-variable overrides.

widgetType
Capture

Subscribers

Site-scoped subscribe endpoint with rate limiting, double opt-in confirmation, and one-click unsubscribe.

/api/subscribe
Host

Media uploads

Image-only uploads with an execution-denied uploads directory. No object storage required.

uploads/
Protect

Secure by default

PDO prepared statements, CSRF tokens, session timeout, password hashing, and a CORS origin allowlist.

check_cors_or_fail()
Own

No third parties

No analytics scripts, no external fonts on your blog, no phone-home. Your data stays in your hosting account.

0 trackers
Also in the box Drafts & scheduled posts Pinned & related posts FTS5 search with fallback Reading time BlogPosting JSON-LD JSON Feed llms.txt JSON export & import Privacy-friendly view counts ETag / 304 Dark mode Editor & admin roles Month archives Hosting health checks Server-rendered HTML include

Admin

What the admin looks like.

The daily publishing surface is quiet, keyboard-friendly, and built around the jobs you do most often: set up, write, publish, put it on your site.

TinyBlog admin home with a setup checklist, at-a-glance stats, top posts, and drafts and scheduled posts.
Home: setup checklist and what needs you
TinyBlog post editor in split view with Markdown on the left, a server-rendered preview on the right, and a publishing rail with draft, publish, and schedule options.
Editor with server-rendered preview
TinyBlog Add to site screen with allowed websites, a refused request with an Allow button, layout options, platform tabs, and a live widget preview.
Add to site: allow, configure, copy, verify
TinyBlog media library with upload drop zone, required alt text, and image grid.
Media library

Security

Security you can read in one file.

The threats that matter for a small PHP blog each have a specific, inspectable answer — no plugin marketplace to audit.

ThreatHow TinyBlog answers itLook for
SQL injection

PDO prepared statements for every query, including search and its FTS5 fallback.

prepared statements
Cross-site scripting

Output escaping, server-sanitized Markdown, and a second sanitization pass inside the widget.

htmlEscape()
Cross-site request forgery

CSRF tokens on every admin write; a POST without a valid token gets a 403.

require_csrf()
Unsafe uploads

Image-only uploads, and script execution denied inside uploads/.

uploads/.htaccess
Credential attacks

Password hashing, session timeout, and rate-limited logins. No default admin password ships.

rate_limit()
Cross-origin exposure

A per-site CORS origin allowlist, plus an optional public siteKey for API reads.

check_cors_or_fail()

Compare

Why teams pick it over hosted blogs.

For a store, portfolio, docs site, or product-updates feed, a full CMS or a hosted platform is often too much — and lock-in and per-seat pricing punish you later.

vs Substack

Own the feed, skip the lock-in

No platform lock-in, no revenue cut, and the archive lives on your domain instead of someone else's subdomain.

Compare TinyBlog vs Substack
vs Ghost

No Node server to babysit

Runs on the cheapest PHP shared hosting — no Node process, no reverse proxy, no monthly Ghost(Pro) bill.

Compare TinyBlog vs Ghost
vs WordPress

One file vs plugin sprawl

A readable single file instead of a plugin-and-update treadmill and a database you can't fit in your head.

Compare TinyBlog vs WordPress
vs third-party widgets

No trackers on your readers

Unlike third-party embed widgets, TinyBlog serves its own JSON from your host — no cross-site cookies or tracking.

Compare TinyBlog vs third-party widgets

Scope

What it deliberately doesn't do.

Honest scope beats an inflated feature list. When you outgrow these limits, the docs' "How to scale" section points the way.

Not a CMS fleet

No multi-tenant admin, no page builder, no theme marketplace, no plugin API. One app, one blog, one readable file.

Not a heavy stack

No Node runtime, no build step, no Composer dependencies, no background job queue. SQLite until you genuinely outgrow it.

When you outgrow it

Move to Postgres when multiple authors, higher write volume, or large subscriber lists make SQLite locking noticeable, and move media to object storage when uploads outgrow your disk.

FAQ

Questions before you upload.

Short answers here. The docs have the long ones, including deployment, routes, and backups.

Where does TinyBlog run?

Any PHP 8 host with PDO SQLite, including typical cPanel shared hosting. The PHP app does not run on Vercel; Vercel only hosts the marketing site and demo feed.

Can I add it to Shopify, WordPress, or Squarespace?

Anywhere you can paste a script tag: a custom HTML block, a theme section, or a code block. Admin → Add to site generates the snippet with step-by-step instructions per platform. Some site builders only run scripts on certain plans.

Is an embedded blog good for SEO?

The widget is for display. Every post also gets a canonical page on your blog host with Open Graph tags, BlogPosting JSON-LD, RSS, and a sitemap. For pages that must ship posts in the HTML itself, include the server-rendered /embed/feed.html fragment.

Who owns the data?

You do. Posts, settings, media, and subscribers live in SQLite and uploads/ on your host, and Settings exports everything as JSON for backups or moving hosts.

Does it send newsletters?

No. Subscribers get double opt-in confirmation (optionally through PHP mail()) and one-click unsubscribe, and you can export confirmed subscribers as CSV. Sending newsletters is deliberately out of scope.

Is it really free?

Yes. MIT licensed, with no paid tier and no per-seat pricing. You pay only for the hosting you already have.

Quick start

Publish updates worth opening.

Grab the file, add the tag. The library is a single static file: download it into your project, then drop in the embed.

terminal
# clone the repo (backend + widget + docs)
git clone https://github.com/tanzir71/tinyblog

# or grab just the widget for the client side
curl -LO https://blog.example.com/tinyblog-widget.js