Prerequisites
Before you begin, ensure you have the following:- Node.js 22 or higher - Scira uses Node.js 22 with Alpine Linux
- PostgreSQL database - Required for storing user data, chats, and sessions
- Redis - Used for serverless caching and rate limiting (via Upstash)
- Package manager - pnpm, npm, yarn, or bun
- API keys - At minimum, you’ll need:
- OpenAI API key (required)
- Anthropic API key (required)
- Exa API key (required for web search features)
- Other API keys depending on which features you want to enable
Installation
Configure environment variables
Copy the example environment file and configure your API keys:Edit
.env.local and add your API keys. See the Environment Variables guide for a complete reference.Set up the database
Scira uses Drizzle ORM with PostgreSQL. The database configuration is defined in Run database migrations:
drizzle.config.ts:Docker Setup
Scira includes Docker support for containerized deployment.Using Docker Compose (Recommended)
The easiest way to run Scira with Docker is using Docker Compose:
The
docker-compose.yml configuration:
Using Docker Directly
You can also build and run the Docker image directly:Docker Image Details
The Dockerfile uses a multi-stage build process:- Base image: Node.js 22 with Alpine Linux for minimal footprint
- Dependencies stage: Installs all npm dependencies using pnpm
- Builder stage: Builds the Next.js application
- Runtime stage: Runs the application with a non-root user for security
- Runs as non-root user (
nextjs) - Uses Alpine Linux for minimal attack surface
- Includes only necessary files in final image
- Uses Next.js output tracing to minimize image size
Database Setup
Scira uses Drizzle ORM with PostgreSQL for data persistence.Database Schema
The database schema is defined inlib/db/schema.ts and includes tables for:
- Users - User accounts and profiles
- Sessions - Authentication sessions
- Accounts - OAuth provider accounts
- Chats - Chat conversations
- Messages - Individual messages in chats
- Subscriptions - User subscription data (Polar and Dodo Payments)
- Custom Instructions - User-defined custom instructions
- User Preferences - User settings and preferences
- Lookouts - Scheduled research agents
- Usage tracking - Extreme search and message usage
