Skip to Content
DevelopmentOverview

Development

Technical documentation for developers working with Rhesis.

Developer Resources This section contains comprehensive technical documentation, API references, and development guides for building with and contributing to Rhesis.

Development Resources

Development Setup

Complete guide to setting up your development environment for contributing to Rhesis.

Setup Guide →

API Structure

Backend REST API architecture, endpoints, and implementation details.

View API Docs →

Contributing

Guidelines and processes for contributing to the Rhesis project.

Contribute →

Coding Standards

Code style guidelines and best practices for Python, TypeScript, and other languages.

View Standards →

Frontend (Platform)

React-based frontend architecture, components, and development patterns.

Frontend Docs →

Backend

FastAPI backend service architecture, database models, and API implementation.

Backend Docs →

SDK

Python SDK documentation for integrating Rhesis into your applications.

SDK Docs →

Architecture Overview

Rhesis is built with modern technologies and follows best practices for scalability, maintainability, and performance.

Backend Service

FastAPI-based backend service providing REST APIs, authentication, and business logic.

Frontend Application

React-based frontend with TypeScript, providing the main user interface.

Worker Service

Celery-based background task processing for long-running operations.

Chatbot Application

AI-powered chatbot for interactive testing and evaluation.

Monitoring Service

Polyphemus service for observability and monitoring.

Python SDK

Comprehensive Python SDK for integrating Rhesis into your applications.

Technology Stack

Backend: FastAPI with SQLAlchemy ORM, PostgreSQL, and Redis

backend/app/api/routes/tests.py
from fastapi import APIRouter, Depends, HTTPException
from sqlalchemy.orm import Session
from app.db.session import get_db
from app.models.test import Test
from app.schemas.test import TestCreate, TestResponse

router = APIRouter()

@router.post("/tests", response_model=TestResponse)
async def create_test(
  test: TestCreate,
  db: Session = Depends(get_db)
):
  """Create a new test case."""
  db_test = Test(**test.dict())
  db.add(db_test)
  db.commit()
  db.refresh(db_test)
  return db_test

Frontend: React 18 with TypeScript, Next.js 15, and Tailwind CSS

platform/src/components/TestCard.tsx
import React from 'react'
import { Test } from '@/types/test'

interface TestCardProps {
test: Test
onSelect: (id: string) => void
}

export const TestCard: React.FC = ({ test, onSelect }) => {
return (
  

{test.name}

{test.description}

) }

SDK: Comprehensive Python SDK for easy integration

example_sdk_usage.py
from rhesis.sdk import RhesisClient
from rhesis.sdk.synthesizers import PromptSynthesizer

# Initialize the client
client = RhesisClient(
  api_key="your-api-key",
  base_url="https://api.rhesis.ai"
)

# Create a prompt synthesizer
synthesizer = PromptSynthesizer(client=client)

# Generate test cases
test_cases = synthesizer.synthesize(
  behavior="Reliability",
  domain="Healthcare",
  count=10
)

for test in test_cases:
  print(f"Test: {test.prompt}")
  print(f"Expected: {test.expected_behavior}")

Infrastructure: Docker, Kubernetes, and cloud-native deployment options

docker-compose.yml
version: '3.8'

services:
postgres:
  image: postgres:15
  environment:
    POSTGRES_DB: rhesis
    POSTGRES_USER: rhesis
    POSTGRES_PASSWORD: rhesis
  ports:
    - "5432:5432"

redis:
  image: redis:7-alpine
  ports:
    - "6379:6379"

backend:
  build: ./backend
  ports:
    - "8000:8000"
  depends_on:
    - postgres
    - redis
  environment:
    DATABASE_URL: postgresql://rhesis:rhesis@postgres:5432/rhesis
    REDIS_URL: redis://redis:6379

Project Structure

Rhesis Repository Structure
├── 
backend/# FastAPI backend service
├── 
app/# Application code
├── 
tests/# Backend tests
├── 
alembic/# Database migrations
└── 
pyproject.toml# Python dependencies
├── 
platform/# React frontend application
├── 
src/# Source code
├── 
public/# Static assets
└── 
package.json# Node dependencies
├── 
worker/# Celery background workers
├── 
tasks/# Task definitions
└── 
pyproject.toml# Python dependencies
├── 
chatbot/# AI chatbot application
└── 
src/# Chatbot source code
├── 
sdk/# Python SDK
├── 
rhesis/# SDK package
├── 
tests/# SDK tests
└── 
pyproject.toml# Python dependencies
├── 
docs/# Documentation site
├── 
content/# Documentation pages
└── 
src/# Site components
├── 
docker-compose.yml# Local development setup
└── 
README.md# Project overview

