FETech Analytics

Business Intelligence Platform

Project Type

Full-Stack Web Application — BI SaaS Platform

Author

Fabjan Elezi

Live URL

fetech-analytics.vercel.app

Source Code

github.com/FabjanElezi/fetech-analytics

Report Date

12 May 2026

Version

1.0 — Production

One-Line Summary

FETech Analytics is a Business Intelligence platform that turns raw retail sales data into actionable business insights for decision-making.

1. Executive Summary

FETech Analytics is a full-stack Business Intelligence web application built to serve retail businesses that need to understand their sales performance without hiring a data analyst or purchasing expensive BI tools. The platform ingests raw order-level CSV data and transforms it into a structured, interactive dashboard with automatic insights, revenue forecasting, customer segmentation, and an AI-powered assistant.

The core design principle is that charts alone are not intelligence. Any spreadsheet can produce a chart. The differentiating feature of FETech Analytics is the Insight Engine — a rules-based analysis layer that reads the data, identifies patterns against industry benchmarks, and outputs structured recommendations with specific actions the business should take. This transforms the platform from a data viewer into a decision support system.

The platform is fully deployed on Vercel and publicly accessible. It operates in a graceful degradation model: it works completely out of the box with demo data, and progressively unlocks features (authentication, cloud persistence, AI chat) as environment variables are configured.

2. Problem Statement

Small and mid-size retail businesses generate significant transaction data but lack the tools or expertise to extract meaningful insights from it. Enterprise BI tools (Tableau, Power BI, Looker) are expensive, complex, and require dedicated analysts. Spreadsheets are flexible but cannot generate forecasts, segment customers by behaviour, or automatically flag performance anomalies.

The Gap

Businesses know their revenue numbers but cannot answer: Why did this month underperform? Which customers are about to churn? Which product categories are worth investing in?

The Solution

FETech Analytics answers all of these questions automatically from a single CSV upload — no analyst required, no complex configuration, no subscription fee to start.

3. Technical Architecture

The application is a single Next.js 16 project using the App Router. All data processing happens on the client side after CSV upload — there is no proprietary backend; the Next.js API routes handle only authentication and database persistence, both of which are optional.

LayerTechnology / Detail
FrameworkNext.js 16 (App Router, Turbopack)
LanguageTypeScript 5 — strict mode throughout
StylingTailwind CSS v4 (@import syntax)
ChartsRecharts 2 — all client components
CSV ParsingPapaParse — flexible column matching
AuthenticationClerk (@clerk/nextjs v7) — optional
DatabaseNeon PostgreSQL (serverless HTTP) — optional
AI ChatbotAnthropic Claude Haiku via AI SDK v6
PersistencelocalStorage (always) + Neon DB (if configured)
DeploymentVercel (Fluid Compute, global CDN)
Version ControlGit + GitHub

Data Flow

CSV Upload→PapaParse→csvParser.ts→DashboardData→React Context→All Pages + Insight Engine

4. Application Pages

PageContents
OverviewKPI summary, YoY revenue chart, category donut, region bar chart, recent orders table
SalesMonthly & daily trends, channel breakdown, region performance, return rate tracking
ProductsCategory revenue/margin/units/growth charts, top products table with trend indicators
CustomersRFM segmentation, cohort retention heatmap, acquisition chart, segment LTV table
Forecasting24-month ETS projection, 90% confidence band, model accuracy metrics, monthly detail table
InsightsAggregated report: health score, all insights by severity, priority action checklist, PDF export
Import DataCSV drag-and-drop upload, column auto-detection, instant dashboard replacement

5. Key Features

1

Insight Engine

Automatically analyses the loaded dataset and generates structured, human-readable business insights with severity levels (Critical, Warning, Opportunity, Positive) and specific recommended actions. This is what separates FETech from a chart viewer.

2

Business Health Score

Composite 0–100 score computed from five weighted dimensions. Gives executives a single number to track business health without reading 50 charts.

3

ETS Revenue Forecasting

Exponential smoothing (α=0.30) with multiplicative seasonal indices and 10% growth assumption. Produces 12 projected months with 90% confidence bands. Reports MAPE, RMSE, and R² accuracy metrics.

4

RFM Customer Segmentation

Classifies customers into Premium, Loyal, Regular, At-Risk, and New segments based on Recency, Frequency, and Monetary value derived from order-level CSV data.

5

Cohort Retention Heatmap

Groups customers by acquisition month (cohort) and tracks the percentage still purchasing at Month 1, 2, 3, 6, and 12. Heat-map colouring makes patterns immediately visible.

6

CSV Import Pipeline

PapaParse-powered CSV parser with case-insensitive flexible column matching (20+ column name aliases). Ingests order-level data and computes all dashboard metrics on the client side.

7

PDF Report Export

The Insights page has a Download PDF button. Print CSS hides all navigation chrome, leaving only the report content: executive summary, health score, insight cards, and the priority action checklist.

8

AI Assistant

Floating chat widget (Claude Haiku) with live dashboard context. Receives a compact data summary on every request so it can answer questions specific to the user's actual numbers, not generic advice.

9

Graceful Degradation

The entire platform runs in Demo Mode with no configuration. localStorage provides cross-session data persistence with zero accounts. Clerk, Neon, and Anthropic integrations activate automatically when env vars are present.

6. Insight Engine Detail

The Insight Engine (src/lib/insightEngine.ts) is the intellectual core of the platform. It is a pure TypeScript module — no external dependencies, no ML model — that applies domain knowledge rules against the DashboardData object and returns structured Insight objects.

Each Insight has: a type (critical / warning / opportunity / positive), a title, a description explaining why the metric matters, a recommended action, and the key metric that triggered it. Insights are generated fresh on every render from live data — there is no pre-computed cache.

FunctionWhat It Analyses
getOverviewInsightsRevenue growth signal, Q4 concentration risk, online channel momentum, AOV lift detection
getSalesInsightsBest/worst YoY month, return rate threshold alert, fastest-growing region
getProductInsightsHigh-return SKUs (>6%), margin vs revenue mismatch, fast-growing categories, declining products
getCustomerInsightsAt-risk win-back opportunity, premium concentration risk, Month-1 retention vs benchmark
getForecastInsightsModel accuracy quality (MAPE), aggressive growth validation, Q4 concentration warning
getHealthScoreComposite 0–100 score: Revenue Growth (30%), Gross Margin (25%), Retention (20%), Risk (15%), Returns (10%)

7. CSV Data Pipeline

The CSV parser (src/lib/csvParser.ts) accepts any order-level CSV file and produces a complete DashboardData object. It uses case-insensitive column matching with 20+ alias names per field, meaning a CSV with columns named Amount, Total, Revenue, or Price all resolve to the same revenue field.

From a single CSV of orders it computes: monthly revenue with YoY comparison (multi-year detection), daily sales rolling window, category/region/channel breakdowns, top products with trend analysis, RFM customer segments, monthly acquisition and churn, cohort retention heatmap, and a 24-month ETS forecast — all in the browser, in under one second for typical datasets.

// Minimum viable CSV structure

date, amount, category, region, channel, customer_id

// Optional fields (auto-detected if present)

product_name, quantity, margin, return_flag, order_id

8. Revenue Forecasting Model

The forecasting engine (src/lib/forecastEngine.ts) implements Exponential Smoothing (ETS) with multiplicative seasonal adjustment. It produces a 24-point series: 12 months of smoothed historical actuals plus 12 months of projection.

Smoothing Factor α

0.30

Controls sensitivity to recent data vs. historical trend

Seasonality

Multiplicative

Each month's index = month revenue ÷ annual monthly average

Growth Assumption

+10% YoY

Applied uniformly to the projected baseline

Confidence Interval

90%

Band widens with forecast horizon — max 12 months out

