A shopping list PWA synced between clients.
- React (CRA)
- Typescript
- Material-UI
- Firebase
- Netlify (hosting + functions)
- Support fully offline. By nature firebase realtime doesn't support offline mode. This app does.
- When there is a new version, the app refreshes automatically (instead of
console.log
supplied by CRA template)
yarn
- Follow the instruction - https://firebase.google.com/docs/database/web/start.
- Rename
env.sample
to.env.local
and update its content with the details received from firebase. - Set up authentication - https://firebase.google.com/docs/database/security/get-started#set_up. The UI doesn't have login so it only supports external providers (e.g. Google)
- Limit the users who can access the db to avoid exceeding the free plan. You can do it by setting the rules write / read to certain users, like this:
{
"rules": {
".read": "auth.token.email == '[email protected]' ||
auth.token.email == '[email protected]'",
".write": "auth.token.email == '[email protected]' ||
auth.token.email == '[email protected]'",
}
}
- Enable cors - follow https://firebase.google.com/docs/storage/web/download-files#cors_configuration
In order to let the server (the code will published soon) to send a push notification, the app should register itself to FCM ("Firebase Cloud Messaging"), get a token and submit it to server. In order to do this:
- Register the app and get the Notification Token.
- Add it as
REACT_APP_NOTIFICATION_TOKEN
toenv.local
/ server env variable.
In the process you'll set the build variables the same as in the .env
file.
Notes:
- If you configure netlify manually (not via the "Deploy" button), don't forget to configure the build variables.
yarn push
triggers alsonpm version
which bumps the app's version which reflected in the UI (main nav at the bottom)
yarn start
netlify functions:serve
The proxy function aims to solve the CORS issue when trying to save an image from Google search result (Item Details > Image > Replace (Google)).
- Illustrations by undraw ❤️