An enterprise-grade procurement ERP system that manages the complete Procure-to-Pay lifecycle: Vendor Registration β RFQ β Quotation β Evaluation β Approval β Purchase Order β Invoice β Payment Tracking β Analytics.
Backend:
- Node.js with NestJS Framework
- MySQL 8.x Database
- Prisma ORM
- JWT Authentication
- bcrypt for password hashing
Frontend:
- React.js + TypeScript
- Material UI (MUI)
- Tailwind CSS
- React Hook Form + Zod
- Redux Toolkit
- Recharts for analytics
- Axios for API calls
- Node.js (v18 or higher)
- MySQL 8.x
- npm or yarn
cd vendorBridgeNavigate to the backend directory:
cd backendInstall dependencies:
npm installConfigure environment variables:
cp .env.example .envEdit .env file with your configuration:
# Database
DATABASE_URL="mysql://root:password@localhost:3306/vendorbridge"
# JWT
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
JWT_ACCESS_TOKEN_EXPIRATION=15m
JWT_REFRESH_TOKEN_EXPIRATION=7d
# Server
PORT=3000
NODE_ENV=development
# Email (optional - for invoice emails)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASSWORD=your-app-password
SMTP_FROM=VendorBridge ERP <noreply@vendorbridge.com>
# Frontend URL
FRONTEND_URL=http://localhost:5173
# Approval SLA (in days)
APPROVAL_SLA_DAYS=3Generate Prisma Client:
npx prisma generateRun database migrations:
npx prisma migrate dev --name initStart the backend server:
npm run start:devThe backend will run on http://localhost:3000
Navigate to the frontend directory (in a new terminal):
cd frontendInstall dependencies:
npm installStart the frontend development server:
npm run devThe frontend will run on http://localhost:5173
The database includes the following main entities:
- Users - System users with role-based access (Admin, Procurement Officer, Vendor, Manager)
- Vendors - Vendor profiles with GST validation and rating system
- RFQ - Request for Quotation with status workflow
- Quotations - Vendor quotations with automatic calculations
- Approvals - Multi-level approval workflow with SLA
- Purchase Orders - PO generation from approved quotations
- Invoices - Invoice generation with PDF support
- Activity Logs - Complete audit trail
- Notifications - System notifications
The system uses JWT-based authentication with the following features:
- Password hashing with bcrypt
- Access tokens (15 minutes expiration)
- Role-based access control (RBAC)
- Protected routes with guards
- ADMIN - Full system access, user management
- PROCUREMENT_OFFICER - Create RFQ, manage vendors, generate PO
- VENDOR - View RFQ, submit quotations
- MANAGER - Approve/reject quotations
- GST validation (format: 22AAAAA0000A1Z5)
- Vendor rating formula: (Delivery Γ 40%) + (Quality Γ 40%) + (Response Γ 20%)
- Vendor status management (ACTIVE, INACTIVE, BLOCKED)
- Auto-generated RFQ numbers: RFQ-{YEAR}-{SEQUENCE}
- Status workflow: DRAFT β PUBLISHED β QUOTATION_RECEIVED β UNDER_REVIEW β CLOSED
- Validation before publishing (items required, vendors assigned, deadline valid)
- Automatic calculations (subtotal, discount, tax, grand total)
- Quotation comparison with scoring
- Status tracking (DRAFT β SUBMITTED β ACCEPTED/REJECTED)
- Multi-level approval based on PO value:
- Below βΉ50,000: Single approval
- βΉ50,000 - βΉ5,00,000: Manager approval
- Above βΉ5,00,000: Manager + Admin approval
- SLA tracking (configurable days)
- Approval deadline calculation
- PO generation only after approval
- Auto-generated PO numbers: PO-{YEAR}-{SEQUENCE}
- Status tracking: CREATED β SENT β ACCEPTED β DELIVERED β CLOSED
- Invoice generation from PO
- Auto-generated invoice numbers: INV-{YEAR}-{SEQUENCE}
- GST calculation
- PDF generation (to be implemented)
- Email integration (to be implemented)
- Vendor reports
- Purchase reports
- Invoice reports
- Spend analysis
- Export to Excel/PDF (to be implemented)
- Complete audit trail for all actions
- User, action, entity, timestamp tracking
- Old value/new value comparison
POST /api/auth/login- User loginPOST /api/auth/register- User registrationGET /api/auth/profile- Get current user profile
GET /api/users- List all users (Admin only)GET /api/users/:id- Get user by IDPOST /api/users- Create user (Admin only)PUT /api/users/:id- Update user (Admin only)DELETE /api/users/:id- Delete user (Admin only)
GET /api/vendors- List all vendorsGET /api/vendors/:id- Get vendor by IDPOST /api/vendors- Create vendorPUT /api/vendors/:id- Update vendorDELETE /api/vendors/:id- Delete vendor (Admin only)
GET /api/rfq- List all RFQsGET /api/rfq/:id- Get RFQ by IDPOST /api/rfq- Create RFQPUT /api/rfq/:id- Update RFQPOST /api/rfq/:id/publish- Publish RFQDELETE /api/rfq/:id- Delete RFQ
GET /api/quotation- List all quotationsGET /api/quotation/rfq/:rfqId- Get quotations by RFQGET /api/quotation/:id- Get quotation by IDPOST /api/quotation- Create quotation (Vendor only)PUT /api/quotation/:id- Update quotation (Vendor only)POST /api/quotation/:id/submit- Submit quotation (Vendor only)
GET /api/approval- List all approvalsGET /api/approval/pending- List pending approvalsGET /api/approval/:id- Get approval by IDPOST /api/approval/:id/approve- Approve quotationPOST /api/approval/:id/reject- Reject quotation
GET /api/po- List all POsGET /api/po/:id- Get PO by IDPOST /api/po/quotation/:quotationId- Create PO from quotationPOST /api/po/:id/send- Send PO to vendor
GET /api/invoice- List all invoicesGET /api/invoice/:id- Get invoice by IDPOST /api/invoice/po/:poId- Create invoice from POPOST /api/invoice/:id/send- Send invoicePOST /api/invoice/:id/mark-paid- Mark invoice as paid
GET /api/reports/vendor- Vendor reportGET /api/reports/purchase- Purchase reportGET /api/reports/invoice- Invoice reportGET /api/reports/spend-analysis- Spend analysis
GET /api/audit- List all activity logs (Admin only)GET /api/audit/entity/:entity/:entityId- Get logs by entityGET /api/audit/user/:userId- Get logs by user
npm run start:dev # Start in development mode
npm run build # Build for production
npm run start:prod # Start production server
npm run lint # Run ESLint
npm run test # Run tests
npm run prisma:generate # Generate Prisma client
npm run prisma:migrate # Run database migrations
npm run prisma:studio # Open Prisma Studionpm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLintRun backend tests:
cd backend
npm run testRun e2e tests:
cd backend
npm run test:e2e- The lint errors shown in the IDE are expected until npm packages are installed
- Run
npx prisma generateafter installing dependencies to resolve Prisma-related errors - The frontend implementation is pending and will be added in the next phase
- PDF generation and email integration for invoices are marked as TODO in the code
- Security features (rate limiting, input sanitization) need to be implemented
This is a comprehensive ERP system following SOLID principles, Clean Code, DRY, and the Repository Pattern.
UNLICENSED - Private project