This is a full-stack Inventory Management System built for The Odin Project using Node.js, Express.js, PostgreSQL, and EJS in an MVC architecture. The application demonstrates server-side rendering, relational data modeling, form handling, and CRUD workflows for managing inventory categories and items.
The project is designed as a clean, portfolio-ready CRUD application with reusable views, structured database queries, and a responsive HTML/CSS interface.
- Category management with create, view, edit, and delete flows
- Item management with create, view, edit, and delete flows
- PostgreSQL-backed relational data model
- Foreign key relationship between items and categories
- Category delete protection when linked items still exist
- Dynamic server-rendered pages using EJS
- Reusable form templates for create and edit pages
- Shared layout partials for navigation and metadata
- Responsive UI with custom CSS only
- Clean homepage with quick actions and feature cards
- Database seed script that recreates schema and loads sample data
- MVC organization with routing, controllers, and query separation
- Parameterized SQL queries throughout the data layer
- Node.js
- Express.js
- MVC architecture
- PostgreSQL
- node-postgres (
pg) - Relational schema with foreign keys
- EJS templates
- HTML5
- CSS3
- npm
- Git
- PostgreSQL client/server
inventory-application/
ββ app.js
ββ package.json
ββ package-lock.json
ββ plan.txt
ββ test-db.js
ββ controllers/
β ββ categoryController.js
β ββ itemController.js
ββ db/
β ββ pool.js
β ββ populatedb.js
β ββ queries.js
ββ public/
β ββ styles.css
ββ routes/
β ββ categoryRouter.js
β ββ indexRouter.js
β ββ itemRouter.js
ββ views/
ββ index.ejs
ββ categories.ejs
ββ categoryDetails.ejs
ββ categoryForm.ejs
ββ deleteCategory.ejs
ββ deleteItem.ejs
ββ items.ejs
ββ itemDetails.ejs
ββ itemForm.ejs
ββ partials/
β ββ head.ejs
β ββ nav.ejs
ββ forms/
The application uses two related tables:
id: Primary keyname: Category namedescription: Category description
id: Primary keyname: Item namedescription: Item descriptionprice: Item pricequantity: Current stock quantitycategory_id: Foreign key referencingcategories.id
Each item belongs to exactly one category. The items.category_id column links each item to its parent category, which allows the application to display category names in item views and prevent category deletion while items still exist.
| Entity | Create | Read | Update | Delete |
|---|---|---|---|---|
| Categories | Yes | Yes | Yes | Yes |
| Items | Yes | Yes | Yes | Yes |
- Clone the repository and enter the project folder.
git clone <repository-url>
cd inventory-application- Install dependencies.
npm install- Configure PostgreSQL.
- Create a PostgreSQL database named
inventory_db. - Update the connection settings in
db/pool.jsso they match your local PostgreSQL credentials if needed.
- Seed the database.
node db/populatedb.js- Start the development server.
npm startYou can also run the app in watch mode during development:
npm run devOpen the application in your browser at http://localhost:3000.
- The Home page provides quick navigation to Categories and Items.
- The Categories section lets you create, inspect, edit, and delete categories.
- The Items section lets you create, inspect, edit, and delete items.
- Item forms use a category dropdown populated from the database.
- Category deletion is blocked when that category still has linked items.
- All pages include persistent navigation links for Home, Categories, and Items.
This project demonstrates practical experience with:
- Express.js routing and middleware
- PostgreSQL database design and querying
- SQL joins for relational data display
- Foreign keys and referential integrity
- MVC architecture and separation of concerns
- CRUD operations across multiple entities
- Server-side rendering with EJS
- REST-style resource routing
- Form handling with
POSTrequests - Reusable layout and partial templates
- Add authentication and session-based login
- Introduce user roles and permissions
- Add search and filtering for items and categories
- Add pagination for large inventories
- Support image uploads for items
- Expose a REST API alongside the server-rendered UI
- Containerize the app with Docker
- Add automated unit and integration tests
- Deploy to a cloud platform
This project is intended to be licensed under the MIT License.
Salman








