Simple Inventory Management System provides a way to simply manage inventory levels in multiple distribution centers.
There are three main resources:
- Products: A unique type of an item, such as a Toyota Corolla or iPhone 6s gold model A1634.
- Distribution Centers: Physical places that stores inventory.
- Inventory: An inventory item represents a specific product in a specific distribution center. For example, an inventory item might contain the information on how many Toyota Corollas are available and reserved at the Japan distribution center.
Verb | URI Pattern | Description |
---|---|---|
GET | /products | List all products. |
GET | /products/:id | Get the info for the product with the specified id. |
GET | /distribution_centers | List all distribution centers |
GET | /distribution_centers/:id | Get the info for the distribution center with the specified id. |
GET | /distribution_centers/:distribution_center_id/inventory/report | Report displaying the current stock on hand and current pending shipped inventory in json format. (This is a shortcut to report_as_json URI below.) |
GET | /distribution_centers/:distribution_center_id/inventory/report_as_json | Report displaying the current stock on hand and current pending shipped inventory in json format. |
GET | /distribution_centers/:distribution_center_id/inventory/report_as_csv | Report displaying the current stock on hand and current pending shipped inventory in csv format. |
GET | /distribution_centers/:distribution_center_id/inventory | List all inventory |
GET | /distribution_centers/:distribution_center_id/inventory/:id | Get info for inventory item specified by id. |
PATCH | /distribution_centers/:distribution_center_id/inventory/:id/add_to_available_amount | Add to the current stock on-hand for the specified inventory item. |
PATCH | /distribution_centers/:distribution_center_id/inventory/:id/remove_from_available_amount | Remove from the current stock on-hand for the specified inventory item. |
PATCH | /distribution_centers/:distribution_center_id/inventory/:id/reserve | Reserve some or all of the available on-hand stock for the specified inventory item. |
PATCH | /distribution_centers/:distribution_center_id/inventory/:id/move_reserved_back_to_available | Move reserved stock back to available/on-hand stock for the specified inventory item. |
PATCH | /distribution_centers/:distribution_center_id/inventory/:id/remove_reserved | Remove reserved stock (such as due to it being shipped out) for the specified inventory item. |
Follow the guide here to install Ruby on Rails for your chosen OS
- Clone repository.
git clone https://github.com/appaulo14/simple-inventory-management-system.git
- cd to the newly cloned repository.
cd simple-inventory-management-system
- Install the gems for the application.
bundle install
- Create the database.
rails db:migrate
rails db:migrate RAILS_ENV=test
- Generate the seed data.
rails db:seed
- Confirm tests pass.
rails spec
- Start the server in development mode.
rails s
For production deployment, Ruby on Rails is commonly deployed to a cloud provider such as Amazon Web Services (AWS) or Microsoft Azure for improved scalability, availability, cost, deployment time, and many other benefits.
Below are two guides for deploy on AWS and Azure respectively:
- Creating and Deploying Ruby Applications on AWS Elastic Beanstalk
- Build a Ruby and Postgres web app in Azure App Service on Linux
One tool that can be used to measure the performance and do load testing of the deployed web application is httperf. This should be run on a deployment as similar as possible to the production environment but not on the production environment itself. See Performance Testing With httperf for more best practices and tips.
- AWS Web Hosting Best Practices
- AWS Cloud best practices
- AWS guidelines for both horizontally and vertically scaling relational database
- AWS Cloud Architecture Guidelines in 5 Pillars (Operational Excellence, Security, Reliability, Performance Efficiency, Cost Optimization)
- More race-condition/load/stress testing.
- Add more validation for the amount attribute to the app/api_model/inventory/* classes as a first line of defense. The existing database constraints are the last line of defense.
- Switch from SQLite to a more production-ready data such as PostgreSQL or MySQL and tune settings/indexes appropriately.
- Batch update to reduce the number of requests against the server.
- Look for ways to optimize queries more.
- Look for more shared test code to move into shared_examples.rb files.
- Authentication/Authentication
- Allow client to filter and pagination results.
- Allow inventory to be referenced by distribution-center-specific ids.
- Addition/update/deletion of products/distribution centers/inventory items as needed.
- Move this list to the Issues section of this GitHub repo.