Skip to content

xmlking/svelte-starter-kit

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time

Svelte Starter Kit

Everything you need to build a Svelte project, powered by create-svelte.

Tech Stack

Features

  • Lazy-loading images
  • Responsive design
  • SEO optimization
  • forms: schema definitions with yup. validation errors with svelte-forms-lib
  • Forms: schema definitions with zod. Validation errors with felte forms
  • UI Components: tailwindcss based flowbite and daisyui , make both work together without conflect, add DarkMode switcher.
  • K8s deployment with letsencrypt ssl certificates
  • Tables: svelte-headless-table

Setup

cd ~/Developer/Work/SPA
git clone https://github.com/xmlking/svelte-starter-kit.git
cd /svelte-starter-kit && npm install
# playwright is required for end-to-end testing
npx playwright install

Environment Variables

By default, the dev server (dev command) runs in development mode and the build command run in production mode.
This means when running npm build, it will load the env variables from .env.production if there is one:
Use .env.local to override environment variables in .env (like API keys) for local development.

## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

```shell
npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open

# run in debug mode
NODE_ENV=DEBUG npm run dev

# run with a custom inline config
# inline environment variables has higher precedence than ones loaded from .env and .env.local files
CONFY_API_ENDPOINT=api.mycompany.com:443 npm run dev

Maintenance

Update

To update the packages to their latest versions in package.json

ncu -u
npm i

Testing

Unit/Component Tests

npm run test

npm run test:ui
#Then, you can visit the Vitest UI at http://localhost:51204/__vitest__/.

# test coverage
npm run test:coverage

# updating Snapshots
vitest -u

E2E Tests

npm run test:e2e

Building

To create a production version of your app:

npm run build
# build for hybrid rendering on nodejs runtime
npm run build:node
# build for static rendering on nginx runtime
npm run build:static
# run build
node build

Run from the local build directory:

NODE_ENV=production \
CONFY_API_ENDPOINT=api.mycompany.com:443 \
node build

# (optional) pass ORIGIN when using `adapter-node` build
HOST=127.0.0.1 \
PORT=4000 \
ORIGIN=https://my.site \
node build

You can preview the production build with npm run preview.

To deploy your app, you may need to install an adapter for your target environment.

Release

after checking-in all your changes, bump the VERSION and build the docker image.

# dry-run
cog bump --auto --dry-run
# this will bump version in package.json and create git tag and commit.
cog bump --auto