Skip to content
VercelLogotypeVercelLogotype
LoginSign Up

ServerlessWP

Host your WordPress site on serverless — more affordable and more performant when optimized with edge caching.

DeployView Demo
No thumbnail was provided for the template. This is a screenshot of the landing page, serverlesswp.com.

WordPress hosting is silly.

Low maintenance and low cost/free WordPress hosting on Vercel, Netlify, or AWS Lambda.

ServerlessWP puts WordPress in serverless functions and the database in a file. Deploy this repository to give it a try.

Stay up-to-date at the ServerlessWP repository: github.com/mitchmac/serverlesswp

Is it a good fit?

This is currently an experimental project. It's built for content sites rather than applications:

✅ Great fit: personal blogs, documentation, portfolios, marketing and small business sites, dev and staging sites — anything mostly read, edited by one or two people.

✅ Also great: headless/decoupled WordPress. Run WordPress here purely as the editing backend and content API (REST or GraphQL) for a separate frontend.

⚠️ Use MySQL, not SQLite when: sites with several people publishing at once, take a lot of form submissions, ecommerce, membership sites, forums. SQLite+S3 and SQLite+Blob have limited write concurrency.

Quick Deploy

The easiest way to run WordPress with ServerlessWP is entirely on Vercel. This button creates a private Vercel Blob store during setup, and WordPress runs on a SQLite database kept in it. No database to host, no credentials to copy, no other accounts to sign up for — and each git branch gets its own database.

More on how SQLite + Vercel Blob works and when to use MySQL instead.

Other ways to deploy:

  • Just kicking the tires? Deploy on Vercel with a temporary SQLite database on S3 that expires after a few days.
  • Netlify with your own database (SQLite+S3 or MySQL). Trade-offs vs. Vercel: 10 second max request duration instead of 60, manual branch config, and analytics/firewall are paid add-ons.
  • AWS Lambda with the Serverless Framework: npm install && serverless deploy

Project goals

🌴 WordPress hosting made easy. Lower maintenance with serverless functions instead of servers.

💲 Small WordPress sites shouldn't cost much to host. Vercel, Netlify, & AWS have free tiers.

🔓 WordPress plugins and themes are extensively supported. No arbitrary limitations here.

⚡ Blazing fast websites that take advantage of caching and content delivery networks.

🌎 Lower the carbon footprint of WordPress websites.

🤝 A helpful community. Share your successes, ideas, or struggles in the discussions.

Deploy ServerlessWP

1. Deploy this repository to Vercel, Netlify, or AWS.

One of the links above will get you started. You'll just need a GitHub account.

2. Setup a database.

These docs lead with SQLite on object storage — Vercel Blob or S3 — because it's the quickest to get running and the least to maintain: nothing to provision, nothing running 24/7, and on Vercel no credentials to copy at all. MySQL is equally supported and stays the better choice for the sites called out above — see MySQL.

If you used the Vercel button above, you're already done: the Blob store it created is your database. Skip to step 3.

Otherwise, pick your database below — SQLite + object storage or MySQL — then come back for uploads.

Whichever you choose, you set it up with environment variables. See here for Vercel and here for Netlify for how to manage them. Remember to redeploy your project if you change environment variables after the initial deploy.

3. File and media uploads with S3 (optional, can be done later)

File and media uploads can be enabled using the included WP Offload Media Lite for Amazon S3 plugin. S3 setup details can be found here. The wp-config.php file is setup to use the following environment variables for use by the plugin:

  • S3_KEY_ID
  • S3_ACCESS_KEY

SQLite + object storage

WordPress usually runs with a MySQL (or MariaDB) database. That means hosting a database that runs 24/7.

A SQLite database option has been developed by members of the WordPress community. With the recent ability to conditionally write to object storage - Vercel Blob, or S3 and S3-compatible buckets - a decentralized and serverless data layer for ServerlessWP is possible.

Check out the diagram of the SQLite+S3 logic if you're interested in how it works.

