An SPA example for people to quickly start churning out fullstack apps in Svelte with firebase. The Svelte app uses JavaScript while the firebase functions use TypeScript
Best way to get up to speed is to watch these videos:
This is a project template for Svelte apps. It lives at https://github.com/sveltejs/template.
To create a new project based on this template using degit:
npx degit sveltejs/template svelte-app
cd svelte-app
Note that you will need to have Node.js installed.
Install the dependencies...
npm install
...then start Rollup:
npm run dev
Navigate to localhost:5000. You should see your app running. Edit a component file in src
, save it, and reload the page to see your changes.
By default, the server will only respond to requests from localhost. To allow connections from other computers, edit the sirv
commands in package.json to include the option --host 0.0.0.0
.
To create an optimised version of the app:
npm run build
You can run the newly built app with npm run start
. This uses sirv, which is included in your package.json's dependencies
so that the app will work when you deploy to platforms like Heroku.
Assuming you have firebase emulation for Realtime DB and Cloud functions you can pass this env variable in to run EMULATION="true" npm run dev
And your production data will not be touched
You can also get chrome to open up with no security as there are some cars issues with local emulation or functions with npm run chrome
. You can then test the local app with the new Chrome window