A simple Node.js server, as well as React UI used for testing Bitcoin payments.
- Users log in with their Google or Facebook account, all requests are tied to their unique ID.
- The home page is a simple dashboard of basic user information, user transaction history and account balance.
- If there are pending payments, there will be a red notification icon
- The user can navigate to
/payment
to start a new payment to another user. - The user can confirm the payment details from
/review
and confirm the start of the transaction. - Back on
/
, the user will see their account balance remain the same, but their transaction history will show a new "pending" entry (the transaction is pending approval from the receiving user). - After the receiving user confirms the transaction, the funds will be taken from the sending user, and the sending user's dashboard will be updated with a red notification and decreased balance.
- After signing in, the user sees a notification about a pending transaction.
- The user can confirm the payment details from
/review
and confirm the end of the transaction. - Back on
/
, the user will see their account balance updated, and the transaction history will show a new entry.
Setup:
- Set up React with start, test, build
- Set up Express
- Build the server to
/dist
usingyarn run build-server
script - Set up a test for the server using
yarn run test-server
script - Look into Firebase for authentication and real-time database
- Authenticate API requests with JSON Web Tokens
Dev:
- Build server route for
post
ing a new transaction - Build server route for
post
ing confirmation or declining of an existing transaction - Build server route for
get
ting user dashboard data - Build UI view for
/
- Build UI view for
/payment?tid=12345
- Build UI view for
/review?tid=12345
Deployment:
- Set up a domain on Route 53
- Deploy the server to EC2 using
yarn run deploy-server
script - Deploy the UI to S3 using
yarn run deploy-ui
script - Set up staging and production environments for server
- Set up staging and production environments for UI
Use the knowledge and code from this repo to build out the Bitcoin payments system in future apps, such as Transaction Broker app, and Digital Credit app.
Start Node.js server on port 3000
with nodemon
, server restarts on save:
yarn run start-server
Start UI on port 3001
with hot reloading (created with create-react-app
):
yarn run start-ui
Test the server:
yarn run test-server
Test the UI in interactive mode with:
yarn run test-ui
Test the UI once, useful when running tests from an automation:
CI=true yarn run test-ui
Build the server to /dist
:
yarn run build-server
Build the UI to /build
:
yarn run build-ui
Use the following:
- AWS Route 53 for the domain
- AWS EC2 for the server
- AWS S3 for the UI (using static web hosting for the S3 bucket)
Push all code updates via aws-cli
in deploy-server
and deploy-ui
scripts.
Deploy server:
N/A - Will be `yarn run deploy-server`
Deploy UI:
N/A - Will be `yarn run deploy-ui`