The ultimate act of procrastination: building a custom personal todos/goals dashboard! 🤨
- Login with Google auth to accept only your Gsuite/Gmail email.
- Add, sort/drag, mark complete, delete and group todos.
- Sortable works on mobile (rarity in Svelteland).
- Lightweight PWA app (half-arsed, only tested on Android).
- Firestore realtime database using RxFire.
- Firebase function resets todos daily at midnight.
- Repeat a todo:
r repeat me daily
orr show me every other day 2
. - Toggle a todo:
t dig a hole OR fill the hole
.
Heavily modified from this tutorial: https://fireship.io/lessons/svelte-v3-overview-firebase
There are room for improvements everywhere and I won't be supporting or updating this repo, so please fork and modify to suit your own needs 😃
- Add your email in
src/App.svelte
{#if user && user.email === '[YOUR_EMAIL_HERE]'}
- Create a new Firebase project, then create a new web app and copy your credentials into
src/firebase.js
var firebaseConfig = {
apiKey: "",
authDomain: "",
databaseURL: "",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: ""
};
-
In the Firebase console go to
Authentication
in the sidebar, selectSet up sign-in method
tab and enableGoogle
. -
Go to
Database
in the sidebar, create a new Firestore database, then start a newtodos
collection. ClickAuto-ID
, save, then delete that document. Eventually the fields will look like this:
-
Upgrade your Firebase project plan to
Blaze
. This is required for scheduled functions: USD$0.10 per month. -
Add your email in
functions/firestore.rules
:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth.token.email == '[YOUR_EMAIL_HERE]'
}
}
}
- Add your email in
functions/index.js
if (user.email === "[YOUR_EMAIL_HERE]") return null;
- Also configure your timezone
.timeZone("Australia/Sydney") //change to your timezone
- Open a terminal and install dependencies
cd svelte-sortable-firebase-todo/functions
npm install
- Install the Firebase CLI
npm install -g firebase-tools
- Login to Firebase
firebase login
- Select the active Firebase project
firebase use --add
- Deploy to Firebase
firebase deploy
-
In the Firebase console you should see the two functions listed under
Functions
in the sidebar. Also you should see theRules
andIndexes
tabs withinDatabase
have been updated. -
You'll need to wait a few minutes for the index to be built.
- Open a terminal and install dependencies
cd svelte-sortable-firebase-todo
npm install
- Start the app with Rollup
npm run dev
-
Navigate to localhost:5000
-
See if you can login (click the 😮) and add/drag/delete todos. Hold down to start drag.
-
"Oh gawd, oh no, plz no, why, why, just why" 😱
-
If it doesn't work, check the console. Could be a domain whitelist issue in Firebase.
** Note: be sure to add the domain to the whitelist in Firebase console and/or Google Cloud console.
With now
Install now
if you haven't already:
npm install -g now
Then, from within your project folder:
npm run build
now 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