/Serverless-DOCS-Stack

Serverless DOCS Full Stack Starter (Drizzle OAuth Cloudflare SvelteKit) - DEMO serverless-docs-stack.vtempest.workers.dev

Primary LanguageSvelte

Serverless DOCS Stack

⚒️ Drizzle OAuth Cloudflare Svelte

📚 Drizzle ORM - lightweight ORM compatible with Cloudflare D1 and drizzle-kit to manage schema migrations

👤 OAuth Lucia - Google oAuth sign-in and/or email signup via Resend mailer api, with 4 email templates: reset password, change email, verify email, welcome. Settings and admin panel for users.

☁️ Cloudflare for Svelte - serverless autoscaling API and D1 database, great hosting platform with free tier

🖼️ SvelteKit - full stack interface and API routes framework

🧩 Interface Components:

🎨 Tailwind CSS + Bits UI + shadcn-svelte - popular UI components which can be AI-generated at v0.dev

📝 formsnap + sveltekit-superforms + zod - form validation

📱 lucide - icons

🛣️ vite-plugin-kit-routes - url routes

🌲 pino - logging

Sreenshots

⬇️ Installation

  1. Install prerequisites Node.js or Bun curl -fsSL https://bun.sh/install | bash
  2. Clone to localhost or server git clone https://github.com/vtempest/docs-stack-starter
  3. mv .env.example .env ; mv wrangler.example.toml wrangler.toml and set the domain and API keys in .env
  4. Auth providers, get id/secret from Google
  5. Set OAuth origin http://localhost and http://localhost:5173 on local or https://domain.com on server
  6. Set redirect http://localhost:5173/auth/oauth/google/callback or https://api.domain.com/auth/oauth/google/callback
  7. For email auth, get API from Resend mailer and verify domain
  8. Log in with your Cloudflare account by running: bunx wrangler login
  9. Create your D1 database via dashboard or with bunx wrangler d1 create my-db-prod
  10. Copy the console output database_name and database_id
  11. Go to wrangler.toml and change database_name and database_id.
  12. Go to drizzle.config.ts and change db name in dbName.
  13. Go to package.json and change db name in db:push:*.
  14. Generate and migrate the schema to dev or prod db: bun run db:migrate; bun run db:push:dev; bun run db:push:prod
  15. Develop on local with bun run dev
  16. Deploy to prod with bun run deploy