This app showcases the life cycle of a Strike API payment. A user can search a strike username, generate a lightning invoice QR code for that user, then pay the invoice and be alerted upon successful payment. I imagine the Strike API could be used anywhere payments are happening, as well as to bootstrap a lightning app until devs can integrate invoice generation trustlessly.
- Install ngrok
brew install ngrok/ngrok/ngrok
- Add auth-token
ngrok config add-authtoken TOKEN
- Expose localport to ngrok tunnel
ngrok http 3001
- https://www.freecodecamp.org/news/how-to-create-a-react-app-with-a-node-backend-the-complete-guide/
- https://www.youtube.com/watch?v=FcwfjMebjTU
- https://github.com/kubowania/crypto-dashboard-react/blob/main/index.js
- create a new project folder
npm init -y
- alter the package.json file
"scripts": {
"start" : "node server/index.js",
"build" : "cd client && npm install && npm run build"
},
"engines": {
"node" : "16.3.0" // REPLACE_WITH_YOUR_VERSION
}
- Create a front end & remove the default git repo (we're using git at the root folder of this project)
npx create-react-app client
cd client
rm -rf .git
- Create an account on Heroku.com and create a new app
- Install heroku command line tool
sudo npm i -g heroku `
heroku login `
git init
heroku git:remote -a insert-your-app-name-here
git add .
git commit -m "Deploy app to Heroku"
git push heroku master
- Create a github repo as well and copy the URL. You can check which remotes to send repo to by using
git remote -v
git remote add <custom_name_for_this_remote> <github-url>
git push <custom_name_for_this_remote> master
- Create a .env file and populate with API keys like so:
MY_SECRET_FAKE_API_KEY=secret_fake_api_key_1234
- Create a .gitignore file and populate with:
.env
- Add require dotenv to node scripts
require('dotenv').config()
- Reference env variable in node scripts as:
process.env.MY_SECRET_FAKE_API_KEY
- Update Heroku console with environment variable in -> Settings -> Config Vars
- Now you can redeploy to heroku and your environment variables (api keys) will be hidden.
git add .
git commit -m "added environment variables"
git push heroku master