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
1
Clone the repository
Clone the Scira repository to your local machine:
2
Install dependencies
Install the required dependencies using your preferred package manager:
3
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.4
Set up the database
Scira uses Drizzle ORM with PostgreSQL. The database configuration is defined in Run database migrations:
drizzle.config.ts:5
Start the development server
Start the Next.js development server:The application will be available at
http://localhost:3000.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:1
Ensure Docker is installed
Make sure you have Docker and Docker Compose installed on your system.
2
Create environment file
Create a
.env file based on .env.example with your API keys:3
Start the application
Run the following command in the project root:The application will be available at
http://localhost:3000.docker-compose.yml configuration:
Using Docker Directly
You can also build and run the Docker image directly:1
Create environment file
Create a
.env file based on .env.example:2
Build the Docker image
3
Run the container
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
