Skip to content

Lambdo-Labs/payloadcms-astro-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Payload CMS & Astro Template

This is a template for Payload CMS and Astro It is a simple blog template with a few pages and a blog post collection. It is fully typed with TypeScript.

Getting Started

  1. Clone this repository
  2. Run npm install
  3. set MONGODB_URI in backend/.env with a MongoDB connection string (run locally or use a service like MongoDB Atlas)
  4. Run cd backend && npm run dev to start the development server for payload
  5. In another terminal run cd frontend && npm run dev to start the development server for astro

Modify the Template

After changing any of the payload config in backend/src/payload.config.ts you will need to regenerate the types for the frontend. To do this, run npm run generate:types in the backend directory. Then add fetch functions with the new types to frontend/src/api.ts

Deploying

To deploy this template, there are a couple of options.

Deploying separately

The frontend and backend can be deployed separately. The frontend can be deployed to any static hosting service like Netlify or Vercel or CloudflarePage. The backend can be deployed to any Node.js hosting service like Heroku or Vercel.

Deploying together

The frontend and backend can be deployed together. Astro can be run as a node service with SSR enabled and can be called from the backend in the backend/src/server.ts file.

Documentation