An open source node.js shopping cart (and ultimately an ecommerce system) service.
Phrixus utilizes the Volos API system for caching, quota, and oauth.
The Usergrid BaaS is used for backend storage.
The included modules can be deployed anywhere and used by a variety of ecommerce applications via a REST API, they may even optionally be deployed and executed in Apigee Edge.
Phrixus is intended to be a set of REST modules that may be integrated into a larger ecommerce solution. However, the quickest way to start playing with the system is to see the libraries integrated into an example web-based ecommerce app:
- copy app/config/development-sample.js to app/config/development.js ('development' is selected as default config)
- edit app/config/development.js to reflect your usergrid settings (and optionally, passport settings)
- install & start redis
- run
npm install
(this will link the Phrixus modules in this repo locally) - run
bin/create_sample_products
- run
bin/register
- run
node app/app.js
- check the output and open your browser to http://localhost:3000 (or start making curl requests)
- copy app/config/apigee-sample.js to app/config/apigee-{env}.js (where {env} is your apigee environment, ie. 'test')
- edit app/config/apigee-{env}.js to reflect your hosted usergrid settings (and optionally, passport settings)
- run
NODE_ENV=apigee-{env} bin/create_sample_products
- run
NODE_ENV=apigee-{env} bin/register
- run 'npm install' in the app directory
- use apigeetool to deploy the app directory
// todo: make registration and populate part of a deployment command line?
App configuration is done using a standard mechanism based on NODE_ENV.
- Maintain multiple carts associated to a customer id
- Maintain product line items associated to a cart
- Maintain a customer's active shopping cart
- Merge carts together (close cart, clone items and add to target cart)
- Close carts (maintain archive data forever)
- Maintain anonymous carts (associated to a session id)
- Assign an anonymous cart to a user
- Automatically close anonymous carts after a configurable inactivity period
- Require valid OAuth authentication and scope(s) for access to functionality
- Provide for post-oauth plugin for fine-grained access control of changes
- Emit state change events for all entities (integration & analytics)
- Store state changes for analytics
- Log all operations
API | Description |
---|---|
POST /carts | create a new cart |
PUT /carts/:id | update the cart |
GET /carts/?q='query' | retrieve a list of (open and closed) carts with optional Usergrid query. |
GET /carts/:id | retrieve a cart & associated line items by id or name |
DELETE /cart/:id?merge=:targetCartId | close the cart. merge is optional. on error during copy, cart will not be closed. cart may be unclosed by update: status = 'open' |
POST /carts/:id/items/:id { sku: '', quantity: 1, price: 99.99 } | add a cart line item |
PUT /carts/:id/items/:id { sku: '', quantity: 1, price: 99.99 } | update cart line item |
DELETE /carts/:id/items/:id | remove a cart line item |
API | Description |
---|---|
POST /my/carts | create a new cart |
PUT /my/carts/:id | update the cart |
GET /carts/?q='query' | retrieve a list of my open carts with optional Usergrid query. |
GET /my/carts/:id | retrieve one of my open carts & associated line items by id or name. |
DELETE /my/carts/:id?merge=:targetCartId | close the cart. merge is optional. on error during copy, cart will not be closed. cart may be unclosed by update: status = 'open' |
POST /my/carts/:id/items/:id { sku: '', quantity: 1, price: 99.99 } | add a cart line item |
PUT /my/carts/:id/items/:id { sku: '', quantity: 1, price: 99.99 } | update cart line item |
DELETE /my/carts/:id/items/:id | remove a cart line item |
Note: This is stub functionality that may be replaced by an existing user management system.
API | Description |
---|---|
POST /users { username: 'foo', password: 'foo' } | create a new user |
GET /users/?q='query' | retrieve a list of users with optional Usergrid query |
GET /user/:id | retrieve a user |
PUT /user/:id | update a user |
DELETE /user/:id | delete a user |