Skip to content

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

25 Commits

Folders and files

Repository files navigation

AssetFlow β€” Enterprise Asset & Resource Management ERP

AssetFlow Banner

Node.js Badge React Badge TypeScript Badge Prisma Badge Socket.io Badge Tailwind CSS Badge


πŸ“– Table of Contents

  1. Introduction
  2. 🌟 Key Features & Modules
  3. πŸ—οΈ Architecture & Flow
  4. πŸ‘₯ Role-Based Access Control (RBAC)
  5. ⚑ Quick Start Guide
  6. πŸ› οΈ Setup Command Cheat-Sheet
  7. ⏰ Real-Time & Automation Systems
  8. πŸ“‚ Directory Structure
  9. 🚨 Troubleshooting & FAQ
  10. πŸ“š Developer Documentation Links

πŸš€ Introduction

AssetFlow is an enterprise-grade, multi-tenant, role-based ERP system designed to govern the entire lifecycle of corporate physical assets and resources. From real-time room bookings to deep-level department hierarchy setups, sequential barcode tagging, automated maintenance workflows, and rigorous audit locking mechanisms, AssetFlow provides a single source of truth for organizational resource allocation.

Note

AssetFlow was built with performance and security at its core. It leverages MariaDB/MySQL connection pooling, Redis caching for dashboard metrics, and JWT session isolation.


🌟 Key Features & Modules

🏒 1. Tenant & Organization Setup

  • Hierarchical Departments: Construct complex organizational trees with parent-child department relations.
  • Department Heads: Map managers directly to specific units, automatically driving approval chains.
  • Tenant Isolation: Fully isolated data spaces secure multi-tenant deployments.

🏷️ 2. Smart Asset Registry

  • Barcode Tagging: Generate unique, sequential asset tags (ACME-COMP-0001) upon creation.
  • Custom Attributes: Extend asset categories with dynamic JSON schemas (e.g., storage size, warranty date).
  • Search & Filters: Real-time paginated grid containing advanced condition, location, and owner filter tags.

πŸ”„ 3. Allocation & Lifecycle Manager

  • Checkout/Returns: Manage allocations to single employees or entire departments with strict expected return checking.
  • Inter-Department Transfers: Route assets smoothly across units with built-in audit trails.
  • Lifecycle States: Automated transitions through Draft, Active, Under Maintenance, Audited, and Retired.

πŸ“… 4. Conflict-Preventing Resource Booking

  • Real-time Scheduling: Schedule shared office resources, boardrooms, and testing hardware.
  • Overlapping Check: Backend validation prevents double bookings on same-time slots.
  • Auto-Transitions: Cron transitions bookings dynamically from Upcoming βž” Ongoing βž” Completed.

πŸ”§ 5. Maintenance Ticket System

  • Broken Asset Reporting: Employees can file issues directly from their accounts.
  • Technician Routing: Route repairs to specific technicians based on asset category.
  • State Machine Flow: Manages state changes from Reported βž” In Progress βž” Resolved with verification logs.

πŸ” 6. Rigorous System-Wide Audits

  • Audit Cycles: Initiate department-wide or category-specific audits.
  • Auditor Assignment: Direct allocation of dedicated auditors to verifying cycles.
  • State-Locking: Lock audited records to prevent tamper-prone edits while generating automatic mismatch reports.

πŸ—οΈ Architecture & Flow

AssetFlow utilizes a decoupled, modern architecture designed for maximum performance, horizontal scalability, and zero-conflict multi-user operations.

flowchart TD
    subgraph Client [Frontend - React Portal]
        UI[Tailwind UI / Zustand State]
        SocketClient[Socket.IO Client]
        HTTPClient[Axios Client]
    end

    subgraph API [Backend Gateway - Express Node.js]
        Router[HTTP Router / Zod Validation]
        Middleware[Auth JWT / RBAC Middleware]
        Service[Domain Services & State Machines]
        SocketServer[Socket.IO Real-time Rooms]
        Cron[Scheduled Cron Jobs]
    end

    subgraph Data [Storage Layer]
        Prisma[Prisma ORM]
        DB[(MySQL 8.0 Database)]
    end

    HTTPClient -->|REST Requests| Router
    Router --> Middleware
    Middleware --> Service
    Service --> Prisma
    Prisma --> DB
    
    SocketClient <-->|Bi-directional JWT Handshake| SocketServer
    SocketServer --> Service
    Cron -->|State Transitions & Alert Triggers| Service
Loading

πŸ‘₯ Role-Based Access Control (RBAC)

The application enforces fine-grained access checks across four main user roles:

Privilege Admin Asset Manager Department Head Employee
Manage Org / Hierarchies ⚑ Yes ❌ No ❌ No ❌ No
Create & Barcode Assets ⚑ Yes ⚑ Yes ❌ No ❌ No
Approve Transfers/Allocations ⚑ Yes ⚑ Yes πŸ’Ό Dept Only ❌ No
Trigger System Audits ⚑ Yes ⚑ Yes ❌ No ❌ No
Create Maintenance Requests ⚑ Yes ⚑ Yes ⚑ Yes ⚑ Yes
Reserve Shared Resources ⚑ Yes ⚑ Yes ⚑ Yes ⚑ Yes
Generate & Export Reports ⚑ Yes ⚑ Yes πŸ’Ό Dept Only ❌ No

⚑ Quick Start Guide

1. Prerequisites

