svelte-kit-koa-boilerplate Svelte Themes

Svelte Kit Koa Boilerplate

This is a boilerplate for svelte-kit and koa.

Svelte-kit + Koa boilerplate project

This is a boilerplate for svelte(-kit) and koa. It includes:

  1. Koa for building backend API
  2. Svelte kit for building FE js app
  3. Typescript support
  4. Build configuration and Dockerfile for easy to set up deploy

Download with Degit

npx degit kaladivo/svelte-kit-koa-boilerplate my-new-super-cool-project

Structure

src/server - Where the Koa server lives in
src/server/createServer.ts - Creates Koa server, here you can add more routes
src/app - SvelteKit app directory. See official docs to find out more.

How to use

First of all, run yarn install to install all dependencies.

If you with to modify env vars, copy .env.example into .env and modify the contents to your liking.

yarn start:server - starts koa dev server
yarn start:app - starts svelte-kit dev server
yarn start - runs both start commands concurrently

When developing the app, make sure to access Koa server (with the correct port) not the svelte dev server. Koa service is configured to automatically proxy requests to svelte server. This way we do not have to deal with CORS

yarn build:server - builds Koa server into /build folder
yarn build:app - builds Svelte-kit app into /build folder
yarn build - runs both build commands concurrently

yarn serve - Starts built koa server

TODO

  • Include .env file setup
  • Get rid warnings / errors
    • (!) Unresolved dependencies when running build:sever
    • Error: connect ECONNREFUSED 127.0.0.1:80 - when requesting page

Top categories

Loading Svelte Themes