SvelteKit Generator is a powerful CLI tool inspired by Laravel Artisan (php artisan make:
). It simplifies the process of generating routes, components, server functions, API endpoints, and layouts in your SvelteKit projects. With sveltekit-generator
, you can save time and focus on building your application.
+page.svelte
and +page.server.ts
files in the src/routes/
directory./user/[id]
, store/[storeId]
).--dynamic userId
or using the -d
flag).+server.ts
files for API endpoints.+layout.svelte
and +layout.server.ts
) for consistent page structures.Install sveltekit-generator
using your preferred package manager:
npm i sveltekit-generator
pnpm i sveltekit-generator
bun install i sveltekit-generator
package.json
file to use it globally:"scripts": {
"generate": "sveltekit-generator"
}
pnpm generate route <route_name>
pnpm generate route <route_name> -d <param_name>
pnpm generate route ('(folder_name)/<route_name>')
pnpm generate route ('(folder_name)/<route_name>') --dynamic <param_name>
pnpm generate component <route_name> <component_name>
pnpm generate component <route_name> -d <param_name> <component_name>
pnpm generate api <api_name>
pnpm generate api <api_name> -d <param_name>
pnpm generate layout <layout_name>
pnpm generate store <store_name>
pnpm generate store <store_name> -t readable
pnpm generate store <store_name> -t derived
pnpm generate store <store_name> -t writable
pnpm generate store <store_name> -p <path>
Why Use SvelteKit Generator?
If you'd like to contribute to this project, feel free to open an issue or submit a pull request on GitHub.
This project is licensed under the MIT License. See the LICENSE.md file for details.