SvelteBase
Svelte + Sapper + Firebase = ❤
SvelteBase is a hobby project that was started few years ago with a goal - to create a lightweight simple and modern web framework that would make prototyping and development of web projects of any scale easy and fun, while leveraging the best out of modern tools and following simple and intuitive practices that ignite both creative and clever architecture.
Features
Multi-language out of the box
- Server-side generated content comes translated
- Built-in JSON translator using GoogleTranslate
- Ability to preserve dynamic values in the text content using XDATA (tricky hacky solution)
- Translatable Firebase models solution
SEO Friendly
- SSR - Server-side rendering provided by Sapper
- Google Analytics component
- Proper multi-language urls and meta hreflang usage
- Sitemap generator
Sophisticated redirects
Blazing fast
SvelteBase didn't affect the performance of the Svelte and Sapper. Firebase is also one of the fastest BE if used properly.
Websites built with SvelteBase get 100 benchmark on the PageSpped for both desktop and mobile devices.
Firebase local emulators
Issues and challenges
package.json and functions/package.json synchronization
Hence it needs it's own package.json that includes packages required for both Svelte & Sapper and also for Firebase.
Essentially it means, that any package that is added to package.json during development process will needs to be added to added to functions/packages.json.
No access to lang attribute of html opening tag
But unfortunately current version of Sapper doesn't support custom placeholders in the template.html.
That's why by default lang attribute is not specified and we only use hreflang meta data.
Materialize CSS
Server-side and client-side scripts can be confusing
- Sapper pages use two types of runtime scripts: server-side and client-side
- Server side scripts use node.js environment - they have context="module" attribute
- Client side scripts use browser environment
- If you want to get full benefits of SSR you need to use server-side scripts to render necessary content on server-side
Firebase downsides
Limited amount of projects on Firebase
Firestore pagination
Firestore indexes synchronization
However it allows to configure indexes using both Firebase Console and firestore.indexes.json.
But if indexes are configured using Firebase Console they will not be automatically reflected in firestore.indexes.json.
So you need to do it manually, because if you deploy your code to other Firebase project you will need to configure indexes again.