

In today’s digital age, building dynamic websites has become more accessible than ever. One of the powerful tools for creating such websites is Payload NextJS. In this article, we will explore how to set up a MongoDB Atlas database and S3 file storage using Supabase, providing you with the foundational knowledge to build dynamic web applications effectively.
This article provides a comprehensive written step-by-step tutorial based on our video guide available on YouTube at https://www.youtube.com/watch?v=-0CCUkoBDSY. For visual learners or those who prefer following along with video instruction, the YouTube tutorial covers the same content while offering additional context and real-time demonstrations of each step in the process. Both resources will help you successfully set up your database and file storage for Payload NextJS projects.
Payload NextJS is a robust combination of Payload, a headless CMS, and NextJS, a React-based framework. Together, they offer a seamless way to manage content and build dynamic web applications. This article will guide you through the essential steps to set up your database and file storage, which are crucial for running Payload successfully.
Before diving into the setup, it's essential to understand the necessity of having a database and file storage:
For this project, we will use MongoDB, specifically MongoDB Atlas, which offers a free tier with 512 MB of storage. This choice is ideal for beginners and small projects. However, it's worth noting that there are other options available:
Let’s walk through the steps to set up your MongoDB Atlas database:

File storage is another crucial aspect of your application. While you can use local storage during development, it's not reliable for production. Here are some options for file storage:
To set up Supabase for your file storage, follow these steps:
Once your database and file storage are set up, it’s time to configure your Payload project. Here’s how:
npx create-payload-app@beta to initialize your project.pnpm install @payloadcms/storage-s3 to integrate S3 storage with your project.
To link your Payload application to the Supabase S3 bucket, you will need to configure environment variables:
After configuring your Payload application, it’s time to test the setup:
npm run dev to start your server.As with any setup, you may encounter issues. Here are some common problems and solutions:
In this guide, we walked through the essential steps to set up a MongoDB Atlas database and Supabase S3 file storage for your Payload NextJS application. With the right configuration in place, you can build dynamic websites that are both powerful and efficient. Don't hesitate to explore further and expand your knowledge of Payload NextJS!
Payload NextJS is a combination of Payload, a headless CMS, and NextJS, a React-based framework, allowing developers to create dynamic web applications efficiently.
MongoDB Atlas offers a user-friendly interface, a robust free tier, and additional features like backups and full-text search capabilities, making it an excellent choice for developers.
Yes, while this guide focuses on MongoDB, you can also use other databases like Postgres.
Supabase provides a straightforward setup, a free tier, and easy integration with your Payload application, making it an attractive choice for file storage.
Common issues include bucket not found errors and permission errors. Check your configurations and permissions in both MongoDB Atlas and Supabase.
For further insights and updates, feel free to sign up for our newsletter at AllAboutPayload and explore our video series on dynamic websites with Payload V3 + NextJS on our YouTube channel.