Skip to content

πŸš€ A Slim Firebase Backend for your Shelf store to help with Checkouts, Payments and emails

License

Notifications You must be signed in to change notification settings

shelf-cms/shelf-slim-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Shelf Slim Backend

πŸ₯³ SHELF turns your Firebase project into a HEADLESS CMS

What is this ?

This repository is a complementary simple backend for achieving extra capabilities with SHELF under 170kb:

  • Creating Checkouts from Web or Mobile
  • Capture / Void / Refund Payments πŸ’³ (Currently PayPal, but more are coming and you can add your own)
  • Marketing emails (User signup, Payments)

I want it, how to use it ?

Clone this repository and follow instructions

Instructions

1. Create Firebase project

Simply, follow our guide HERE πŸ“–

Write projectId and your Auth uid (when you created yourself as user)

2. Clone this repository

git clone https://github.com/shelf-cms/shelf-slim-backend.git

3. Install firebase CLI globally

npm install -g firebase-tools

4. Kick some things

cd into the repo directory

firebase login

5. Edit .firebaserc

Open .firebaserc and paste your projectId into YOUR_PROJECT_ID_HERE

6. Edit firestore.rules

Open firestore.rules and paste your uid into YOUR_UID_HERE

7. Edit storage.rules (Optional, if you prefer other storage services)

Open storage.rules and paste your uid into YOUR_UID_HERE

8. Deploy Firestore rules and indexes and storage rules

firebase deploy --only firestore,storage

9. Tinker with functions before deploy

firebase emulators:start --only functions

If, you are ready to deploy the functions

firebase deploy --only functions

10. Update your backend @ shelf

  • Login to SHELF
  • Settings > Update Backend URL with your local or production url.

πŸ’‘ For local dev, make sure your browser does not block requests to localhost (Brave browser does it and it can be disabled)

11. Tinker with the backend

πŸ’‘ Few suggestions:

  • Edit functions/src/actions/send-mail.js with your own:
    • STORE_NAME
    • STORE_WEBSITE
    • YOUR_MAIL
    • SEND_GRID_SECRET (Be sure to open an account with sendgrid)
  • Modify the logic of events at functions/index.js
  • Add a new payment gateway by inspecting functions/gateways folder and reading The SHELF Gateways Docs πŸ“–

πŸ‘‹ Contribution Guide

Any contribution is welcome. Here are some, that will be cool to add:

  • More Payment Gateways
  • Automatic bootstrap script
  • Better docs
  • Anything you feel is an improvement

Also, feel free to fork and make it your own, for your own projects