- Introduction
- π Key Features & Modules
- ποΈ Architecture & Flow
- π₯ Role-Based Access Control (RBAC)
- β‘ Quick Start Guide
- π οΈ Setup Command Cheat-Sheet
- β° Real-Time & Automation Systems
- π Directory Structure
- π¨ Troubleshooting & FAQ
- π Developer Documentation Links
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.
- 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.
- 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.
- 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, andRetired.
- 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.
- 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βResolvedwith verification logs.
- 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.
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
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 |
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)
-
Navigate to the Backend Directory:
cd backend -
Install Dependencies:
npm install --legacy-peer-deps
-
Configure Environment Variables: Create a
.envfile in thebackend/directory (you can copy.env.exampleas a template):cp .env.example .env
Modify the
DATABASE_URLstring inside.envto match your local MySQL username and password:DATABASE_URL="mysql://YOUR_USER:YOUR_PASSWORD@localhost:3306/assetflow" -
Initialize Database & Apply Migrations: Run Prisma migrations to create the database schema:
npx prisma migrate dev --name init
-
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)
- π Admin:
-
Start the Development Server:
npm run dev
The backend API will run on
http://localhost:5000.
-
Navigate to the Frontend Directory:
cd ../frontend -
Install Dependencies:
npm install --legacy-peer-deps
-
Start the Vite Dev Server:
npm run dev
The application dashboard will boot and become accessible on
http://localhost:5173.
| 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 |
- 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
Overdueand trigger notifications to managers. - Transitions bookings from
UpcomingtoOngoingand completes them at their end-times.
- Flag active allocations past expected return date as
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
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/.
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.
Tip
Because of version boundaries on testing libraries under TypeScript 7, always install using npm install --legacy-peer-deps.
Tip
Run npx prisma generate in the backend/ directory to rebuild type-definitions for the client database client wrapper.
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
