A classic Snake game built with SvelteKit and TypeScript. This modern implementation features smooth animations, progressive difficulty, and local high score tracking.
Clone the repository:
git clone https://github.com/zym9863/sveltekit-snake.git
cd sveltekit-snake
Install dependencies:
npm install
# or
pnpm install
# or
yarn install
Start the development server:
npm run dev
# or start and open in browser
npm run dev -- --open
sveltekit-snake/
âââ src/
â âââ lib/
â â âââ Snake.svelte # Main game component
â âââ routes/
â â âââ +layout.svelte # Root layout
â â âââ +page.svelte # Home page
â âââ app.d.ts # TypeScript declarations
âââ static/ # Static assets
âââ package.json # Project dependencies
âââ svelte.config.js # SvelteKit configuration
âââ tsconfig.json # TypeScript configuration
âââ vite.config.ts # Vite configuration
To create a production build:
npm run build
Preview the production build:
npm run preview
This project uses the auto adapter by default, which automatically detects and uses the correct adapter for your deployment platform. For specific deployment targets, you may need to install and configure a different adapter.
@sveltejs/adapter-vercel
@sveltejs/adapter-netlify
@sveltejs/adapter-node
@sveltejs/adapter-static
npm run dev
- Start development servernpm run build
- Build for productionnpm run preview
- Preview production buildnpm run check
- Run svelte-check for type checkingnpm run check:watch
- Run svelte-check in watch modeContributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.