Installation
Prerequisites
Section titled “Prerequisites”Before installing Scalar, make sure you have:
- Node.js 18 or later
- A package manager (npm, yarn, or pnpm)
- A database (PostgreSQL, MySQL, or SQLite)
Framework Installation
Section titled “Framework Installation”-
Create a new Next.js project
Section titled “Create a new Next.js project”Terminal window npx create-next-app@latest my-scalar-appcd my-scalar-app -
Install Scalar
Section titled “Install Scalar”Terminal window npm install @scalar/core @scalar/ui @scalar/cli -
Initialize Scalar
Section titled “Initialize Scalar”Terminal window npx scalar init -
Configure your database
Section titled “Configure your database”Add your database configuration to
.env.local
:.env.local DATABASE_URL="postgresql://username:password@localhost:5432/mydb"SCALAR_SECRET="your-secret-key"
-
Create a new Nuxt.js project
Section titled “Create a new Nuxt.js project”Terminal window npx nuxi@latest init my-scalar-appcd my-scalar-app -
Install Scalar
Section titled “Install Scalar”Terminal window npm install @scalar/nuxt @scalar/core -
Add the Nuxt module
Section titled “Add the Nuxt module”nuxt.config.ts export default defineNuxtConfig({modules: ['@scalar/nuxt'],scalar: {// Configuration options},}); -
Configure environment variables
Section titled “Configure environment variables”.env DATABASE_URL="postgresql://username:password@localhost:5432/mydb"SCALAR_SECRET="your-secret-key"
-
Create a new SvelteKit project
Section titled “Create a new SvelteKit project”Terminal window npm create svelte@latest my-scalar-appcd my-scalar-appnpm install -
Install Scalar
Section titled “Install Scalar”Terminal window npm install @scalar/sveltekit @scalar/core -
Configure SvelteKit adapter
Section titled “Configure SvelteKit adapter”vite.config.js import { sveltekit } from '@sveltejs/kit/vite';import { scalar } from '@scalar/sveltekit';export default {plugins: [sveltekit(), scalar()],}; -
Set up environment variables
Section titled “Set up environment variables”.env DATABASE_URL="postgresql://username:password@localhost:5432/mydb"SCALAR_SECRET="your-secret-key"
-
Create a new Astro project
Section titled “Create a new Astro project”Terminal window npm create astro@latest my-scalar-appcd my-scalar-app -
Install Scalar
Section titled “Install Scalar”Terminal window npm install @scalar/astro @scalar/core -
Configure Astro integration
Section titled “Configure Astro integration”astro.config.mjs import { defineConfig } from 'astro/config';import scalar from '@scalar/astro';export default defineConfig({integrations: [scalar()],}); -
Add environment variables
Section titled “Add environment variables”.env DATABASE_URL="postgresql://username:password@localhost:5432/mydb"SCALAR_SECRET="your-secret-key"
-
Create a new React project
Section titled “Create a new React project”Terminal window npx create-react-app my-scalar-appcd my-scalar-app -
Install Scalar
Section titled “Install Scalar”Terminal window npm install @scalar/react @scalar/core -
Set up Scalar provider
Section titled “Set up Scalar provider”src/App.tsx import { ScalarProvider } from '@scalar/react';function App() {return (<ScalarProvider config={{ apiUrl: '/api' }}>{/* Your app components */}</ScalarProvider>);} -
Configure environment variables
Section titled “Configure environment variables”.env REACT_APP_DATABASE_URL="postgresql://username:password@localhost:5432/mydb"REACT_APP_SCALAR_SECRET="your-secret-key"
Database Setup
Section titled “Database Setup”PostgreSQL
Section titled “PostgreSQL”# Install PostgreSQL (macOS)brew install postgresqlbrew services start postgresql
# Create a databasecreatedb my-scalar-db
# Install MySQL (macOS)brew install mysqlbrew services start mysql
# Create a databasemysql -u root -p -e "CREATE DATABASE my_scalar_db;"
SQLite
Section titled “SQLite”For development, you can use SQLite which requires no additional setup:
DATABASE_URL="file:./dev.db"
Verification
Section titled “Verification”After installation, verify everything is working:
npx scalar generatenpx scalar migratenpm run dev
Visit your application and you should see the Scalar admin interface at /admin
.