The Opbeans inventory management system is a demo app created and maintained by Elastic.
This application uses the following technologies:
- Node.js
- Express
- PostgreSQL
- Redis
- React (via opbeans-frontend)
- React Router (via opbeans-frontend)
- Redux (via opbeans-frontend)
- Elastic APM
Setup the following environment variables:
NODE_ENV
- The current Node environment (set toproduction
to enable Elastic APM)PORT
- The port at which to run the Opbeans server (default:3000
)PGHOST
- PostgreSQL server hostPGPORT
- PostgreSQL server portPGUSER
- PostgreSQL database usernamePGPASSWORD
- PostgreSQL database passwordPGDATABASE
- PostgreSQL database name (default:opbeans
)ELASTIC_APM_SERVICE_NAME
- Elastic APM service name for the server app (default:opbeans-node
)ELASTIC_APM_SERVER_URL
- APM Server URL (default:http://localhost:8200
)ELASTIC_APM_JS_BASE_SERVER_URL
- Elastic APM Server URL for the client app (default:http://localhost:3000
)ELASTIC_APM_JS_BASE_SERVICE_NAME
- Elastic APM App Name for the client app (defaults toname
from opbeans-frontend package.json fileELASTIC_APM_JS_BASE_SERVICE_VERSION
- Elastic APM App Name for the client app (defaults toversion
from opbeans-frontend package.json file
For a complete list of Elastic APM agent environment variables, see the offical documentation
For a complete list of PostgreSQL environment variables see the official documentation.
In development, you can create a .env
file in the root of the project
containing all your secret environment variables. See
dotenv for details.
Populate the database with tables and basic data:
npm run db-setup
Generate random orders:
node db/generate_orders.js <num>
Where <num>
is the amount of orders to create.
npm start
If NODE_ENV
isn't production
, running npm install
will also clone,
install and build [opbeats-frontend]. If you ever want to update the
opbeans-frontend, just run:
npm run client-update
The app have a built-in bug that you can trigger by navigating to the
path /is-it-coffee-time
.
The app have two npm scripts for adding a new customer:
customer-add-ok
, which will add a new customercustomer-add-redos
, which fail adding a new customer and block the server from processing any other requests in the meantime.
Run either of the two scripts using npm run <name>
.
If running inside docker, you can run it using docker-compose
, e.g:
docker-compose exec opbeans-node npm run customer-add-redos
MIT
Made with