A minimalist boilerplate for creating full stack web apps using Firebase, SvelteKit, and Stripe.
Combining SvelteKit, and Firebase's new webframework beta support.
Deploying the entire app, front and back, is as simple as running firebase deploy
.
User management is a time consuming task, and is often repeated in every project.
Authentication is mostly handled on the server side, providing a more secure, and much nicer user experience.
Currently only Google sign in is supported. More options will be added in the future in the template, but you can easily add them yourself.
Signing up will create a record in Firestore, and will add the user to the users
collection.
You can define admin, or custom rôles, and restrict access to pages or functions.
Access control is defined using Firebase's Custom Claims. Although, it might not be the most straightforward thing to use, it brings 2 important advantages:
Thanks to a svelte hook, the current user object is available everywhere in the app: in +layout, +pages, and +server files.
This template integrates Stripe, and provides a basic example of a subscription based payment system.
A user can subscribe to a plan. This plan has to be defined as a product in Stripe.
Webhooks are used to update the user's subscription status, and to update the database accordingly. If a product has a claim
metadata, the user will be granted the same customClaim.
Users can access the Stripe portal to manage their subscription. You need to activate Portal in your Stripe dashboard
The pricing page is a good example of how to use Stripe's API to get the list of products, and display them.
The admin page lists the users, and show their subscription status.
This templates uses a CSS-only fork of Pico, a lightweight CSS only framework. No install needed.
I encourage you to check Pico's documentation to see it's capabilities.
A very standard layout is provided. If you know HTML and CSS, you can easily customise it to your needs.
It tries to be very intuitive to use.
A few pages are provided as examples. They are very basic, but gives some necessary informations, and provides a good starting point.
Most settings happen in the .env file. Your Stripe and Firebase credentials can be securely stored there.
A handy component is provided to render markdown files. It's used on the home page, but can be used anywhere else.
It can also create a table of content.
https://realtimecolors.com/ > Just copy paste the generated CSS in the themes files.
You can set minInstances
to 1 in the firebase.json
file, to avoid cold starts. Estimations varies, but my latest tests showed that it costs around 30€/month, significantly more than what I've seen on other sources.
Here are the known sites that use this template:
Here are the features I plan to add: