Dashboard
Welcome back, here is your portfolio overview.
Assets Portfolio
Total Value: $0.00
| Asset | Holdings | Price | Value | P/L | Actions |
|---|---|---|---|---|---|
| No assets in portfolio | |||||
Global Market News
Real-time sentiment and market updates.
Global Market News
FinPilot AI
Beacon AI
Online
Simulator
DCA Simulator
Recommendations
AI Asset Recommendations
Get on-demand trading strategies and 7-day target metrics using active market data, indicators, and media sentiment.
India Crypto Hub
Premium tracker, best local exchanges, and precise INR tax calculations.
India Premium Tracker
Best Place to Buy BTC
Tax-Aware Sell Preview (INR)
Derivatives & Positioning
Monitor futures funding rates, open interest, and liquidation risks.
Beacon Technical Deep Dive
The comprehensive architecture and reasoning manual for the Beacon platform. This document covers exactly how every module functions from the ground up, the underlying technical implementations, and the design philosophies driving them.
1. Architecture & Stack
Beacon operates on a decoupled client-server architecture designed for high-frequency data ingestion and complex LLM orchestration.
Frontend (Client)
- Next.js 14 (App Router)Provides the React foundation. We use Client Components (`'use client'`) heavily due to the reliance on WebSockets and dynamic polling hooks.
- Tailwind CSS & LucideThe styling engine relies on utility classes with custom theme variables (e.g., `bg-background`, `text-primary`) supporting a dynamic dark mode UI. Icons are sourced from Lucide-React.
- RechartsUsed for SVG-based data visualizations, including the 30-day Fear & Greed trend and the DCA Simulator chart.
Backend (Server)
- Node.js + ExpressThe backend handles data aggregation from external REST and WebSocket endpoints, processing it before passing it to the frontend.
- PostgreSQL + Prisma ORMOur persistent data layer. It stores `User` profiles, `Portfolio` state, cached `News`, and JSON payloads of `PortfolioAnalysis`. Using Postgres JSONB allows flexible schema changes for AI payloads.
- Caching & Rate LimitingBecause LLM API calls (like Groq) are expensive and strictly rate-limited (e.g., 9 requests/hour), the backend implements aggressive caching. Historical analyses are queried from the DB before hitting the AI.
2. AI Cognitive Engine Deep Dive
The Recommendation Engine is Beacon's crown jewel. It doesn't rely on simple moving average crossovers to give advice; it builds a massive context window using a Retrieval-Augmented Generation (RAG) architecture.
Market Data Ingestion
When the `triggerAnalysis(id)` API is called, the backend queries external APIs (CoinGecko/Binance) for exactly 30 days of OHLCV (Open, High, Low, Close, Volume) data. It also pulls the current global market cap, ranking, and circulating supply.
Deterministic Math Layer
Before the LLM even sees the data, the backend mathematically computes critical indicators: RSI (14-period), MACD (12/26/9), Bollinger Bands (20-period), and Volatility (Standard Deviation of log returns). This guarantees the AI isn't "hallucinating" math—it is fed exact technical values.
NLP Sentiment Analysis
Recent news articles regarding the asset are retrieved and passed through HuggingFace FinBERT, a model pre-trained specifically on financial lexicon. This outputs a weighted sentiment score (-1 to 1) and label.
LLM Synthesis & Strict JSON Generation
All this formatted context is injected into a prompt for a massive OSS model (e.g., Llama-3 120B via Groq). The prompt enforces a strict JSON schema. The model must synthesize the technicals and sentiment, decide on a `BUY/SELL/HOLD` action, predict a 7-day price target, and provide an array of analytical `reasoning` bullets.
{
"action": "HOLD",
"reasoning": [
"The RSI at 44.71 is in neutral territory...",
"Price is trading at $0.07, hitting the lower Bollinger Band..."
],
"confidence": 65,
"priceTarget": 0.0725,
...
}3. Modular Feature Breakdown
Dashboard & Portfolio Table
What: The landing view that tracks the user's manually entered asset holdings.
How: The frontend makes a GET request to the portfolio service. The backend calculates `currentValue` by hitting a live price endpoint, diffs it against the `buyingPrice * amount` from the Postgres database, and returns the net Profit/Loss.
Why: Standardizes the user's exposure, acting as the anchor point for the AI engine to know *what* assets to analyze.
Global News Stream & FinBERT
What: A real-time scrolling feed of macroeconomic and crypto news.
How: Uses a `WebSocket` connection to the backend. As news hits the backend, the backend fires off a fast NLP process (FinBERT) to classify the title/description as Positive, Neutral, or Negative. The WS then pushes the hydrated payload to the frontend React state. A progress bar tracks the aggregate market split.
Why: Sentiment precedes price. Displaying the raw feed alongside macro-sentiment metrics allows users to gauge the global mood instantly.
Derivatives & Liquidation Tracker
What: Tracks the futures market health for an asset.
How: Queries Binance Futures API for `Funding Rate`, `Open Interest`, and the `Long/Short Ratio`. A proprietary logic block determines "Liquidation Heat." If Funding Rates are exceptionally negative and Open Interest is high, it flags an `EXTREME` risk of a short squeeze.
Why: The spot market is often pushed by leverage cascades in the futures market. Knowing the squeeze risk is vital for short-term risk management.
India Crypto Hub (Arbitrage & Tax)
What: A localized tool to measure the "India Premium" and preview exact tax implications.
How: The backend queries global USD prices and the current USD/INR forex rate to calculate the "Implied INR Price". It then queries an Indian exchange (e.g., CoinDCX or WazirX) order book. The difference is the `premiumPercentage`.
For taxes, the frontend form sends the Buy/Sell delta to the backend, which strictly enforces Indian crypto tax law: 30% flat tax on gross profit (no loss offsets) + 1% TDS on the total sell proceeds, returning the exact net INR expected.
Why: Indian crypto markets trade in silos due to strict capital controls. A global price tracker is useless for an Indian user who wants to know exactly what they will receive in their local bank account.
4. Security & Database Models
Beacon is built with a strictly Read-Only, Non-Custodial posture. We do not require wallet private keys, nor do we route actual trades.
From a database perspective, AI generations are inherently unpredictable in length and structure. By utilizing PostgreSQL's `JSONB` column type for the `PortfolioAnalysis` model, we can safely store nested arrays (like the dynamic `reasoning` bullets and nested `macd` objects) without requiring rigorous schema migrations every time the AI prompt is updated to include a new indicator.
id String @id @default(uuid())
portfolioId String
portfolio Portfolio @relation(fields: [portfolioId], references: [id])
data Json // Contains full AI Recommendation JSON
createdAt DateTime @default(now())
}