ServerlessWP supports both SQLite and MySQL as database options. Some of the trade-offs:

SQLite + object storageMySQL
🕑 on demand24/7 hosting
💲 usage based (free tiers)monthly fees (some limited free tiers)
🧩 some plugin incompatibilityfull plugin compatibility
♾️ limited database update concurrencyfew concurrency limitations
✔️ blogs, dev sites, documentation, single editor sitesany site

The main trade-off of using SQLite with ServerlessWP is:

  • if requests are handled by multiple underlying serverless functions at the same time and make a change to the database, the competing requests may fail. Sites with multiple editors working at the same time or receiving many form submissions aren't a great fit for SQLite.

SQLite + Vercel Blob

The easiest option. On Vercel, the deploy button above creates a private Vercel Blob store for you during setup - no bucket or IAM credentials to create. The git branch is added to the name, so preview deployments each get their own database.

SQLite+Vercel Blob
SQLITE_BLOB_READ_WRITE_TOKENtoken for the store holding the database
SQLITE_BLOB_PATHNAMEoptional: base name for the database - defaults to wp-sqlite

SQLITE_BLOB_READ_WRITE_TOKEN is what Vercel injects for a store created with an env var prefix of SQLITE, which is what the deploy button asks for. To set one up on an existing project, create the store from the Storage tab with private access, then copy its BLOB_READ_WRITE_TOKEN into a SQLITE_BLOB_READ_WRITE_TOKEN environment variable.

The database store is deliberately separate from any store you use for media uploads: the database has to stay private and uncached, while uploads want public reads and CDN caching. That's why the unprefixed BLOB_READ_WRITE_TOKEN isn't used here - a store connected for uploads would otherwise be picked up as the database and fail on the first write.

SQLite + S3

Works anywhere - Netlify, AWS, or Vercel - with any S3-compatible bucket, including Cloudflare R2. Setup a private bucket and use these environment variables:

SQLite+S3
SQLITE_S3_BUCKETbucket name you created
SQLITE_S3_API_KEYAPI key to access the bucket
SQLITE_S3_API_SECRETAPI secret key to access the bucket
SQLITE_S3_REGIONregion where the bucket lives - create it near your serverless functions
SQLITE_S3_ENDPOINToptional: to update where the bucket is, like a Cloudflare R2 address

MySQL database option

The right call when you need full plugin compatibility or more than a couple of people writing at once. TiDB provides a cloud MySQL database with a generous free tier.

After creating your database, set these environment variables with the credentials. wp-config.php is automatically configured to use them to connect.

DATABASEdatabase name you created
USERNAMEdatabase user to access the database
PASSWORDdatabase user's password
HOSTaddress to access the database
TABLE_PREFIXoptional: to use a prefix on the database tables

Which database gets used

The most explicitly configured option wins, so adding a Blob store for media won't take over an existing database:

  1. MySQL - DATABASE, USERNAME, PASSWORD, and HOST all set
  2. SQLite + S3 - SQLITE_S3_BUCKET set
  3. SQLite + Vercel Blob - SQLITE_BLOB_READ_WRITE_TOKEN set on Vercel
  4. otherwise the setup page is shown

Customizing WordPress

  • WordPress and its files are in the /wp directory. You can add plugins or themes there in their respective directories in wp-content then commit the files to your repository so it will re-deploy.
  • Plugins like Cache-Control can enable CDN caching with the s-maxage directive and make your site super fast. Refer to Vercel Edge Caching or Netlfiy Cache Headers

Customizing ServerlessWP

  • netlify.toml or vercel.json are where we configure /api/index.js to handle all requests
  • mitchmac/serverlesswp-node is used to run PHP and handle the request
  • You can modify the incoming request through the event object in api/index.js. You can also modify the WordPress response object there. ServerlessWP has a basic plugin system to do this. Checkout out /api/index.js for hints.

Getting help

Need help getting ServerlessWP installed? Start a discussion or send me a chat.

Contributing

  • Using ServerlessWP and reporting any problems you experience is a great way to help.
  • Spread the word!

