material_inward

Material Inward Register

Ready-to-run single-page web application for recording material inward entries with image uploads, MySQL storage, automatic inward numbers, role-based access, admin search, image viewing, and Excel-friendly export.

Requirements

Setup

  1. Create the database and table:
SOURCE database.sql;

Or run database.sql from your MySQL client after opening this folder.

  1. Install dependencies:
npm install
  1. Create .env from the example and update your MySQL credentials:
copy .env.example .env
  1. Start the app:
npm start
  1. Open:
http://localhost:3000/register

Admin records:

http://localhost:3000/admin

Files

Roles

Admin records show every submitted record by default. Use the Filled By Name search field to filter entries by the staff member who submitted them.

The server automatically adds created_by_role and created_by_name columns to an existing material_inward_register table if they are missing.

API

Inward numbers are generated per year in this format:

MIR-2026-0001

Deploy as a Separate Subdomain

This application is a Node.js + MySQL app. It cannot be hosted as a static GitHub Pages page because it needs the Express backend, file uploads, and MySQL database.

Example target:

https://material.yourdomain.com/register
https://material.yourdomain.com/admin

1. Prepare Server

Use a VPS, cloud server, cPanel Node.js app, Render/Railway/DigitalOcean, or any host that supports:

2. DNS

Create a DNS record for your subdomain:

Type: A
Name: material
Value: your-server-public-ip

If your hosting provider gives a hostname instead of an IP, use CNAME:

Type: CNAME
Name: material
Value: your-host-provider-domain

3. Production Env

Copy the production env example:

cp .env.production.example .env

Update:

DB_HOST
DB_USER
DB_PASSWORD
DB_NAME
PORT

4. Install and Create Database

npm install --omit=dev
mysql -u root -p < database.sql

5. Run with PM2

npm install -g pm2
pm2 start ecosystem.config.cjs
pm2 save
pm2 startup

6. Nginx Subdomain Proxy

Use the template:

deploy/nginx-subdomain.conf

Replace:

material.yourdomain.com

with your real subdomain, then reload Nginx.

7. HTTPS

Use SSL on the subdomain. Camera capture from mobile browsers commonly requires HTTPS unless you are on localhost.

With Certbot/Nginx:

certbot --nginx -d material.yourdomain.com

Final URLs

Security entry screen:

https://material.yourdomain.com/register

Admin records screen:

https://material.yourdomain.com/admin