The Perfect Payload Website Stack: My Go-To Hosting Setup

After working with various hosting setups for Payload sites, here's the stack I've found works well for Next.js + Payload applications, from frontend to database to media storage.

7 min read
1344 words
Featured image for "The Perfect Payload Website Stack: My Go-To Hosting Setup" - After working with various hosting setups for Payload sites, here's the stack I've found works well for Next.js + Payload applications, from frontend to database to media storage.

The Perfect Payload Website Stack: My Go-To Hosting Setup 🚀

After transitioning from WordPress to Next.js + Payload and testing out various database and app hosting providers while shipping multiple sites, I've found a hosting stack that works really well for my client's site.

Let me break down my preferred setup and why each piece fits perfectly together.

Frontend: Vercel Rules Supreme

For hosting Next.js applications, Vercel has consistently been the best option in my experience.

Here's why Vercel is unbeatable for Payload sites:

Zero-Config Deployment: Push to GitHub, and your site is live. No Docker containers to configure, no server management, no deployment scripts. It just works.

Edge Network Performance: Your site loads instantly worldwide thanks to Vercel's global CDN. For client projects, this translates to better user experience and SEO rankings.

Built-in Optimizations: Automatic image optimization, smart caching, and bundle analysis out of the box. These features alone save hours of manual optimization work.

Serverless Functions: Payload's API routes work seamlessly with Vercel's serverless architecture. No cold starts, automatic scaling, and you only pay for what you use.

Preview Deployments: Every pull request gets its own URL. This is invaluable when working with clients – they can see changes immediately without affecting the live site.

The developer experience is unmatched. From local development to production deployment, everything just flows naturally.

What About Vercel Alternatives?

There are some excellent self-hosted alternatives like Coolify and Sevalla that give you more control and can be incredibly cost-effective. These are fantastic options and I definitely encourage developers to try them out – especially if you enjoy server management or need specific configurations.

However, for small teams and freelancers, Vercel's value proposition is hard to beat. When you're juggling client work, deadlines, and business development, the last thing you want to worry about is server maintenance, security patches, or deployment pipelines breaking at 2 AM. Vercel lets you focus on building great websites instead of becoming a DevOps expert.

Database Strategy: Choose Your Fighter

Every site needs a database, but not every database is right for every project. Here's how I choose:

🐘 PostgreSQL + Supabase: The Heavyweight Champion

When to use: Large, complex applications with important data. Think healthcare systems, financial platforms, or any application where data integrity is critical.

Why PostgreSQL: ACID compliance, advanced querying capabilities, robust indexing, and proven reliability at scale. When you need guarantees about your data, PostgreSQL delivers.

Why Supabase: Managed PostgreSQL with a fantastic developer experience. Real-time subscriptions, built-in authentication, row-level security, and an intuitive dashboard. Plus, it's built on open-source technologies, so no vendor lock-in fears.

If I were building a healthcare project, PostgreSQL's foreign key constraints and transaction support would be essential for maintaining data consistency across patient records.

🪶 SQLite + Turso: The Elegant Solution

When to use: Small to medium applications that prioritize simplicity and security. Perfect for personal projects, small business sites, or applications with predictable traffic patterns.

Why SQLite: Zero configuration, no server management, incredible performance for read-heavy workloads, and your entire database is a single file. It's beautifully simple.

Why Turso: They've solved SQLite's scaling limitations with edge replication. Your database lives close to your users, queries are lightning-fast, and you get the simplicity of SQLite with global performance.

🍃 MongoDB + Railway: The Versatile Workhorse

When to use: Most typical websites. E-commerce sites, content platforms, SaaS applications – basically anything that doesn't require complex relational queries.

Why MongoDB: Incredible speed for typical web app queries, schema flexibility that adapts as your project evolves, and seamless integration with JavaScript applications. The JSON-like documents feel natural when working with Next.js and Payload.

Why Railway: Simple deployment, excellent Docker support, and most importantly for MongoDB – easy access for custom backup scripts. I can write Node.js scripts that connect directly to the database for automated backups and maintenance tasks, storing them securely in Cloudflare R2 buckets.

Scaling Consideration: If your project grows to need enterprise-level scaling, MongoDB Atlas is an excellent option. Atlas provides automated scaling, global clusters, and enterprise-grade security. The beauty of starting with Railway is that migrating to Atlas is straightforward – both use standard MongoDB, so you can export your data from Railway and import it to Atlas without any schema changes or application code modifications.