Accuracy Metric

MAPE

Mean Absolute Percentage Error reported on the Forecasting page

Fit Metric

R²

Coefficient of determination measures how well the model fits history

9. AI Assistant Integration

The AI assistant uses Claude Haiku (Anthropic) via the Vercel AI SDK v6. A floating chat widget sits on every page. On each message, the client serialises a compact snapshot of the current dashboard — revenue figures, top category, at-risk customer count, forecast accuracy, and other key metrics — and sends it as context alongside the conversation history.

This means the assistant can answer questions like "what should I do about my at-risk customers?" or "is my 8.3% return rate a problem?" with responses grounded in the user's actual data, not generic advice. The API route streams the response using streamText().toTextStreamResponse() and the client reads chunks incrementally via the Fetch ReadableStream API.

The assistant gracefully disables itself when ANTHROPIC_API_KEY is not configured, returning a clear 503 message rather than crashing.

10. Deployment & Infrastructure

The application is deployed on Vercel using Fluid Compute (Node.js runtime, not Edge). Static pages are pre-rendered at build time; API routes are server-rendered on demand. The platform uses three optional external services, each activating automatically when environment variables are present:

ClerkAuthentication

Sign-in/sign-up pages, session management, UserButton widget. When keys are absent the app runs in Demo Mode — no auth, full functionality.

NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY, CLERK_SECRET_KEY

NeonPostgreSQL Database

Serverless PostgreSQL over HTTP via @neondatabase/serverless. Stores user_dashboards table with JSONB data column. Lazy-initialised to avoid build crashes.

DATABASE_URL

AnthropicAI Chatbot

Claude Haiku model for the floating chat assistant. Route returns 503 if key absent.

ANTHROPIC_API_KEY

Data persistence uses a two-tier fallback: localStorage (always available, browser-local, zero accounts needed) and Neon cloud DB (cross-device, per-user, requires Clerk + Neon). On load, the app tries cloud first; if unavailable it reads from localStorage; if empty it shows demo data.

11. Project Structure

src/

├── app/ Next.js App Router pages

│ ├── api/chat/ AI chatbot streaming endpoint

│ ├── api/dashboard/ GET / POST / DELETE user data

│ ├── [sales|products|…]/ Dashboard pages

│ └── project-report/ This report (standalone layout)

├── components/

│ ├── charts/ 8 Recharts components (all "use client")

│ ├── layout/ Sidebar, Header

│ ├── tables/ RecentOrders, TopProducts

│ └── ui/ KPICard, SectionCard, InsightCard, HealthScoreCard, ChatBot

├── context/ DataContext (global state + persistence)

├── lib/

│ ├── csvParser.ts CSV → DashboardData transformation

│ ├── forecastEngine.ts ETS forecasting model

│ ├── insightEngine.ts Auto-generated business insights

│ ├── db.ts Lazy Neon SQL client

│ └── data/ Mock dataset (demo mode)

├── types/index.ts All domain interfaces

└── proxy.ts Clerk middleware (Next.js 16 convention)

12. Conclusion

FETech Analytics demonstrates that a full BI platform — with forecasting, customer intelligence, automated insights, AI assistance, and PDF reporting — can be built as a single Next.js application with no proprietary backend infrastructure. The entire analytical pipeline runs on the client side, making the platform fast, portable, and free to host.

The key architectural decision that makes this project more than a dashboard is the Insight Engine: by explicitly separating data computation from insight generation, the platform can tell a business not just what happened but why it matters and what to do next. That is the difference between a chart viewer and a decision system.

13 Routes

Deployed on Vercel

8 Chart Types

All Recharts, all client-side

6 Insight Functions

450+ lines of business logic

3 Persistence Tiers

localStorage → Neon → Demo

1 AI Assistant

Context-aware, streaming

0 Accounts Needed

To start using it today

FETech Analytics — Project Reportfetech-analytics.vercel.app · github.com/FabjanElezi/fetech-analytics