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
projectIdand your Authuid(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 URLwith 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.jswith your own:STORE_NAMESTORE_WEBSITEYOUR_MAILSEND_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/gatewaysfolder 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