License

GNU General Public License v3.0

GitHub
Ownermitchmac
Repositoryserverlesswp
LicenseView License
Use Cases
CMS
Blog
Stack
Other
None
Database
PlanetScale
CMS
WordPress

Related Templates

ISR Blog with Next.js and WordPress

An Incremental Static Regeneration Blog Example Using Next.js and WordPress
ISR Blog with Next.js and WordPress thumbnail

Next.js Starter for WordPress Headless CMS

next-wp is a Next.js application for Headless WordPress. Includes functions for fetching posts, categories, tags, pages, and featured media.
Next.js Starter for WordPress Headless CMS thumbnail

Agent Stack

  • AI SDK
  • AI Gateway
  • Sandbox
  • Workflows
  • ConnectNew
  • PassportNew
  • eveNew

Core Platform

  • CI/CD
  • Content Delivery
  • Fluid Compute
  • Observability

Security

  • Platform Security
  • WAF
  • Bot Management
  • Bot ID

Tools

  • Vercel DropNew
  • Vercel Agent
  • Vercel PluginNew
  • Agent Skills
  • Next.js
  • Domains
  • v0

Frameworks

  • eveNew
  • Nuxt
  • SvelteKit
  • Nitro
  • Turborepo
  • Tanstack Start
  • FastAPI
  • xmcp
  • All frameworks

SDKs

  • Vercel SDK
  • Workflow SDKNew
  • Flags SDK
  • Chat SDKNew
  • Queues SDKNew
  • Streamdown

Build

  • AI Apps
  • Web Apps
  • Marketing Sites
  • Platforms
  • Commerce
  • Platform Engineers
  • Design Engineers

Learn

  • Docs
  • Blog
  • Changelog
  • Knowledge Base
  • Academy
  • Articles
  • Community

Explore

  • Customers
  • Marketplace
  • Templates
  • Partner Finder
  • Vercel + AWS

Company

  • About
  • Careers
  • Press
  • Events
  • Startups
  • Shipped on Vercel
  • Open Source Program
  • Enterprise
  • Pricing
  • Help

Legal & Trust

  • Privacy Policy
  • Terms of Service
  • Cookie Policy
  • DPA
  • Acceptable Use Policy
  • Legal (all documents)
  • Trust Center
  • Status

Social

  • GitHub
  • X
  • LinkedIn
  • YouTube
  • Instagram
  • VercelVercel
Agent Stack
  • AI SDK
  • AI Gateway
  • Sandbox
  • Passport
  • Connect
  • eve
Core Platform
  • Security
  • Content Delivery
  • Fluid Compute
  • Observability
  • Workflows
  • CI/CD
Tools
  • Next.js
  • Vercel Agent
  • Vercel Plugin
  • Domains↗
  • v0↗
Learn
  • Docs
  • About
  • Blog
  • Changelog
  • Knowledge Base
Build
  • AI Apps
  • Web Apps
  • Marketing Sites
  • Platforms
  • Commerce
Explore
  • Customers
  • Marketplace
  • Partner Finder
  • AWS
  • Community↗
EnterprisePricing
Contact
Log InSign Up
Dashboard

Products

Agent Stack

  • AI SDK
  • AI Gateway
  • Sandbox
  • Passport
  • Connect
  • eve

Core Platform

  • Security
  • Content Delivery
  • Fluid Compute
  • Observability
  • Workflows
  • CI/CD

Tools

  • Next.js
  • Vercel Agent
  • Vercel Plugin
  • Domains↗
  • v0↗
Resources

Learn

  • Docs
  • About
  • Blog
  • Changelog
  • Knowledge Base

Build

  • AI Apps
  • Web Apps
  • Marketing Sites
  • Platforms
  • Commerce

Explore

  • Customers
  • Marketplace
  • Partner Finder
  • AWS
  • Community↗
Enterprise
Pricing
Sign UpLog In
Contact
DeployView Demo

Loading status…

Select a display theme: