> ## Documentation Index
> Fetch the complete documentation index at: https://alliancebioversityciat-alliance-risk-analysis-tool.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Prerequisites

> Required software and services for deploying the CGIAR Risk Intelligence Tool

Before deploying the CGIAR Risk Intelligence Tool, ensure you have the following dependencies and services configured.

## System Requirements

### Node.js

**Minimum Version:** Node.js >= 20

The platform requires Node.js 20 or later for both local development and AWS Lambda runtime.

```bash npm theme={null}
# Check your Node.js version
node --version

# Should output v20.x.x or higher
```

```bash nvm theme={null}
# Install Node.js 20 using nvm
nvm install 20
nvm use 20
```

> [!NOTE]
>
> AWS Lambdas are configured to use Node.js 20 runtime. Ensure your local Node.js version matches to avoid compatibility issues.

### pnpm

**Minimum Version:** pnpm >= 9

This project uses pnpm as the package manager for efficient monorepo dependency management.

```bash theme={null}
# Install pnpm globally
npm install -g pnpm

# Verify installation
pnpm --version
```

> [!WARNING]
>
> Do not use npm or yarn. The project relies on pnpm workspace features and has `pnpm.onlyBuiltDependencies` configuration that is specific to pnpm.

## Database

### PostgreSQL

**Version:** PostgreSQL 15

For local development, you need a PostgreSQL 15 instance.

```bash macOS (Homebrew) theme={null}
# Install PostgreSQL
brew install postgresql@15

# Start PostgreSQL service
brew services start postgresql@15

# Create database
psql postgres
CREATE DATABASE alliance_risk_dev;
\q
```

```bash Ubuntu/Debian theme={null}
# Install PostgreSQL
sudo apt update
sudo apt install postgresql-15 postgresql-contrib

# Start PostgreSQL service
sudo systemctl start postgresql
sudo systemctl enable postgresql

# Create database
sudo -u postgres psql
CREATE DATABASE alliance_risk_dev;
\q
```

```bash Docker theme={null}
# Run PostgreSQL 15 in Docker
docker run --name alliance-risk-postgres \
  -e POSTGRES_DB=alliance_risk_dev \
  -e POSTGRES_PASSWORD=yourpassword \
  -p 5432:5432 \
  -d postgres:15
```

> [!NOTE]
>
> **Production Note:** In production, the platform uses AWS RDS PostgreSQL 15 in a private VPC. The RDS instance is unreachable from outside the VPC and can only be accessed by Lambda functions.

## AWS Services

### AWS CLI

**Minimum Version:** AWS CLI v2

Required for infrastructure deployment, Cognito management, and remote database operations.

```bash macOS theme={null}
# Install AWS CLI v2
brew install awscli

# Verify installation
aws --version
```

```bash Linux theme={null}
# Download and install
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

# Verify installation
aws --version
```

```bash Windows theme={null}
# Download the MSI installer from:
# https://awscli.amazonaws.com/AWSCLIV2.msi
# Run the installer and verify:
aws --version
```

### Configure AWS Credentials

Configure your AWS credentials with appropriate permissions:

```bash theme={null}
aws configure
```

You'll need:

* AWS Access Key ID
* AWS Secret Access Key
* Default region (e.g., `us-east-1`)
* Default output format (recommended: `json`)

> [!WARNING]
>
> **Required AWS Permissions:** Your IAM user or role needs permissions for:
>
> * CloudFormation (stack creation, updates)
> * Cognito (User Pool management)
> * RDS (database provisioning)
> * Lambda (function deployment, invocation)
> * S3 (bucket creation, file uploads)
> * CloudFront (distribution management)
> * IAM (role and policy management)
> * Bedrock (model access)

### AWS Account Requirements

The following AWS services must be available in your account and region:

| Service | Purpose | Notes |
| - | - | - |
| **Cognito** | User authentication | User Pool with email-based auth |
| **RDS PostgreSQL 15** | Primary database | Deployed in private VPC |
| **Lambda** | API and Worker functions | ARM64, Node.js 20 runtime |
| **API Gateway** | HTTP API for NestJS backend | 30s timeout |
| **S3** | File storage + static hosting | Two buckets (files, web) |
| **CloudFront** | CDN for static frontend | SPA fallback routing |
| **Bedrock** | AI model access | Claude 3.5 Sonnet v2 |
| **Secrets Manager** | Database credentials | PostgreSQL password |
| **VPC** | Network isolation | Private subnets for RDS |

> [!NOTE]
>
> **Bedrock Access:** Ensure your AWS account has access to AWS Bedrock and that Claude 3.5 Sonnet v2 is enabled in your region. You may need to request model access through the AWS Console.

## Development Tools

### Optional but Recommended

**Prisma Studio** - Database GUI (included with Prisma CLI)

```bash theme={null}
cd packages/api
npx prisma studio
```

**PostgreSQL Client** - For direct database access

```bash theme={null}
# Install psql (if not included with PostgreSQL)
brew install libpq  # macOS
sudo apt install postgresql-client  # Ubuntu/Debian
```

## Next Steps

Once all prerequisites are installed:

1. [Set up your local development environment](https://alliancebioversityciat-alliance-risk-analysis-tool.mintlify.site/deployment/local-development.md)
2. [Configure environment variables](https://alliancebioversityciat-alliance-risk-analysis-tool.mintlify.site/deployment/environment-variables.md)
3. Deploy infrastructure using AWS CDK or CloudFormation


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.