nilskj / payload-kit

An example of hooking up payload cms into a svelte kit project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

create-svelte with payload cms

Everything you need to build a Svelte project, powered by create-svelte. This example also sets up payload cms with a locally running mongoDB, and tailwind CSS.

Running a single server with both the payload and sveltekit

We can use the built output of node adapter for sveltekit. and inject the payload cms handler, see src/server/index.js.

Boot up a docker container with a mongodb

# Boot up a docker container with a mongodb
docker compose up

# Install dependencies if you haven't already
yarn

# Run both payload and sveltekit in dev in parallel, sveltekit at 3000, cms at 3001
yarn dev

# Reboot container, run build and then dev in one command
yarn dx

# Serve a merged server handling both Payload and Svelte for prod
yarn serve

Otherwise all else as normal like a sveltekit app.

About

An example of hooking up payload cms into a svelte kit project


Languages

Language:TypeScript 37.2%Language:JavaScript 37.1%Language:Svelte 19.3%Language:HTML 4.5%Language:CSS 1.8%