It's an example implementation of a two-sided marketplace, adapted for the US market.
This app was created as a part of an article Pay in, Pay out: How to Create a Marketplace
Dashboard
Unpaid Invoice
Card Payment
Processing Payment
Bank Account Details
Invoice Printout
Paid Invoice
Payout
Payout Printout
Using this simple web application, you can issue invoices to your clients as well as payouts to your vendors.
You can accept payments using:
- ACH credit bank transfers
- Wire bank transfers
- Credit and debit cards through Stripe
You can send payouts using:
- ACH credit bank transfers
- Wire bank transfers
Those types of transfers should be provided to you by your bank. You can also use other services, such as TransferWise.
You can see all transactions in a dashboard. You can also view there total transaction balance and sum of pay-ins and pay-outs.
Whenever you will create a new invoice or payout, the application will automatically send an email with information about it to a specified email address.
You can also just copy invoice or payout URL and send it to anyone, since they are available publically. Invoices and payouts can be easily printed with a printer button in a top-right corner.
Setup:
- Create an admin account
- Add Stripe API keys and bank account details
- Setup Stripe webhook as
http(s)://<your-domain>/api/v1/payment/stripe
Workflow:
- Create an invoice for a client
- Client will automatically receive an email about it. You can also manually send him a link to the invoice.
- Client can pay the invoice using bank transfer, debit or credit card.
- Create payout for a vendor
- Send payout manually using bank transfer
Example industries where it can be used:
- Accounting services
- Marketing services
- Construction services
- Cleaning services
- B2B businesses
- Car rentals
- House rentals
- Wholesalers
- Node.js + npm + Cluster
- TypeScript
- Express
- SCSS
- MongoDB
- Start MongoDB database
- Run
make install
- Copy
.env.example
to.env.dev
- Edit variables in
.env.dev
- Run
npm run start
- Open
http://localhost:3000
in a browser
- Start MongoDB database
- Run
make install
- Copy
.env.example
to.env.prod
- Edit variables in
.env.prod
- Set Stripe webhook on their website as
http(s)://<your-domain>/api/v1/payment/stripe
- Run
npm run start-prod
- Open your domain or server IP
make install-tools
make install
Configuration file depends on environment
Production: .env.prod
Development: .env.dev
Test: .env.test
Run all tests: npm run test-all
Run client tests: npm run test-client
Run server tests: npm run test-server
Client tests configuration is in karma.conf.js
gulp dev
gulp prod
make prod
gulp watch-all
gulp all
or
gulp ts
gulp scss
npm run format-code
Put all imports you want to use in imports.js
. Then simply run gulp dev
or gulp prod
.
In development mode you will get all your imports as separate entries so they will be easy to debug.
In production mode all your imports will be put together and minified into single .js and .css file so that they are as small and fast to load as possible.
Server side dependencies are in package.json
and are installed to node_modules
.
Client side dependencies are in client-libs/package.json
and are installed to client-libs/node_modules
.
Both client and server consist of modular structure. That means certain folder structure:
src
├── client
│ ├── app
│ └── elements
│ └──example-element
│ ├── assets
│ ├── scripts
│ └── styles
│
└── server
├── app
└── elements
Folders functions:
app
- Consist of main application, server or client. It basically wires all elements together.
elements
- Independent elements. It means that they don't depend on any other elements or application source code or asset. They can only depend on libraries used by the project. It makes them independent from this project, which means they can be reused in other applications by other people easily.
Created by Konrad Gadzinowski - kgadzinowski@gmail.com