// Custom backup script example for Railway MongoDB
import { MongoClient } from 'mongodb';
import { spawn } from 'child_process';

const backupDatabase = async () => {
  const timestamp = new Date().toISOString().split('T')[0];
  const backupName = `backup-${timestamp}`;
  
  const mongodump = spawn('mongodump', [
    '--uri', process.env.MONGODB_URI,
    '--out', `./backups/${backupName}`
  ]);
  
  mongodump.on('close', (code) => {
    console.log(`Backup completed with code ${code}`);
    // Upload to cloud storage, send notification, etc.
  });
};

The flexibility of custom backup scripts has saved projects multiple times. When you need that level of control, Railway delivers.

Media Storage: Cloudflare R2 is the Game Changer

After trying various media storage solutions, I've landed on Cloudflare R2, and here's why it's perfect for Payload sites:

Quick note on alternatives: Supabase Storage and Upload Thing are both excellent options with great developer experiences. They're particularly appealing if you're already using Supabase for your database or want an all-in-one solution. However, R2 just makes more sense for most projects due to the pricing and global performance benefits.

S3 Compatibility: Payload's S3 adapter works seamlessly with R2. No custom integration needed – just swap the endpoint and credentials.

No Egress Fees: Unlike AWS S3, R2 doesn't charge for bandwidth. For media-heavy sites, this saves significant money as your traffic grows.

Global Performance: Cloudflare's network means your images, videos, and files load quickly worldwide.

Developer-Friendly Pricing: Predictable costs without surprise bandwidth charges. Perfect for client projects where you need to estimate ongoing hosting costs.

Integration with Cloudflare Workers: If you need custom image processing or transformations, Workers integrate seamlessly with R2.

Setting up R2 with Payload is refreshingly simple:

// payload.config.ts
import { S3Adapter } from '@payloadcms/plugin-s3';

export default buildConfig({
  plugins: [
    S3Adapter({
      config: {
        endpoint: process.env.CLOUDFLARE_R2_ENDPOINT,
        credentials: {
          accessKeyId: process.env.CLOUDFLARE_R2_ACCESS_KEY_ID,
          secretAccessKey: process.env.CLOUDFLARE_R2_SECRET_ACCESS_KEY,
        },
        region: 'auto',
      },
      bucket: process.env.CLOUDFLARE_R2_BUCKET,
    }),
  ],
  // ... rest of config
});

That's it. Your media uploads now live on Cloudflare's global network with S3-compatible APIs.

The Perfect Storm: How It All Connects

Here's why this stack works so well together:

Consistent Developer Experience: Modern tools that work well with TypeScript, have great documentation, and don't fight against each other.

Scalability: Each component scales independently. Start small with SQLite and Turso, grow to MongoDB and Railway, or jump straight to PostgreSQL and Supabase for enterprise needs.

Cost Predictability: No surprise bills. Vercel's pricing is clear, database hosting is affordable, and R2 eliminates bandwidth concerns.

Global Performance: Every component has edge/global distribution. Your users get fast experiences regardless of location.

Reliability: Each service has proven uptime and support. When clients depend on your applications, reliability isn't negotiable.

My Recommendation Matrix

  • Small Blogs/Portfolio Sites: Vercel + SQLite/Turso + Cloudflare R2
  • Small Business/Content Sites: Vercel + MongoDB/Railway + Cloudflare R2
  • Enterprise/Healthcare Apps: Vercel + PostgreSQL/Supabase + Cloudflare R2

Every combination gives you a production-ready, scalable foundation that grows with your project's needs.

The Bottom Line

After years of WordPress hosting headaches and trying numerous deployment strategies, this stack represents the sweet spot of simplicity, performance, and reliability. It's what I reach for on every new Payload project, and it's what I recommend to clients who want something that just works.

The best part? Each database option serves different needs perfectly. Take a step back and think about what your application needs in the long run – will you have complex relationships that benefit from SQL? Do you need the simplicity and speed of document storage? Are you building something that requires ACID compliance?

I encourage you to try all these database options in small projects to get a feel for their strengths. Each one shines in different scenarios, and understanding when to use which will make you a more well-rounded developer.


Have you found a different hosting combination that works well for Payload sites? I'd love to hear about your experiences and any optimizations you've discovered along the way.

Show Your Support

Like this post? Let me know!