svelte-dotnet-starter Svelte Themes

Svelte Dotnet Starter

SvelteKit 5 + ASP.NET 9 Starter Template

This repository provides a template for building full-stack web applications using ASP.NET 9 Minimal API for the backend and SvelteKit 5 for the frontend.


Development

During development, both the backend and frontend need to be running simultaneously.

Setup

Before starting the frontend, install the dependencies:

npm install

Backend

dotnet run

Frontend

npm run dev

⚠️ Make sure to adjust the ports if necessary in environment.ts in the SvelteKit frontend.


API Client Generation

If you need to generate a new API client, run:

npm run generate-api-client

⚠️ The backend must be running when generating the API client. You may also need to adjust the port of the C# backend if it differs from the default.


Features

  • Tailwind CSS is pre-installed for styling.
  • Example routes in SvelteKit communicate with the backend API at api/todos.
  • Ready-to-use as a starting point for new projects.

Production / Deployment

To build the frontend and serve it via the ASP.NET backend:

npm run build

This command will place the built SvelteKit SPA into the wwwroot folder of the API, making it accessible through your API URL.

Hosting works the same way as a normal .NET 9 Minimal API, meaning you can deploy via IIS or run it inside a Docker container.


Notes

  • Ensure both backend and frontend ports are correctly configured.
  • Example routes and SPA integration are ready for testing immediately after build.
  • This repository is intended as a template to quickly bootstrap new projects.

Top categories

Loading Svelte Themes