Sveltekit with Authentication Boilerplate

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

Install dependencies

npm install

Setup environment variables

Create a .env file and add the following lines:

MONGODB_URI="mongodb+srv://<username>:<password>@<address>/<database>?retryWrites=true&w=majority"
  • replace <username> with your database's username
  • replace <password> with your database's password
  • replace <address> with your database's address
  • replace <database> with your database name

Do one import and create search index named default.

Setup Azure Translator Cognitive Services

Follow this guide to setup Azure Translator Cognitive Services.

Add the following lines to your .env file:

AZURE_TRANSLATE_KEY="<your key>"
AZURE_TRANSLATE_REGION="<your region>"

Developing

Start SvelteKit development with the following command:

npm run dev

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

Start SocketIO development with the following command:

node express.js

Building

To create a production version of your app:

npm run build

You can preview the production build with npm run preview.

Deploying

By default the application will be deployed to /build, which can be started with node build. But we have a special Express server with SocketIO that can be started with the following command:

npm run deploy

Top categories

svelte logo

Need a Svelte website built?

Hire a professional Svelte developer today.
Loading Svelte Themes