Skip to content

PowerAppsDarren/my-payload-app

Repository files navigation

πŸš€ My Payload App

Payload CMS Next.js Docker MongoDB

🎯 A modern, headless CMS built with Payload, Next.js, and Docker. Perfect for content management that doesn't get in your way!

✨ Features

  • 🎨 Modern Admin Interface - Beautiful, intuitive content management
  • πŸ” Authentication Ready - User management out of the box
  • πŸ“ Rich Text Editor - Powered by Lexical for amazing content creation
  • 🐳 Docker Compose - One-command development environment
  • πŸ—„οΈ MongoDB - Flexible, scalable database with admin interface
  • πŸ”’ Secure by Default - Environment variables and proper authentication
  • ⚑ TypeScript - Full type safety throughout
  • 🎯 API First - REST and GraphQL endpoints ready to go

πŸ—οΈ Tech Stack

Technology Purpose Version
🎯 Payload CMS Headless CMS 3.40.0
⚑ Next.js React Framework 15.3.3
🐳 Docker Containerization Latest
πŸƒ MongoDB Database 7.0
πŸ“˜ TypeScript Type Safety 5.6.3
βš›οΈ React UI Library 19.0.0

πŸš€ Quick Start

Prerequisites

  • 🐳 Docker & Docker Compose
  • πŸ“¦ Node.js 18+ (for local development)

🎬 Get Started in 3 Steps

# 1️⃣ Clone and navigate
git clone <your-repo-url>
cd my-payload-app

# 2️⃣ Fire up the engines! πŸš€
npm run docker:up

# 3️⃣ Open your browser and enjoy! πŸŽ‰
# http://localhost:3000

That's it! 🎊 Your CMS is ready to rock!

🌐 Available Services

Service URL Description
🎯 Main App http://localhost:3000 Your beautiful frontend
πŸ‘€ Admin Panel http://localhost:3000/admin Content management magic
πŸ—„οΈ Database Admin http://localhost:8081 MongoDB management
πŸ”Œ API Endpoint http://localhost:3000/api REST & GraphQL APIs

πŸ”§ Development Commands

# πŸš€ Start everything (recommended)
npm run docker:up

# πŸ—οΈ Rebuild and start
npm run docker:up:build

# πŸ›‘ Stop all services
npm run docker:down

# πŸ“‹ View logs
npm run docker:logs

# πŸ”„ Generate types (when config changes)
npm run generate:types

# 🧹 Lint your code
npm run lint

πŸ“ Project Structure

my-payload-app/
β”œβ”€β”€ 🎯 payload.config.ts          # Payload configuration
β”œβ”€β”€ πŸ”§ next.config.mjs            # Next.js setup
β”œβ”€β”€ 🐳 docker-compose.yml         # Docker services
β”œβ”€β”€ πŸ“¦ package.json               # Dependencies & scripts
β”œβ”€β”€ πŸ”’ .env                       # Environment variables
β”œβ”€β”€ πŸ“ payload-types.ts           # Generated types
└── πŸ“‚ src/
    └── πŸ“‚ app/
        β”œβ”€β”€ 🏠 layout.tsx          # Root layout
        β”œβ”€β”€ πŸ“„ page.tsx            # Home page
        β”œβ”€β”€ πŸ”Œ api/                # API routes
        └── πŸ‘€ (payload)/          # Admin interface

🎨 Collections

πŸ‘₯ Users

  • πŸ” Authentication enabled
  • πŸ“§ Email-based login
  • πŸ›‘οΈ Role-based permissions

πŸ“„ Pages

  • πŸ“ Rich text content with Lexical editor
  • 🏷️ Title and content fields
  • 🎯 Perfect for websites and blogs

πŸ”’ Environment Variables

Create your .env file (check .env.example for reference):

# πŸ—„οΈ Database
DATABASE_URI=mongodb://mongodb:27017/payload-app

# πŸ” Security
PAYLOAD_SECRET=your-super-secret-key

# 🌐 App
NEXT_PUBLIC_SERVER_URL=http://localhost:3000

🐳 Docker Services

Service Purpose Port
🎯 app Next.js + Payload 3000
πŸƒ mongodb Database 27017
πŸ–₯️ mongo-express DB Admin UI 8081

πŸ”§ Customization

Adding New Collections

  1. πŸ“ Edit payload.config.ts
  2. πŸ”„ Run npm run generate:types
  3. πŸš€ Restart with npm run docker:up:build

Custom Fields & Components

Check out the Payload documentation for:

  • 🎨 Custom field types
  • 🧩 Custom components
  • 🎣 Hooks and lifecycle events
  • πŸ”Œ Plugin development

🚨 Troubleshooting

πŸ› Common Issues

Admin panel shows config error?

# Try rebuilding
npm run docker:down
npm run docker:up:build

Database connection issues?

# Check if MongoDB is running
docker ps
# Restart services
npm run docker:down && npm run docker:up

Port conflicts?

  • 🎯 App: Change port 3000 in docker-compose.yml
  • πŸƒ MongoDB: Change port 27017
  • πŸ–₯️ Mongo Express: Change port 8081

πŸ”„ Staying Updated

πŸ“¦ Check for Updates

# See available updates
npm outdated

# Check specific Payload packages
npm outdated payload @payloadcms/next @payloadcms/db-mongodb

πŸš€ Update Payload

# Update all Payload packages
npm update payload @payloadcms/next @payloadcms/db-mongodb @payloadcms/richtext-lexical

# Update to latest stable
npm install payload@latest

# After updates, always regenerate types!
npm run generate:types
npm run docker:up:build

πŸ”” Stay Informed

⚠️ Update Best Practices

# 1. Create update branch
git checkout -b update-payload

# 2. Update and test
npm update payload
npm run docker:up:build

# 3. Test admin panel & API endpoints

# 4. If all good, merge
git checkout main && git merge update-payload

πŸ’‘ Pro Tip: Always read release notes for breaking changes before major updates!

🀝 Contributing

  1. 🍴 Fork the repo
  2. 🌟 Create your feature branch
  3. ✨ Make your changes
  4. πŸ§ͺ Test everything works
  5. πŸš€ Submit a pull request

πŸ“š Resources

πŸ“„ License

MIT License - feel free to use this for your awesome projects! πŸŽ‰


Made with ❀️ and lots of β˜•

Happy coding! πŸš€

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published