Ensure you have the following installed on your machine:

  • Node.js (v18.0.0 or higher)
  • npm (v9.0.0 or higher)
  • MySQL / MariaDB (v8.0 or higher, running locally on port 3306)

2. Backend Setup

  1. Navigate to the Backend Directory:

    cd backend
  2. Install Dependencies:

    npm install --legacy-peer-deps
  3. Configure Environment Variables: Create a .env file in the backend/ directory (you can copy .env.example as a template):

    cp .env.example .env

    Modify the DATABASE_URL string inside .env to match your local MySQL username and password:

    DATABASE_URL="mysql://YOUR_USER:YOUR_PASSWORD@localhost:3306/assetflow"
    
  4. Initialize Database & Apply Migrations: Run Prisma migrations to create the database schema:

    npx prisma migrate dev --name init
  5. Seed the Database: Populate the database with departments, default categories, assets, and role-based test users:

    npx prisma db seed

    [!IMPORTANT]
    Default Seeded Credentials (All passwords are <Role>@123):

    • πŸ”‘ Admin: admin@acme.com (password: Admin@123)
    • πŸ”‘ Asset Manager: manager@acme.com (password: Manager@123)
    • πŸ”‘ Department Head: head@acme.com (password: Head@123)
    • πŸ”‘ Employee: employee@acme.com (password: Employee@123)
    • πŸ”‘ Employee 2: raj@acme.com (password: Employee@123)
  6. Start the Development Server:

    npm run dev

    The backend API will run on http://localhost:5000.


3. Frontend Setup

  1. Navigate to the Frontend Directory:

    cd ../frontend
  2. Install Dependencies:

    npm install --legacy-peer-deps
  3. Start the Vite Dev Server:

    npm run dev

    The application dashboard will boot and become accessible on http://localhost:5173.


πŸ› οΈ Setup Command Cheat-Sheet

Context Action Command
Backend Dependency Install npm install --legacy-peer-deps
Backend Run Database Migrations npx prisma migrate dev --name init
Backend Generate Client Models npx prisma generate
Backend Run DB Seed Script npx prisma db seed
Backend Start Dev Server npm run dev
Backend Run Jest Tests npx jest
Frontend Dependency Install npm install --legacy-peer-deps
Frontend Start Vite Client npm run dev
Frontend Check Lints npm run lint
Frontend Compile Production Build npm run build

⏰ Real-Time & Automation Systems

  • WebSocket Event Architecture: Socket.IO handles live updates. During authentication, clients join specialized organizational rooms (org_<id>), role rooms (org_<id>_<role_name>), and custom user channels (user_<id>) to receive instant push alerts.
  • Automated Cron Engine: A background runner sweeps the active databases every 5 minutes in development to:
    • Flag active allocations past expected return date as Overdue and trigger notifications to managers.
    • Transitions bookings from Upcoming to Ongoing and completes them at their end-times.

πŸ“‚ Directory Structure

AssetFlow/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ prisma/             # Schema definitions, seed scripts, migrations
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ config/         # Environment parser and config definitions
β”‚   β”‚   β”œβ”€β”€ middleware/     # JWT authentication, error handling, rate limiting
β”‚   β”‚   β”œβ”€β”€ modules/        # Modular domain-driven backend modules
β”‚   β”‚   └── utils/          # Socket instances, database clients, cron setup
β”‚   └── package.json        # Node script actions and dependencies
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/     # UI elements (buttons, forms, modals, search bars)
β”‚   β”‚   β”œβ”€β”€ pages/          # Complete dashboard pages (Registry, Audits, Bookings)
β”‚   β”‚   β”œβ”€β”€ store/          # Zustand global states (auth, notification hubs)
β”‚   β”‚   └── main.tsx        # App initialization & Routing rules
β”‚   └── package.json        # Frontend bundler settings and libraries
β”‚
└── docs/                   # Additional documentation & system specifications

🚨 Troubleshooting & FAQ

Q: I get Error: DATABASE_URL environment variable is not defined. when running seeds or starting the server.

Tip

Ensure you have copied .env.example to .env in the backend/ directory, and that the file is populated. If you are running commands in nested subdirectories, verify the current working directory is backend/.

Q: The compiler complains about missing Jest symbols (e.g. jest is not defined).

Tip

This happens when types are not mapped globally. Make sure your backend/tsconfig.json contains "types": ["jest", "node"] under compiler options. We have already updated this in the main repository config.

Q: npm install throws resolving peer conflicts for typescript or jest.

Tip

Because of version boundaries on testing libraries under TypeScript 7, always install using npm install --legacy-peer-deps.

Q: How do I rebuild the Prisma Client after database modifications?

Tip

Run npx prisma generate in the backend/ directory to rebuild type-definitions for the client database client wrapper.


πŸ“š Developer Documentation Links

For deeper technical blueprints, query structures, and mockups, explore our dedicated documentation resources:

  • πŸ—ΊοΈ Architectural Design Blueprint β€” DDD layered directory standards and TypeScript interfaces.
  • πŸ—„οΈ Database Architecture & Schema ERD β€” Relational tables, triggers, and state machine transitions.
  • πŸ”Œ API Reference Documentation β€” REST API routing endpoints, payload examples, and responses.
  • πŸ§ͺ Testing Framework Guide β€” Testing flows, mocks, and coverage configurations.

Made with ❀️ for the Odoo Hackathon 2026

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages