https://github.com/coding-to-music/shadcn-nextjs14-payload3-resend-email-aws-s3-mongodb
From / By https://github.com/Livog/Payload.3.0.Starter
https://payload-saas.livog.com/
git init
git add .
git remote remove origin
git commit -m "first commit"
git branch -M main
git remote add origin [email protected]:coding-to-music/shadcn-nextjs14-payload3-resend-email-aws-s3-mongodb.git
git push -u origin main
# General
NEXT_PUBLIC_SITE_URL=http://localhost:3000
MONGODB_URI=
AUTH_SECRET=
AUTH_TRUST_HOST=true
AUTH_VERPOSE=false
AUTH_URL=http://localhost:3000
AUTH_GITHUB_ID=
AUTH_GITHUB_SECRET=
# Resend (Email)
RESEND_DEFAULT_EMAIL=
AUTH_RESEND_KEY=
# Cloudflare (If is used)
CLOUDFLARE_API_TOKEN=
CLOUDFLARE_ZONE_ID=
## S3
S3_ACCESS_KEY_ID=
S3_SECRET_ACCESS_KEY=
S3_REGION=
S3_ENDPOINT=
S3_BUCKET=
NEXT_PUBLIC_S3_HOSTNAME=
NEXT_PUBLIC_UPLOAD_PREFIX= # This is optional, should be a-z without /
# Stripe
NEXT_PUBLIC_STRIPE_IS_TEST_KEY=
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=
STRIPE_SECRET_KEY=
STRIPE_WEBHOOKS_SIGNING_SECRET=
This boilerplate uses:
Hello!
This repository is my experimental playground for integrating Payload 3.0 with Next.js, aimed at crafting a boilerplate useful for launching SaaS projects. My primary focus is on owning the data we collect and maintaining control over the code we develop. Although I'm passionate about RSC and capable of creating low JS RSC components, I prioritized the project structure and functionality, which led me to choose shadcn/ui.
Please note, this setup includes several components in their nascent stages:
This is not yet a production-ready environment, but with Payload 3.0 introducing significant updates, I'm eager to leverage these as soon as the packages stabilize.
I've tried to demonstrate solutions for common challenges observed in the community:
mdx-components.tsx
works in MDX, which maintains control on the HTML and styling.page.tsx
. This also makes more sense for the Lexical Component.This project is still a work in progress, so your patience and feedback are appreciated. I'm just an enthusiast of what Payload solves and truly believe in the CMS as a formidable challenger to Wordpress.
I'm always open to providing support, so feel free to reach out to me on Discord if you have questions or need assistance.
Ensure you have pnpm
installed. If not, install it using:
npm install -g pnpm
Install Dependencies:
pnpm install
Environment Variables:
.env.example
and rename it to .env
:cp .env.example .env
Fill in the .env
file:
NEXT_PUBLIC_SITE_URL=http://localhost:3000
MONGODB_URI=<your_mongodb_uri>
openssl rand -base64 32
AUTH_SECRET=<your_generated_secret>
AUTH_TRUST_HOST=true
AUTH_VERPOSE=false
AUTH_URL=http://localhost:3000
AUTH_GITHUB_ID=<your_github_client_id>
AUTH_GITHUB_SECRET=<your_github_client_secret>
CLOUDFLARE_API_TOKEN=
CLOUDFLARE_ZONE_ID=
RESEND_DEFAULT_EMAIL=<your_default_email>
AUTH_RESEND_KEY=<your_resend_api_key>
Sign up for Cloudflare R2 and get your credentials here.
Go to [Cloudflare R2 Overview]. The url is usually like: https://dash.cloudflare.com/{accountIdHere}/r2/overview
Click on "Create Bucket" and save all credentials.
After creating the bucket, return to the overview screen and click "Manage R2 API Tokens".
If you don't have an API key, click "Create API Key". You should now have an ACCESS_KEY_ID
and a SECRET_ACCESS_KEY
.
The region is usually auto
for R2.
Your S3_ENDPOINT
is typically structured like this in Cloudflare:
https://{accountId}.r2.cloudflarestorage.com/{bucketNameInLowerCaseAndKebabCase}
The NEXT_PUBLIC_S3_HOSTNAME
should be the public hostname (e.g. my-bucket.example.com) for your bucket to enable caching and reduce B operations.
Fill in:
S3_ACCESS_KEY_ID=<your_access_key_id>
S3_SECRET_ACCESS_KEY=<your_secret_access_key>
S3_REGION=auto
S3_ENDPOINT=https://{accountId}.r2.cloudflarestorage.com
S3_BUCKET=<your_s3_bucket>
NEXT_PUBLIC_S3_HOSTNAME=<your_s3_hostname>
If any of the sections above are not set, you need to comment out the respective code using these services.
Any localhost:3000
domains in your local .env
file should be replaced with production URLs in your Railway Variables section.