Some checks failed
CI / test (22) (push) Failing after 39s
CI / test (20) (push) Failing after 2m56s
CI / build (push) Has been skipped
CI / security (push) Failing after 2m30s
Deploy / docker-build (push) Failing after 9s
Deploy / build-and-deploy (push) Failing after 41s
Gitea CI / test (push) Failing after 33s
Gitea CI / docker-build (push) Has been skipped
3.2 KiB
3.2 KiB
Svelte 5 Static Template with shadcn-svelte
A modern, production-ready template for building static websites with Svelte 5, SvelteKit, and shadcn-svelte components, containerized with nginx.
Features
- ⚡ Svelte 5 - Latest version with new features
- 🏗️ SvelteKit - Full-stack framework with static adapter
- 🎨 shadcn-svelte - Beautiful, accessible UI components
- 🎭 Tailwind CSS 4 - Latest version for styling
- 📝 TypeScript - Type safety out of the box
- 🧪 Testing Suite - Vitest for unit tests, Playwright for E2E
- 📏 Code Quality - ESLint + Prettier configured
- 🐳 Docker Ready - Production nginx container
- 🚀 Static Generation - Optimized for deployment anywhere
Quick Start
Development
# Install dependencies
bun install
# Start development server
bun run dev
Production Build
# Build static site
bun run build
# Preview production build
bun run preview
Docker Deployment
# Build and run with Docker Compose
docker-compose up --build
# Or build Docker image manually
docker build -t svelte-static-app .
docker run -p 3000:80 svelte-static-app
Project Structure
├── src/
│ ├── lib/
│ │ ├── components/ui/ # shadcn-svelte components
│ │ └── utils.ts # Utility functions
│ ├── routes/ # SvelteKit routes
│ └── app.html # HTML template
├── static/ # Static assets
├── tests/ # Test files
├── Dockerfile # Multi-stage Docker build
├── nginx.conf # Nginx configuration
└── docker-compose.yml # Container orchestration
Scripts
bun run dev- Start development serverbun run build- Build for productionbun run preview- Preview production buildbun run test- Run all testsbun run test:unit- Run unit testsbun run test:e2e- Run E2E testsbun run lint- Lint codebun run format- Format code
Adding UI Components
Use the shadcn-svelte CLI to add components:
# Add a component
bunx shadcn-svelte@latest add [component-name]
# Example: Add a dialog component
bunx shadcn-svelte@latest add dialog
Configuration
Static Adapter
The static adapter is configured in svelte.config.js. Modify settings as needed:
adapter: adapter({
pages: 'build', // Output directory
assets: 'build', // Assets directory
fallback: undefined, // SPA fallback page
precompress: false, // Enable gzip/brotli
strict: true // Strict prerendering
});
Nginx
Production nginx configuration in nginx.conf includes:
- Gzip compression
- Static asset caching
- Security headers
- SPA routing support
Deployment
This template generates a static site that can be deployed to:
- Static Hosts: Netlify, Vercel, GitHub Pages
- Docker: Any container platform (production nginx setup)
- CDN: Any CDN with the built files
- Traditional Hosting: Any web server
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
License
MIT License - see LICENSE file for details