This is a modern Svelte 5 template featuring Tailwind CSS, PostgreSQL, and robust authentication (username/password, TOTP, passkey). It includes a manual i18n implementation, database migration tooling, and a comprehensive set of pre-styled UI components based on shadcn-svelte.
Dockerfile
and docker-compose.yaml
for containerized development and deployment with PostgreSQL and Redis.Clone the Repository To create a new project based on this template, you can use the provided CLI tool.
npx sk-template
This command will guide you through the setup process, cloning the template and configuring project-specific variables.
Install Dependencies Navigate to your new project directory and install the dependencies.
cd your-project-name
bun install
Set Up Environment Variables
The CLI tool creates a .env
file from .env.example
. Review it and ensure the values are correct for your local setup.
Start Services Start the PostgreSQL and Redis containers using Docker Compose.
docker compose up -d db redis
For local email testing, you can also start MailHog:
docker compose -f docker-compose.dev.yaml up db redis mailhog
Run Database Migrations Apply the initial database schema and any subsequent migrations.
bun run db:migrate
Run the Development Server Start the SvelteKit development server.
bun run dev
Your application should now be running at http://localhost:5173
.
The template provides a complete authentication solution out of the box, located in src/routes/auth
. It handles user registration, login, session management, and password recovery. The server-side logic in src/lib/server/auth.ts
uses JWT for token-based authentication.
You can manage your database schema using simple SQL migration files.
Create a Migration:
bun run db:create-migration
This creates a new timestamped .sql
file in the sql/migrations
directory.
Apply Migrations:
bun run db:migrate
This script executes any new migrations against your database.
The i18n system is configured in src/lib/i18n
.
src/lib/i18n/messages
.src/lib/i18n/config.ts
.bun run i18n:check
to ensure all translation keys are present across all language files.The application is configured for deployment using Docker.
Build the Docker Image:
The provided Dockerfile
builds the application and sets up a production-ready Node.js server.
docker build -t your-docker-username/your-project-name:latest .
Run the Container:
Use the docker-compose.yaml
file to run your application along with its database and cache services. Make sure your .env
file is configured with your production settings.
docker-compose up -d
This will start the web
service (your app), the db
(PostgreSQL), and redis
services.