This is a client-side implementation of the Flight Club app, the original version is here: https://github.com/drc56/flight_club
The site is built using Svelte and SvelteKit
Firebase provides auth, hosting, database, storage, and cloud functions.
npm install to install required dependenciesnpm run dev to launch the site locallyReady for local development from here. Saving files will cause a hot-reload, though a full browser refresh or re-starting step 3 sometimes fixes insidious bugs.
npm run build to compile the Svelte files to plain javascriptnpm run preview to quickly see the built sitenpm run start to serve the site locally as it will be deployed using firebase emulatorsnpm run test run testsnpm run deploy-site to deploy changes to the static site. This requires user credentials with the correct permissionsnpm run deploy-functions to deploy changes to the firebase functions. Requires credentialsFirebase hosting only serves static content, so the SvelteKit server-side (SSR) features are disabled by using the adapter-static in SPA mode.
The firebaseConfig object in firebase.ts is served to every user and considered public, data protection is maintained through Firebase Security Rules.
Most of the site is unavailable without logging in - see the if block in the template file. This is not true data protection, which is again maintained through Firebase Security Rules.
Users authenticated via Google with firebase auth, which is made available site-wide by a store in this file.
The Firestore data structure prioritizes read efficiency, so there is some redundancy. Secondary data updates are handled by cloud functions defined here. These are called when primary data changes (ie. a beer is added). This secondary data includes:
/src most of the site lives here/src/routes files and folders names here translate to URLs on the site/src/lib components and modules that aren't full pages/src/lib/firebase.ts all firestore interfaces are maintained here/src/lib/models.ts the data model is maintained here/src/lib/stores.ts data available site-wide are defined in stores here/src/tests jest test files/static static assets like fonts and images/functions cloud functions
svelte.config.js Svelte settings and optionsfirebase.json Firebase settings and optionspackage.json Node.js settings and optionsfirestore.rules security rules to protect the databasestorage.rules security rules to protect the file storage (mostly pictures)firestore.indexes.json unlike SQL, compound queries are only possible if there is an indexjest.config.mjs Jest settings and options
The data is maintained in firestore which is a document/collection system. There are three main collections: