shelf-slim-backend
shelf-slim-backend copied to clipboard
🚀 A Slim Firebase Backend for your Shelf store to help with Checkouts, Payments and emails
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