Getting Started with Reveal SDK AI - HTML/JavaScript
This guide will walk you through creating your first AI-powered analytics application using vanilla HTML and JavaScript. You'll build a simple application that generates AI insights from dashboard data.
Time to complete: 15-20 minutes
What You'll Build
A web application that:
- Displays a Reveal dashboard
- Adds AI-powered context menu items to the dashboard
- Generates AI insights (Summary, Analysis, and Forecast)
Prerequisites
Before you begin, ensure you meet the System Requirements and have:
- Reveal SDK Server installed and configured
- Reveal SDK AI Server installed
- LLM Provider API Key from OpenAI, Anthropic, or Google Cloud
This guide uses ASP.NET Core for the server. The Reveal SDK AI Server is also available for Node.js and Java — see Install Server SDK for the equivalent installation and configuration steps. The HTML/JavaScript client below is identical regardless of which server you choose.
Step 1: Create the ASP.NET Core Server
1.1 Create a New ASP.NET Core Web API Project
Open a terminal and run:
dotnet new webapi -n RevealAiServer
cd RevealAiServer
1.2 Install the AI NuGet Package
Install the Reveal AI package (this automatically includes Reveal.Sdk.AspNetCore):
dotnet add package Reveal.Sdk.AI.AspNetCore
1.3 Configure the Server
Open Program.cs and replace its contents with:
using Reveal.Sdk;
using Reveal.Sdk.AI;
using RevealAiServer.Reveal;
var builder = WebApplication.CreateBuilder(args);
// Add CORS for local development
builder.Services.AddCors(options =>
{
options.AddPolicy("AllowAll",
policy => policy.AllowAnyOrigin()
.AllowAnyHeader()
.AllowAnyMethod());
});
// Add Reveal SDK with data source provider
builder.Services.AddControllers().AddReveal(builder =>
{
builder.AddDataSourceProvider<DataSourceProvider>();
});
// Add Reveal AI with OpenAI provider
builder.Services.AddRevealAI()
.AddOpenAI(options =>
{
options.ApiKey = builder.Configuration["RevealAI:OpenAI:ApiKey"];
options.ModelId = "gpt-4.1";
});
var app = builder.Build();
app.UseCors("AllowAll");
app.MapControllers();
app.Run();
1.4 Configure Your API Key
Option A: Using appsettings.json (not recommended for production)
Create or modify appsettings.json:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"RevealAI": {
"OpenAI": {
"ApiKey": "sk-your-openai-api-key-here"
}
}
}
Option B: Using User Secrets (recommended for development)
dotnet user-secrets init
dotnet user-secrets set "RevealAI:OpenAI:ApiKey" "sk-your-openai-api-key-here"
Never commit API keys to source control. Always use User Secrets, environment variables, or a secure key management service.
1.5 Create a DataSource Provider
The Reveal SDK requires a data source provider. For this sample, we'll create a minimal one that simply returns data sources unchanged.
Create a new folder Reveal and add DataSourceProvider.cs:
using Reveal.Sdk.Data;
namespace RevealAiServer.Reveal;
public class DataSourceProvider : IRVDataSourceProvider
{
public Task<RVDataSourceItem> ChangeDataSourceItemAsync(
IRVUserContext userContext,
string dashboardId,
RVDataSourceItem dataSourceItem)
{
return Task.FromResult(dataSourceItem);
}
public Task<RVDashboardDataSource> ChangeDataSourceAsync(
IRVUserContext userContext,
RVDashboardDataSource dataSource)
{
return Task.FromResult(dataSource);
}
}
1.6 Add the Sample Dashboard and Data
Create the necessary folders in your project root:
mkdir Dashboards
mkdir Data
Download the required files and place them in the correct folders:
1. Dashboard file → Save to Dashboards/ folder:
- Download: Accounts.rdash
- Location:
Dashboards/Accounts.rdash
2. Data file → Save to Data/ folder:
- Download: NorthwindInvoices.xlsx
- Location:
Data/NorthwindInvoices.xlsx
Your project structure should look like:
RevealAiServer/
├── Dashboards/
│ └── Accounts.rdash
├── Data/
│ └── NorthwindInvoices.xlsx
├── Reveal/
│ └── DataSourceProvider.cs
└── Program.cs
1.7 Run the Server
dotnet run
Your server should start at https://localhost:5111 (or similar). Note the URL - you'll need it for the client.