This is the monorepo for the reference implementation of the Open Product Recovery standards. Open Product Recovery is a collection of standards and implementations designed to facilitate sharing of excess products with charitable (and secondary market) organizations.
Open Product Recovery is a specification for describing and communicating about excess food (and other donatable products). OPR servers can publish offers of donatable products to other OPR servers, and every OPR server hosts a public REST API to allow other organizations to accept those offers.
Yes! If:
- Your organization generates enough donatable products that you need a way to automatically tell charitable organizations that you have donations for them.
- Or, your charitable organization needs to receive enough donatable products that you need a way to automatically discover donations.
Ideally, your organization already has an inventory system that tracks the donations you work with. OPR has a flexible plugin system that allows it to read and write offers to and from just about any storage system with an API.
This repository contains a number of nodejs projects that work together to implement the OPR specification. Please read the README file in each of the subdirectories to find out more about the libraries in each component.
Join the discussion at http://chat.opr.dev/ for support.
We recommend Node versions >=18.x, due to compatability issues with Lerna.
First, run the setup script to install packages and compile the workspaces. Note that there are a few known issues with the install process that the setup script is designed to overcome. We highly recommend you use this for your package installation and setup.
sh ./setup.sh
Run
npx lerna run test
from the root directory to run all the unit tests. If you want to run the Postgres tests in opr-sql-database, you need to have a working installation of Postgres and the initdb
, postgres
and psql
commands must be in your PATH
environment variable. If those commands aren't available, the Postgres tests will be skipped.
If you use VScode, install the devcontainer extention as well as docker desktop. VS code will helpfully ask if you'd like to re-open the project in a devcontainer, which should, after downloading and setting up a whole bunch of stuff, drop you right into a prompt that is ready to run npx lerna run test
This library is the reference implementation for the Open Product Recovery standards. You may want to read the standards docs before you dive into setting up your own server.
Check out the examples
folder for example working setups for various environments. A good place to start is the local-starter
folder. The local starter example uses an sqlite database and includes some special endpoints to help generate fake offers so that its easier to see common settings for a server and how they work.
Once you're fluent with the examples, learn more than you ever wanted to know about OPR extensibility in our Integrations Guide.