This is a simple svelte and firebase project. It can be run locally by connecting to firebase emulators.
Note that you will need to have Node.js and Firebase CLI installed.
Install the dependencies...
npm install
... and start Firebase emulators (only firestore is used):
firebase emulators:start --only firestore
...then start Rollup:
npm run dev
Navigate to localhost:8080. 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
.
Before building for production, you need to comment out this line from src/Firebase.ts
to instruct the app to connect to the production Firebase project instead of local emulators (ideally, this should be setup as an environment variable):
connectFirestoreEmulator(database, "localhost", 8079);
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.
With Firebase Hosting
From within your project folder:
npm run build
firebase deploy --only hosting
With Vercel
Install vercel
if you haven't already:
npm install -g vercel
Then, from within your project folder:
cd public
vercel deploy --name my-project
With surge
Install surge
if you haven't already:
npm install -g surge
Then, from within your project folder:
npm run build
surge public my-project.surge.sh