Skip to content
Itachi7011Public

About

Multi-tenant vendor and procurement management platform for managing suppliers, purchase orders, contracts, approvals, inventory, and procurement workflows.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Vendaris

Vendor / SaaS Dependency Monitoring Platform — tracks every SaaS tool a company depends on and alerts them to downtime, pricing changes, and security issues before those become a fire drill.

This is an investor-demo-ready prototype: real auth, a real (lightweight) monitoring engine hitting real public status APIs, and a working multi-tenant dashboard — not a static mockup.

Stack

  • Frontend: Next.js 14 (App Router), plain CSS (design tokens, no Tailwind), lucide-react icons, SweetAlert2, Socket.io client
  • Backend: Node.js + Express, MongoDB (Mongoose), JWT + httpOnly cookies, node-cron, Socket.io, SendGrid
  • Real integrations: GitHub Status API, Cloudflare Status API, AWS Health RSS feed — all public, no keys required
  • Everything else (Slack, Notion, custom tools, etc.) uses a generic HTTP status-page/homepage checker

Features

Advanced / enterprise-readiness features

  • Two-factor authentication (TOTP) — real QR-code setup with any authenticator app (Google Authenticator, Authy, 1Password, etc.), enforced at login. Not a checkbox that does nothing — verified against genuinely generated TOTP codes in testing.
  • Vendor risk scoring — every vendor gets an automatic Low/Medium/High risk score (0–100) computed from current status, recent check history, and alert volume, with human-readable factors explaining why — shown on the vendor list, vendor detail page, and as a distribution chart on Analytics.
  • Developer API — generate/revoke scoped API keys (shown once, only a hash is stored — same pattern as Stripe/GitHub) for a read-only public API (GET /api/public/v1/vendors), managed from a new Developers page with example curl usage.
  • Public shareable status page — any company can opt in to publish a read-only, branded status page at /public/status/[slug] showing vendor health to their own stakeholders — deliberately strips costs and internal contacts, only exposes name/category/status.
  • Configurable alert rules — per-user minimum severity threshold ("only notify me for warning and above") and per-vendor muting, enforced in the actual notification dispatch logic, not just UI settings that do nothing.

Analytics & dashboards (the centerpiece)

  • A dedicated Analytics page with 9 charts: uptime trend, alerts trend, alerts by type, alerts by severity, vendor category distribution, top vendors by cost, new vendors over time, average response latency trend, and vendor risk distribution — all backed by real time-bucketed aggregation, not static snapshots
  • Every time-series chart supports Today / This Week / This Month / This Year / Custom date range — selecting a range re-fetches real data from the backend and re-renders every chart
  • Several charts have a chart-type toggle (area vs. bar, line vs. bar, pie vs. bar) so the same data can be viewed multiple ways
  • The Overview dashboard also got a mini version of the trend charts (with its own time range selector) plus an onboarding checklist for brand-new companies with zero vendors
  • A parallel platform-wide Analytics page for admins — company/user/vendor growth over time, alert volume, top companies by vendor count, and status distribution across every tenant

Core monitoring

  • Multi-tenant vendor tracking with real status checks (GitHub, Cloudflare, AWS live integrations + generic URL checker for everything else)
  • Scheduled monitoring sweeps (node-cron) + on-demand "check now" per vendor or platform-wide
  • Downtime / recovery / degraded alerts, auto-generated and pushed live
  • Vendor CRUD is now complete — create, view, edit, and delete, both from the vendor list and the vendor detail page
  • Bulk CSV import (with a downloadable template) alongside CSV export — add your whole SaaS stack in one upload instead of one-by-one

Real-time

  • Live Socket.io connection from the dashboard — alerts appear as toast notifications the instant the monitoring worker detects a change, no refresh needed. Look for the "Live" indicator in the dashboard topbar.
  • Real notifications bell in the dashboard topbar with an unread count badge, live-updating as alerts come in over the socket connection — not just a full alerts page, but a persistent at-a-glance view
  • The admin panel's notification bell shows real recent admin activity (audit log entries), not placeholder data

Team & collaboration

  • Invite teammates by email (pending invite → email link → account creation)
  • Role-based team members (owner/member)
  • Per-company Slack webhook for alert delivery, in addition to email

Monetization

  • Plan-based limits (vendor count, team size) enforced server-side with upgrade prompts when a company hits its limit — the actual business model, not just UI copy
  • Bulk CSV import respects the same plan limits, stopping and reporting once the cap is hit rather than failing the whole batch

Financial visibility

  • Spend-by-category pie chart, monthly spend total, upcoming renewal reminders (auto-alert 14 days before a vendor renews)
  • CSV export of the full vendor list

Vendor detail & history

  • Per-vendor detail page with an uptime history chart, full check log, and inline editing
  • Search across vendors (navbar + dashboard)

