Use this template / starter kit to quickly deploy a UI or API on Cloudflare Pages.
Demo - Cloudflare worker
Flowbite API is subject to change. Best practice is to update the flowbite packages and refer to documentation when creating a new project.
Clone this repo as a template or recreate from scratch.
Choose one of these methods:
gh repo create <new-repo-name> --template=getmuxxi/template-cloudflare-sveltekit
git clone [email protected]:<new-repo>
git push
to deploy# after cloning repo
npm install
# create .svelte-kit dir with tsconfig.json
npm run check
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
To create a production version of your app:
npm run build
You can preview the production build with npm run preview
.
git push
to github
Cloudflare Pages will auto build and deploy when configured properly.
Cloudflare
Tailwind & Flowbite
// Example accessing data stored in Cloudflare
// Needs to be configured in app.d.ts first
const counter = platform.env.COUNTER.idFromName("A");
Follow the steps below to recreate this template from scratch.
# Install sveltekit
npm create svelte@latest NEW-APP-NAME
# Select:
# - Sveltekit demo app
# - Typscript
# - ESlint + Prettier + Playwright + VITest
# Install the cloudflare pages adapter
npm install --save-dev @sveltejs/adapter-cloudflare
# Install tailwind and flowbite
npm install -D tailwindcss postcss autoprefixer @tailwindcss/typography
npm install -D flowbite-svelte flowbite-svelte-icons svelte-heros-v2
# Optionally install mdsvex for markdown support
npm install -D mdsvex
npx tailwindcss init tailwind.config.cjs -p