← Back to Projects
Archived
Full-Stack

PerfectApp

Multi-tenant B2B platform for consumer goods route-to-market: field visit tracking, order validation and a points-based loyalty program, built with Next.js and MongoDB.

PerfectApp

Date

July 1, 2024

Objective

Replace spreadsheet tracking of field visits, orders and client loyalty with one platform.

Server-rendered app with role-guarded areas for administrators, field reps, coordinators, retail clients and analysts. A three-step visit form feeds purchase orders, validated orders credit loyalty points, and sales, price and inventory data export as CSV.

Challenges

  1. 01Five user roles needing different data and permissions in one app
  2. 02Visit forms must survive page reloads on unreliable mobile connections
  3. 03Quota progress and sales rollups across zones, SKUs and client tiers

How it was solved

  1. 01Server-side session and role checks on every protected page and API route
  2. 02Redux Toolkit state persisted locally across the three visit steps
  3. 03MongoDB aggregation pipelines scoped by company and zone

Results

  • Validated orders credit loyalty points automatically
  • Sales, price and inventory data exportable as CSV

Overview

PerfectApp connects field sales reps, coordinators, administrators and retail clients. Each role has a private area behind a public landing page.

Technical Implementation

Access Control

Next.js Pages Router with NextAuth.js credential sessions. Each protected page checks the role in getServerSideProps before loading data; API routes do too.

Multi-Company Data

Each user belongs to a company, which scopes queries and configuration (SKUs, competitors, promotions) within one deployment.

Visit Workflow

Reps record competitor prices with photos, inventory, the purchase order or reason for no purchase, and communication material execution. Photos go to Vercel Blob; submitting stores the visit and a pending order, and a summary is emailed.

Loyalty Points

Points are valued per client tier and SKU. Admins credit them on validation and can double them for clients over their monthly quota.

Features

  • Rep dashboard with monthly quota progress
  • Coordinator view: quota per rep and purchasing clients
  • Client portal with points balance, promotional banners and rewards catalog
  • Admin panel: order approval, prospect validation, monthly promotions and messages to reps

Technologies

  • Next.js 14
  • React
  • JavaScript
  • MongoDB
  • Prisma
  • NextAuth.js
  • Redux Toolkit
  • React Hook Form
  • Zod
  • Vercel Blob
  • Nodemailer
  • SCSS Modules

Impact

Sales reps fill in the visit form on their phone, often with weak signal, and a reload or dropped connection no longer loses what they typed. Orders, points and reports all start from that form.

Ask my portfolio

AI

I answer from what's published on this site and link the project each answer comes from. If you'd rather talk to Fer, tell me and I'll pass on your details.