Billing

  • A real Billing page (/dashboard/billing) showing current plan, live usage bars (vendors/team members against your plan's limits), and the full plan comparison — previously plan limits were enforced but there was nowhere in the app to actually see or manage them

Account & security

  • Change password, delete account (with cascading cleanup if you're the last person at your company)
  • Avatar and company logo upload via Cloudinary (previously configured but unused — now fully wired)
  • Notification preferences (toggle email alerts on/off) — the data model supported this from day one; there's now a real Settings UI for it
  • OTP email verification, password reset, account lockout after repeated failed logins — for both users and admins, with resend-code parity between the two flows (admin was previously missing this)

Polish

  • Dark mode toggle now available on every auth page (login, signup, verify-email, forgot/reset password, accept-invite), not just the navbar/dashboard
  • Real Terms of Service, Privacy Policy, Contact, Status, and Changelog pages — footer and navbar links no longer point to dead anchors (the feature dropdown in the navbar now links to real sections on the landing page, e.g. /#downtime, /#security)
  • The Status page genuinely pings the live backend's /api/health endpoint client-side — it's not a static "all green" mock

What's been tested (not just written)

This isn't just hand-written code — it's been run:

  • Backend: all modules load cleanly (require()), full unit tests on JWT tokens, validation middleware, password hashing, Mongoose schema validation/defaults/enums, plan-limits/error-formatting utilities, the CSV import parser, the entire analytics aggregation engine (date-range resolution, day-bucketing with zero-fill, time-series bucketing, admin aggregation pipelines with $lookup), and — new this round — genuine TOTP round-trips (a real code is generated with the same otplib algorithm an authenticator app would use, then verified — not mocked), API key generation/hashing/verification (including that a bogus key is correctly rejected and a malformed prefix is rejected without even querying the database), vendor risk scoring across five scenarios (healthy, down-with-alerts, unmonitored, extreme/clamped, and mid-range), and the public status page's privacy filtering (verified that the exact .select() field list used in the real controller genuinely excludes cost and owner-contact fields, not just that the test's fake data happened to look right). The full Express middleware/routing chain was tested with real HTTP requests (supertest) for every new endpoint — 2FA setup/verify, muted-vendors, API key CRUD, and the public API/status routes — confirming auth is enforced before any of them touch the database.
  • Frontend: a real next build passes cleanly — 39 routes, no errors, no warnings, ESLint clean. The production server was booted and the new Developers and public status-page routes were hit with real HTTP requests.

Issues found and fixed in the process (across all four rounds of testing):

  1. Next.js 14.2.16 had a disclosed security vulnerability — bumped to the latest patched 14.2.x release.
  2. Eight pages using useSearchParams() weren't wrapped in a Suspense boundary — this was silently breaking the production build. Fixed with proper Suspense boundaries and real (not blank) loading fallbacks.
  3. Two pages used <img> instead of next/image, flagged by the build's linting pass — fixed.
  4. The navbar's feature dropdown and footer linked to page anchors that didn't correspond to any real element on the page — some were fixed by adding real ids to the landing page, others were removed rather than padded out with fake placeholder content.
  5. Two test mocks in this round were initially too naive to catch real bugs (one ignored the actual DB query filter, one didn't simulate Mongoose's field-projection behavior) — both were rewritten to genuinely exercise the real code path rather than just exercise themselves.

Known limitations:

  • npm audit still flags advisories across the broader Next.js version range (mostly self-hosted-specific issues). Fixing all of them requires a major-version jump to Next 15/16, not attempted here — do this before a real production launch.
  • I could not test true full-stack integration (frontend + backend + a live MongoDB running simultaneously) because this sandbox has no MongoDB available. Everything below the HTTP layer was verified with mocked data instead of a real database; everything above it was verified by actually building and running the Next.js server. Test the full flow yourself as the first thing you do after filling in .env.
  • Admin accounts don't have 2FA yet — only the user login flow was wired up, to keep scope bounded. The same twoFactorService.js and pattern in authController.js can be mirrored onto the admin model/routes if you want parity.
  • The public API is read-only and vendor-only — it doesn't yet support pagination, rate limiting per key, or write operations. Fine for a demo of "we have an API," not yet a full developer platform.

Project structure

vendaris/
├── backend/     # Express API + monitoring engine
└── frontend/    # Next.js app

1. Backend setup

cd backend
npm install
cp .env.example .env

Fill in .env:

  • MONGODB_URI — your MongoDB Atlas connection string (you already have this)
  • JWT_SECRET — any long random string
  • SENDGRID_API_KEY / SENDGRID_FROM_EMAIL — for OTP/reset/alert emails (leave blank to skip emails in dev — the API logs a warning instead of crashing)
  • CLOUDINARY_* — needed for avatar/company-logo uploads (Settings page); leave blank and those two upload buttons will return a clear "not configured" error instead of crashing
  • ADMIN_SIGNUP_CODE — a secret string; whoever has it can create an admin account via /admin/signup
  • ADMIN_NAME / ADMIN_EMAIL / ADMIN_PASSWORD — used only by the seed script below

Seed a first admin (optional — you can also just sign up via the Admin Signup page with ADMIN_SIGNUP_CODE):

npm run seed:admin

Run it:

npm run dev      # http://localhost:5000

2. Frontend setup

cd frontend
npm install
cp .env.example .env
npm run dev       # http://localhost:3000

next.config.js automatically rewrites any /api/* request to your backend (BACKEND_URL in .env) — this replaces the vite.config.js proxy + netlify.toml redirect pattern from your MERN/Vite projects. It works the same way in both dev and production, so you don't maintain two separate proxy configs.

3. Try it out

  1. Go to http://localhost:3000/signup, create an account (this also creates your Company/tenant).
  2. Check your email for the OTP (or check the backend terminal logs if SendGrid isn't configured yet — it'll log a warning with the email that would have been sent).
  3. Log in → you land on /dashboard. Notice the "Live" indicator and the notifications bell in the topbar — that's your real-time Socket.io connection.
  4. Add a vendor. For a realistic demo, add three vendors using the built-in integrations:
    • GitHub → integration: github
    • Cloudflare → integration: cloudflare
    • AWS → integration: aws Add a few more with just a name + website (no integration) to show the generic checker, or click Template on the Vendors page to download a CSV and try Import CSV instead. Give a couple of them a monthly cost and category to populate the spend chart.
  5. Click "Run monitoring sweep now" on the Overview page to check all vendors immediately (instead of waiting for the 5-minute cron tick) — watch a toast notification and the notifications bell update live if any status changed.
  6. Click into a vendor's detail page to show the uptime history chart and its risk assessment panel, then try Edit to demonstrate full CRUD.
  7. Go to Analytics — this is the deep-dive page. Switch the time range between Today/Week/Month/Year/Custom and watch every chart re-fetch and re-render. Try the chart-type toggles (area↔bar on the uptime trend, pie↔bar on the category breakdown) to show the visualization flexibility. Note the risk distribution chart too.
  8. Go to Team and send yourself an invite at a second email address to demonstrate the invite → accept flow.
  9. Go to Billing to show plan usage bars and the plan comparison.
  10. Go to Settings to upload an avatar/company logo (needs CLOUDINARY_* configured), toggle notification preferences (severity threshold + mute a vendor), and enable two-factor authentication — scan the QR code with any authenticator app, then log out and back in to show the 2FA prompt.
  11. In Settings, enable the public status page and open the link it generates in an incognito window — a clean, unauthenticated, branded page.
  12. Go to Developers and create an API key, then try it: curl -H "Authorization: Bearer <key>" http://localhost:5000/api/public/v1/vendors.
  13. Add 10 vendors on the default Free plan to trigger the plan-limit upsell prompt — this is the moment to talk about the business model.
  14. Go to /admin/signup with your ADMIN_SIGNUP_CODE to create an admin account, explore /admin/dashboard, and check out /admin/analytics for the platform-wide growth charts.
  15. Visit /status — this genuinely checks your backend's live health, it's not a mock.

Deployment

  • Frontend → Vercel. Set BACKEND_URL / PRODUCTION_BASE_BACKEND_URL and NEXT_PUBLIC_SOCKET_URL as environment variables in the Vercel project.
  • Backend → Render or Railway (needs a long-running Node process for cron + sockets — not a fit for Vercel serverless functions). Set all the backend .env variables there.
  • Database → MongoDB Atlas (you already have this set up).

What's simplified for the prototype (and how to grow it)

  • Queue: workers/queue.js is an in-memory queue, good for a single server instance. Swap it for BullMQ + the Redis client already stubbed in config/redis.js once you need to scale horizontally.
  • Monitoring schedule: a single node-cron job sweeps all vendors every MONITOR_INTERVAL_MINUTES (default 5). Fine for a demo; a production version would stagger/queue checks per vendor.
  • Admin "me" endpoint: the admin navbar currently shows a static name/email placeholder — add a /admin/me route (mirroring /users/me) to show the real logged-in admin.
  • Some admin sidebar pages (Integrations, Plans, Security, Settings) are scaffolded with placeholder content — the routes, layout, and nav are wired, but the CRUD logic isn't built yet.
  • Uptime/latency chart history depth: each vendor keeps its last 50 checks embedded on the Vendor document (checkHistory, see models/public/Vendor.js). That's plenty for Today/Week/Month views, but a "This Year" range on a vendor checked every 5 minutes will only show its most recent ~4 hours of data, not a full year — the chart will look sparse rather than wrong. A production version would move check history into its own time-series collection (or a dedicated store like TimescaleDB) with real retention policies instead of a capped embedded array.
  • No payment processor is wired in. The Billing page shows real plan-usage data and enforces real limits server-side, but "Upgrade" links to the pricing section rather than an actual Stripe checkout — wire that up before charging anyone.

Notes

  • Dark/light mode is handled by ThemeContext (src/context/ThemeContext.jsx) exactly as specified, storing the preference in localStorage and toggling a data-theme attribute consumed by CSS variables in src/styles/globals.css.
  • Admin navbar/sidebar expand-collapse state is synced via SidebarContext (src/context/SidebarContext.jsx), used exactly as provided.
  • All custom class names are prefixed vendaris- to avoid collisions if you ever merge this into a larger codebase.

About

Multi-tenant vendor and procurement management platform for managing suppliers, purchase orders, contracts, approvals, inventory, and procurement workflows.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages