Contrib is a site that enabled auctions for memorabilia. In 2023 the team decided to shut the service down and open source the code.
This code is provided as is and is not supported by the team
If you would like to contribute to the project please read the Contributing document. Contrib was built with the following features:
passport.js
for twitter, facebook, and googleWhen using a mono repo you will want to install the dependencies for the entire repo. To do this you will want to run the following command: yarn
This will install all dependencies for the entire repo. This will also install the dependencies for the app
and api
as well.
Once you have installed the dependencies you can run the following commands: yarn start
This will start the app
on port 3000 and api
on 3001 in development mode. You can also run the following commands: yarn start:app
This will start the app
on port 3000 in development mode. yarn start:api
This will start the api
on port 3001 in development mode.
To build contrib for production you will want to run the following commands:
Install all dependencies: yarn
Build the app and api: yarn build
This will build the app
and place the static files in the packages/app/dist
directory. It will also build the api
and place it in the packages/api/dist
directory.
Build the Docker Container for API: yarn docker:build
At this point you can deploy the app
to any static cloud host and then deploy the api
to any cloud host that supports docker.
The mono repo is built using yarn
and there are easy scripts in the base package.json
to help with development and build.
yarn test
- this will test the app
and api
yarn build
- this will build the app
and api
yarn docker:build
- this will build the api
in a docker containeryarn docker:run
- this will run the api
in a docker containeryarn start
- this will start the app
on port 3000 and api
on 3001 in development modeyarn start:app
- this will start the app
on port 3000 in development modeyarn start:api
- this will start the api
on port 3001 in development modeThe API is the brains in this system and all major business logic is handled here. The API is a standard nodejs application and can be built and served with the following ENV variables:
docker build --rm --pull -f "./Dockerfile" -t "contrib:latest" "./"
docker run --rm -d -p 3000:3000/tcp contrib:latest
The app is a standard react application and can be built and served statically with only one ENV
variable provided which is REACT_APP_API_URL={YOUR_API_URL}
.
Commands to build:
yarn && yarn build
This will build the app
and place the static files in the packages/app/dist
directory. It will also build the api
and place it in the packages/api/dist
directory.
You can do this on any static hosting service such as Netlify
, Vercel
, AWS S3
, Firebase
, Cloudflare
, etc.
To deliver auction winnings, we use UPS service.
You can find all the necessary information about UPS for development here: https://www.ups.com/upsdeveloperkit?loc=en_US
.
To authenticate users, we use the PassportJs library. We use 3 authentication strategies: Google, Facebook, Twitter.
To configure each of them to work correctly, you need to take the following steps:
https://{YOUR_APP_URL}
, https://{YOUR_APP_URL}/api/v1/auth/google/callback
.http://www.passportjs.org/packages/passport-google-oauth20/
https://{YOUR_APP_URL}/api/v1/auth/facebook/callback
.http://www.passportjs.org/packages/passport-facebook/
https://{YOUR_APP_URL}/api/v1/auth/twitter/callback
.http://www.passportjs.org/packages/passport-twitter/
https://stripe.com/
Developers/Webhooks
sectionAdd endpoint
in Endpoints receiving events from Connect applications
sectionAdd endpoint
in Endpoints receiving events from your account
Events to send
section or press button receive all events
Add endpoint
Sign in secret
sectionNow webhook added and registered on Stripe side. On server side add new evn var with value from Sign in secret
section.
This value will be used to check webhook signature when event will be received.
Every webhook will have personal sign in secret, so for every new webhook will require personal env var with defined secret value
Go to Google Cloud Scheduler: https://console.cloud.google.com/cloudscheduler and create follow jobs:
Name | Description | Frequency | Timezone | Target type | URL | HTTP method | HTTP headers | Body |
---|---|---|---|---|---|---|---|---|
contrib-auction-settle | end auctions (change status to SETTLED) | * | America/Los_Angeles | HTTP | https://`{YOUR_API_URL}`/api/v1/auctions-settle | POST | Content-Type: application/json | { "key": "OUR_SECRET_KEY" } |
contrib-notify-auction-end | send notifications | * | America/Los_Angeles | HTTP | https://`{YOUR_API_URL}`/api/v1/auctions-ends-notify | POST | Content-Type: application/json | { "key": "OUR_SECRET_KEY" } |