VercelLogotypeVercelLogotype
LoginSign Up
Back to Templates

ServerlessWP

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

DeployView Demo
ServerlessWP thumbnail

WordPress hosting is silly.

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

ServerlessWP puts PHP & WordPress in serverless functions. Deploy this repository to give it a try.

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

Quick Deploy

(Beta) Try ServerlessWP nearly instantly on Vercel with a temporary SQLite database (database expires after a few days)

Or click one of the options below to deploy your serverless WordPress site with your database of choice:

VercelNetlify
πŸ•‘ 60 second max request duration10 second max request duration
Β βŽ‡Β  automatic branch deploy configmanual branch config
πŸ“ˆ Web analyticspaid add-on
πŸ›‘οΈ Firewallpaid add-on

Want to use AWS Lambda with the Serverless Framework instead? 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

This is currently an experimental project.

It's a good fit for development, personal blogs, documentation sites, and small business sites. It shouldn't be used when considerable security or stability is required, yet.

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.

You'll need to create a database for your site's content.

TiDB provides a cloud database with a generous free tier.

Wouldn't it be great to skip hosting a database? Skip below if you want to try something different with SQLite & S3.

3. Update the environment variables.

After creating your database you'll need to update environment variables for your project with the credentials. The WordPress config file wp-config.php is automatically configured to use these values to connect to the database.

Update the environment variables in Vercel/Netlify:

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

See here for Vercel and here for Netlify for more about managing environment variables. Remember to redeploy your project after updating the environment variables if you update them after initially deploying your project.

4. 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 + S3 database option

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 S3-compatible object storage 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+S3 and MySQL as database options. Some of the trade-offs:

SQLite+S3MySQL
πŸ•‘ 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+S3 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+S3.

Want to give it a try? Setup a private S3 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

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 Repomitchmac/serverlesswp
Use Cases
CMSBlog
Stack
Other
Database
PlanetScale
CMS
WordPress

Related Templates

Get Started

  • Templates
  • Supported frameworks
  • Marketplace
  • Domains

Build

  • Next.js on Vercel
  • Turborepo
  • v0

Scale

  • Content delivery network
  • Fluid compute
  • CI/CD
  • Observability
  • AI GatewayNew
  • Vercel AgentNew

Secure

  • Platform security
  • Web Application Firewall
  • Bot management
  • BotID
  • SandboxNew

Resources

  • Pricing
  • Customers
  • Enterprise
  • Articles
  • Startups
  • Solution partners

Learn

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

Frameworks

  • Next.js
  • Nuxt
  • Svelte
  • Nitro
  • Turbo

SDKs

  • AI SDK
  • Workflow SDKNew
  • Flags SDK
  • Chat SDK
  • Streamdown AINew

Use Cases

  • Composable commerce
  • Multi-tenant platforms
  • Web apps
  • Marketing sites
  • Platform engineers
  • Design engineers

Company

  • About
  • Careers
  • Help
  • Press
  • Legal
  • Privacy Policy

Community

  • Open source program
  • Events
  • Shipped on Vercel
  • GitHub
  • LinkedIn
  • X
  • YouTube

Loading status…

Select a display theme:
    • AI Cloud
      • v0

        Build applications with AI

      • AI SDK

        The AI Toolkit for TypeScript

      • AI Gateway

        One endpoint, all your models

      • Vercel Agent

        An agent that knows your stack

      • Sandbox

        AI workflows in live environments

    • Core Platform
      • CI/CD

        Helping teams ship 6Γ— faster

      • Content Delivery

        Fast, scalable, and reliable

      • Fluid Compute

        Servers, in serverless form

      • Observability

        Trace every step

    • Security
      • Bot Management

        Scalable bot protection

      • BotID

        Invisible CAPTCHA

      • Platform Security

        DDoS Protection, Firewall

      • Web Application Firewall

        Granular, custom protection

    • Company
      • Customers

        Trusted by the best teams

      • Blog

        The latest posts and changes

      • Changelog

        See what shipped

      • Press

        Read the latest news

      • Events

        Join us at an event

    • Learn
      • Docs

        Vercel documentation

      • Academy

        Linear courses to level up

      • Knowledge Base

        Find help quickly

      • Community

        Join the conversation

    • Open Source
      • Next.js

        The native Next.js platform

      • Nuxt

        The progressive web framework

      • Svelte

        The web’s efficient UI framework

      • Turborepo

        Speed with Enterprise scale

    • Use Cases
      • AI Apps

        Deploy at the speed of AI

      • Composable Commerce

        Power storefronts that convert

      • Marketing Sites

        Launch campaigns fast

      • Multi-tenant Platforms

        Scale apps with one codebase

      • Web Apps

        Ship features, not infrastructure

    • Tools
      • Marketplace

        Extend and automate workflows

      • Templates

        Jumpstart app development

      • Partner Finder

        Get help from solution partners

    • Users
      • Platform Engineers

        Automate away repetition

      • Design Engineers

        Deploy for every idea

  • Enterprise
  • Pricing
Log InContact
Sign Up
Sign Up
Back to Templates
DeployView Demo

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

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
v0

Build applications with AI

AI SDK

The AI Toolkit for TypeScript

AI Gateway

One endpoint, all your models

Vercel Agent

An agent that knows your stack

Sandbox

AI workflows in live environments

CI/CD

Helping teams ship 6Γ— faster

Content Delivery

Fast, scalable, and reliable

Fluid Compute

Servers, in serverless form

Observability

Trace every step

Bot Management

Scalable bot protection

BotID

Invisible CAPTCHA

Platform Security

DDoS Protection, Firewall

Web Application Firewall

Granular, custom protection

Customers

Trusted by the best teams

Blog

The latest posts and changes

Changelog

See what shipped

Press

Read the latest news

Events

Join us at an event

Docs

Vercel documentation

Academy

Linear courses to level up

Knowledge Base

Find help quickly

Community

Join the conversation

Next.js

The native Next.js platform

Nuxt

The progressive web framework

Svelte

The web’s efficient UI framework

Turborepo

Speed with Enterprise scale

AI Apps

Deploy at the speed of AI

Composable Commerce

Power storefronts that convert

Marketing Sites

Launch campaigns fast

Multi-tenant Platforms

Scale apps with one codebase

Web Apps

Ship features, not infrastructure

Marketplace

Extend and automate workflows

Templates

Jumpstart app development

Partner Finder

Get help from solution partners

Platform Engineers

Automate away repetition

Design Engineers

Deploy for every idea