Backend Structure

backend/ - FastAPI Service
├── 
app/# Main application code
├── 
api/# API routes and endpoints
│   │   ├── 
routes/# Route handlers
│   │   └── 
deps.py# Dependency injection
├── 
models/# SQLAlchemy models
│   │   ├── 
test.py# Test model
│   │   ├── 
user.py# User model
│   │   └── 
project.py# Project model
├── 
schemas/# Pydantic schemas
│   │   ├── 
test.py# Test schemas
│   │   └── 
user.py# User schemas
├── 
core/# Core config and security
├── 
db/# Database session and utils
├── 
services/# Business logic
└── 
main.py# Application entry point
├── 
tests/# Test suite
├── 
alembic/# Database migrations
└── 
pyproject.toml# Dependencies and config

Frontend Structure

platform/ - React Application
├── 
src/# Source code
├── 
components/# Reusable components
│   │   ├── 
TestCard.tsx# Test card component
│   │   ├── 
Button.tsx# Button component
│   │   └── 
Modal.tsx# Modal component
├── 
pages/# Next.js pages
│   │   ├── 
index.tsx# Home page
│   │   ├── 
tests/# Test pages
│   │   └── 
projects/# Project pages
├── 
hooks/# Custom React hooks
│   │   ├── 
useApi.ts# API hook
│   │   └── 
useAuth.ts# Auth hook
├── 
types/# TypeScript types
├── 
utils/# Utility functions
└── 
styles/# Global styles
├── 
public/# Static assets
├── 
package.json# Node dependencies
├── 
tsconfig.json# TypeScript config
└── 
next.config.js# Next.js config

Getting Started with Development

Quick Start

Clone the repository and set up your development environment:

Terminal
# Clone the repository
git clone https: //github.com/rhesis-ai/rhesis.git
cd rhesis

# Install uv (Python package manager)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Start the development environment
docker-compose up -d

# Install backend dependencies
cd backend
uv sync

# Run backend tests
uv run pytest

Development Workflow

  1. Development Setup - Set up your local development environment
  2. Backend API Structure - Explore the REST API architecture
  3. Contributing Guide - Learn how to contribute effectively
  4. Coding Standards - Follow our code quality guidelines

Running Tests

Backend Tests

Terminal
# Run all backend tests
cd backend
uv run pytest

# Run with coverage
uv run pytest --cov=app --cov-report=html

# Run specific test file
uv run pytest tests/test_api.py

# Run tests in watch mode
uv run pytest-watch

Frontend Tests

Terminal
# Run all frontend tests
cd platform
npm test

# Run tests in watch mode
npm test -- --watch

# Run tests with coverage
npm test -- --coverage

# Run end-to-end tests
npm run test: e2e

Common Development Commands

Database Migrations

Terminal
# Create a new migration
cd backend
uv run alembic revision --autogenerate -m "Add new table"

# Apply migrations
uv run alembic upgrade head

# Rollback migration
uv run alembic downgrade -1

# View migration history
uv run alembic history

Code Quality

Terminal
# Format Python code
cd backend
uv run ruff format .

# Lint Python code
uv run ruff check .

# Type check Python code
uv run mypy app

# Format TypeScript code
cd platform
npm run format

# Lint TypeScript code
npm run lint

Environment Configuration

Create a .env file in the backend directory:

backend/.env
# Database
DATABASE_URL=postgresql://rhesis:rhesis@localhost:5432/rhesis

# Redis
REDIS_URL=redis://localhost:6379

# API Keys
OPENAI_API_KEY=your-openai-key
ANTHROPIC_API_KEY=your-anthropic-key

# Security
SECRET_KEY=your-secret-key-here
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30

# Environment
ENVIRONMENT=development
DEBUG=true

Ready to Contribute? Start with our Development Setup Guide and check out issues labeled “good first issue” in our GitHub repository .