1. Basic Installation and Project Setup
SvelteKit is a powerful web framework built on top of Svelte. Let's learn how to start a new project and understand its basic structure.
1.1. Creating a SvelteKit Project
Use the following commands in your terminal to create a new SvelteKit project. You can choose your preferred package manager.
npm create svelte@latest my-sveltekit-app
cd my-sveltekit-app
npm install
npm run dev
These commands will guide you through an interactive setup for your project.
1.2. Project Basic Structure
The main directories and files in a generated project are:
src/: Contains all the source code for your SvelteKit application.src/routes/: Where file-system based routing is defined.src/lib/: Includes reusable components, utility functions, etc.static/: Stores static assets (e.g.,favicon.ico) served directly by the web server.
Key Concept: SvelteKit uses file-system based routing to define the structure of your website.