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.
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.
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.
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.
| Layer | Technology / Detail |
|---|---|
| Framework | Next.js 16 (App Router, Turbopack) |
| Language | TypeScript 5 — strict mode throughout |
| Styling | Tailwind CSS v4 (@import syntax) |
| Charts | Recharts 2 — all client components |
| CSV Parsing | PapaParse — flexible column matching |
| Authentication | Clerk (@clerk/nextjs v7) — optional |
| Database | Neon PostgreSQL (serverless HTTP) — optional |
| AI Chatbot | Anthropic Claude Haiku via AI SDK v6 |
| Persistence | localStorage (always) + Neon DB (if configured) |
| Deployment | Vercel (Fluid Compute, global CDN) |
| Version Control | Git + GitHub |
Data Flow
| Page | Contents |
|---|---|
| Overview | KPI summary, YoY revenue chart, category donut, region bar chart, recent orders table |
| Sales | Monthly & daily trends, channel breakdown, region performance, return rate tracking |
| Products | Category revenue/margin/units/growth charts, top products table with trend indicators |
| Customers | RFM segmentation, cohort retention heatmap, acquisition chart, segment LTV table |
| Forecasting | 24-month ETS projection, 90% confidence band, model accuracy metrics, monthly detail table |
| Insights | Aggregated report: health score, all insights by severity, priority action checklist, PDF export |
| Import Data | CSV drag-and-drop upload, column auto-detection, instant dashboard replacement |
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
| Function | What It Analyses |
|---|---|
| getOverviewInsights | Revenue growth signal, Q4 concentration risk, online channel momentum, AOV lift detection |
| getSalesInsights | Best/worst YoY month, return rate threshold alert, fastest-growing region |
| getProductInsights | High-return SKUs (>6%), margin vs revenue mismatch, fast-growing categories, declining products |
| getCustomerInsights | At-risk win-back opportunity, premium concentration risk, Month-1 retention vs benchmark |
| getForecastInsights | Model accuracy quality (MAPE), aggressive growth validation, Q4 concentration warning |
| getHealthScore | Composite 0–100 score: Revenue Growth (30%), Gross Margin (25%), Retention (20%), Risk (15%), Returns (10%) |
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
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
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.
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:
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
Serverless PostgreSQL over HTTP via @neondatabase/serverless. Stores user_dashboards table with JSONB data column. Lazy-initialised to avoid build crashes.
DATABASE_URL
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.
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)
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