sveltekit-d1-tailwindcss-template Svelte Themes

Sveltekit D1 Tailwindcss Template

Template repository for developing sveltekit apps with tailwindcss

sveltekit-d1-tailwindcss-template

A modern web application template combining SvelteKit, Cloudflare D1 Database, and TailwindCSS for rapid development of performant, full-stack applications.

Features

  • ๐Ÿš€ SvelteKit - Full-stack application framework
  • ๐Ÿ’พ Cloudflare D1 - SQLite-compatible database on the edge
  • ๐ŸŽจ TailwindCSS - Utility-first CSS framework
  • โœ… Type-safe database operations
  • ๐Ÿ“ฑ Responsive design out of the box
  • ๐Ÿงช Testing setup with Vitest
  • ๐Ÿ“š JSDoc documentation

Prerequisites

  • Node.js (version 16 or higher)
  • Cloudflare account
  • Wrangler CLI installed globally (npm install -g wrangler)

Getting Started

  1. Create a new project using this template:

    npx create-next-app my-app -e https://github.com/kcbrewron/sveltekit-d1-tailwindcss-template
    cd my-app
    
  2. Install dependencies:

    npm install
    
  3. Set up your D1 database:

    wrangler d1 create my-db
    
  4. Update the wrangler.toml with your D1 database details.

  5. Run the development server:

    npm run dev
    

Project Structure

โ”œโ”€โ”€ migrations/       # Database migration files
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ lib/         # Shared components and utilities
โ”‚   โ”œโ”€โ”€ routes/      # SvelteKit routes and pages
โ”‚   โ””โ”€โ”€ app.css      # Global styles
โ”œโ”€โ”€ static/          # Static assets
โ””โ”€โ”€ tests/           # Test files

Database Migrations

To run migrations:

npm run migrate

Deployment

  1. Build the application:

    npm run build
    
  2. Deploy to Cloudflare Pages:

    wrangler pages deploy .svelte-kit/cloudflare
    

Development

Available Scripts

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm run preview - Preview production build
  • npm run test - Run tests
  • npm run check - Type-check the codebase
  • npm run lint - Lint the codebase

Environment Variables

Create a .env file in the root directory:

DATABASE_URL=your_d1_database_url

Contributing

Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Top categories

Loading Svelte Themes