This guide will walk you through setting up the Grace Visual Designer portfolio and e-commerce website. This application is built with Next.js, Payload CMS, MongoDB, and Stripe. Follow these steps to get your website up and running.
Before you begin, ensure you have the following installed:
You'll also need accounts for the following services:
- Stripe for payment processing
- An SMTP provider (like SendGrid, Mailgun, or Resend) for emails
- (Optional) Vercel for deployment or send me a message and I will help you host it.
git clone <repository-url>
cd graceInstall the required dependencies using npm or yarn:
npm installCreate a .env.local file in the root directory and add the following variables:
# Database
DATABASE_URI=mongodb://localhost:27017/grace-portfolio
# or your MongoDB Atlas connection string
# mongodb+srv://<username>:<password>@<cluster>.mongodb.net/grace-portfolio
# Payload CMS
PAYLOAD_SECRET=your-long-random-secret-key
PAYLOAD_PUBLIC_SERVER_URL=http://localhost:3000
# Next.js
NEXT_PUBLIC_SERVER_URL=http://localhost:3000
# Stripe
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=whsec_your_stripe_webhook_secret
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_your_stripe_publishable_key
# Email (SMTP)
SMTP_HOST=your-smtp-host
SMTP_USER=your-smtp-username
SMTP_PASS=your-smtp-password
# Resend (for receipt emails)
RESEND_API_KEY=re_your_resend_api_key
# Optional: Newsletter service
LISTMONK_API_URL=your-listmonk-api-url
LISTMONK_API_USERNAME=your-listmonk-username
LISTMONK_API_PASSWORD=your-listmonk-password
LISTMONK_LIST_IDS=1,2,3
- Ensure MongoDB is running on your machine.
- The application will automatically create the database when it first connects.
- Create a new project and cluster in MongoDB Atlas.
- Set up a database user with read/write permissions.
- Add your IP address to the IP access list.
- Copy your connection string and add it to the
.envfile.
- Create a Stripe account if you don't have one.
- Get your API keys from the Stripe Dashboard.
- Set up webhook endpoints:
- Go to Developers > Webhooks in your Stripe Dashboard.
- Add an endpoint with the URL:
https://your-domain.com/api/webhooks/stripe(usehttp://localhost:3000/api/webhooks/stripefor local development with Stripe CLI). - Select the following events:
checkout.session.completed
- Copy the webhook signing secret and add it to your
.envfile.
- Set up an account with an SMTP provider.
- Get your SMTP credentials and add them to your
.env.localfile. - If using Resend for receipt emails, get your API key and add it to your
.env.localfile.
Start the development server using:
npm run dev
# or
yarn devThe application should now be running at http://localhost:3000.
- Visit http://localhost:3000/admin.
- Follow the prompts to create your first admin user.
- Use this account to access the Payload CMS admin panel.
Using the Payload CMS admin panel:
- Create categories for blog posts and products.
- Upload media files.
- Create blog posts.
- Create products with pricing information.
- Upload product files for digital downloads.
- You can deploy this to any hosting service of your choice.
- Update the
NEXT_PUBLIC_SERVER_URLandPAYLOAD_PUBLIC_SERVER_URLto your production URL. - Update the Stripe webhook endpoint to your production URL.
- Ensure your MongoDB instance is accessible from your deployment environment.
If you encounter issues not covered in this guide:
- Check the error logs in your console.
- Review the documentation for Next.js, Payload CMS, and Stripe.
- Reach out to me and I will be here to help
After setting up the application, consider:
- Customizing the design to match your brand.
- Adding more products and blog posts.
- Setting up analytics to track user behavior.
- Implementing additional features like product reviews or a contact form.
Built by geekbits.dev and the power of open-source Enjoy using your new portfolio and e-commerce website! 🚀
Note: Make sure to add the required environment variables to your project for seamless functionality. built by geekbits and the power of open-source