@mortond/cra-template-bowhead v0.4.21
Bowhead
Bowhead Create-React-App template for fast MicroSaas prototyping using the Bowhead ReactJS component.
Demo - https://sad-tereshkova-9a21f9.netlify.app/
Includes
- ReactJS
- Redux Toolkit
- React Redux Firebase
- MaterialUI
- Stripe subscription management
- Firebase authentication
- Firestore database
- Netlify hosting and functions
How to use (macOS)
- Create project using Bowhead CRA template
npx create-react-app my-app --template @mortond/cra-template-bowhead- Install Firebase CLI https://firebase.google.com/docs/cli
npm install -g firebase-tools- Install Netlify CLI https://docs.netlify.com/cli/get-started/
npm install -g netlify-cli- Install Stripe CLI https://stripe.com/docs/stripe-cli
brew install stripe/stripe-cli/stripe- Rename
.env.sampleto.env
mv .env.sample .env- Rename
.env.functions.sampleto.env.functions
mv .env.functions.sample .env.functionsGitHub
- Go to https://github.com/ and create a new repo for this project, this is required to set up your Netlify project
Netlify
- Go to https://app.netlify.com/ and create a project from GitHub
There is no need to fill in all the details, you will be building and deploying this project from your local development environment for now.
Build and deploy the functions needed for the Bowhead ReactJS component.
yarn build:functions
yarn deploy:netlifyStripe
- Go to
https://dashboard.stripe.com/and create an account for this project
- Create 3 subscription products, e.g. Basic, Pro, Enterprise
- Add the price IDs to the
.envfile, check
REACT_APP_STRIPE_SUBSCRIPTION_PLAN_BASIC=price_1H306XJ...gt0GNOy1IQS
REACT_APP_STRIPE_SUBSCRIPTION_PLAN_PRO=price_1H307CJF9...gt0ZmRhLsNE
REACT_APP_STRIPE_SUBSCRIPTION_PLAN_ENTERPRISE=price_1H...F9YjhGgt0SxEYD01h- Go to
API Keyssection underDevelopersand copy your accountspublishable keyto the.envfile
REACT_APP_STRIPE_PUBLISHABLE_KEY=pk_test_AGZ3fyOfs2...afdsaAdzyMD00DP2- Copy your accounts
secret keyto the.env.functionsfile
STRIPE_SECRET_KEY=sk_test_3PfzJ...00ds44323paZ9L- Create a webhook that points to your deployed netlify function e.g.
https://<your-project>.netlify.app/.netlify/functions/webhook-stripeand configure the following event types
customer.subscription.deleted
customer.subscription.updated
customer.subscription.created
checkout.session.completed- Copy the
webhook signing secretto the.env.functionsfile
STRIPE_WEBHOOK_SIGNING_SECRET=whsec_jIPnnfds...fd89jD7lryYmIDHIoFirebase
- Go to https://console.firebase.google.com/ and create a new project
- Register this app in Firebase
- Create a new
Firestoredatabase, start in production mode - Set Authentication sign-in method to
email/passwordand enableEmail link - Add the projects
*.netlify.appURL toAuthorized domains - Update
./config.jswith your Firebase project configuration
Backend
- Generate a new Firebase service account private key for this project
- Open the service account
.jsonfile and copy the environment variable values to.env:
FIREBASE_FIRESTORE_PROD_DATABASE_URL=https://<you-app-url>.com
STRIPE_SECRET_KEY=sk_test_3PZoczJ9M...Dg00zt3paZ9L
STRIPE_WEBHOOK_SIGNING_SECRET=whsec_jIPnnV1DKk...2CojD7lryYmIDHIo
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nMIIEvQIBADA...lkXctrKM9oOQA=\n-----END PRIVATE KEY-----\n"
FIREBASE_CLIENT_EMAIL=firebase-adminsdk-....@...iam.gserviceaccount.com
FIREBASE_PROJECT_ID=<project-id>CLI
Run
firebase initand enable:- Firestore
- Emulators
Choose
Use an existing projectand select the project you just created- DO NOT overwrite
firestore.rules - Run
firebase login:ci, login with your browser, and copy thetokento the.envfile.
Theming
Bowhead uses MaterialUI which means the UI can styled by registering a new theme and overwriting the CSS based on the generated classes. See: https://material-ui.com/customization/globals/#global-css
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago