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:
- Can easily scale to 1000s of auctions, customers, and influencers
- Non-profits have the ability to setup their own account and transaction fees are donated to the non-profit via stripe
- Influencers have their own profile and can upload and manage their auctions
- Influencers can post via the social networks with a short code url provided by contrib
- Auctions can be uploaded by the admin, or by the influencers
- Easy logon for all mobile users as the base profile is bound to the mobile number
- Because of the above, the user can easily change their profile picture and name
- Support for social logons via
passport.jsfor twitter, facebook, and google - Cloud Native by default using cloud services such as mongo atlas, stripe, sendgrid, and firebase, cloudflare (streaming), google cloud storage.
- Getting Started
- How to Deploy the App
- How to Deploy the API
- How to Set Up Cloud Services
- How to Contribute
- Code of Conduct
- License
When 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 theappandapiyarn build- this will build theappandapiyarn docker:build- this will build theapiin a docker containeryarn docker:run- this will run theapiin a docker containeryarn start- this will start theappon port 3000 andapion 3001 in development modeyarn start:app- this will start theappon port 3000 in development modeyarn start:api- this will start theapion port 3001 in development mode
The 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:
- Build:
docker build --rm --pull -f "./Dockerfile" -t "contrib:latest" "./" - Run:
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:
- Log in to the Google Cloud Platform.
- Select the your project.
- Add the following links to the Authorized JavaScript origins field:
https://{YOUR_APP_URL}, - Add the following links to the Authorized Redirect URIs field:
https://{YOUR_APP_URL}/api/v1/auth/google/callback. - Get Client ID and Client secret for GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET envs.
- Register Google Strategy as indicated on this page:
http://www.passportjs.org/packages/passport-google-oauth20/
- Log in to the Facebook Developers.
- Go to Facebook Login => Setting
- Add the following links to the Valid OAuth Redirect URI:
https://{YOUR_APP_URL}/api/v1/auth/facebook/callback. - Get App ID and App Secret for FACEBOOK_APP_ID and FACEBOOK_APP_ID envs on the Settings => Basic.
- Register Facebook Strategy as indicated on this page:
http://www.passportjs.org/packages/passport-facebook/
- Log in to the Twittet Application Management.
- Go to the Setting tab.
- Add the following links to the Callback URL:
https://{YOUR_APP_URL}/api/v1/auth/twitter/callback. - Go to the API Keys tab, there you will find your Consumer key and Consumer secret keys for TWITTER_CONSUMER_KEY and TWITTER_CONSUMER_SECRET envs.
- Register Twitter Strategy as indicated on this page:
http://www.passportjs.org/packages/passport-twitter/
- Sign in to Stripe
https://stripe.com/ - Go to
Developers/Webhookssection - If needs to receive events from customer's accounts connected to the Contrib's account - press
Add endpointinEndpoints receiving events from Connect applicationssection - If needs to receive event from personal account - press
Add endpointinEndpoints receiving events from your account - In the appeared window enter the URL which will receive Stripe events on the server
- Enter description
- Select several events in
Events to sendsection or press buttonreceive all events - Press
Add endpoint - Check the secret key in
Sign in secretsection
Now 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" } |