Thanks to visit codestin.com
Credit goes to github.com

Skip to content

rralbertoroman/augenai

Repository files navigation

AugenAI

AugenAI is an AI-powered medical imaging analysis platform built with modern web technologies. This monorepo contains both the web application and the AI prediction service.

πŸ—οΈ Architecture

This project uses [Turborepo] to manage a monorepo with the following applications:

  • apps/web: Next.js web application with TypeScript, Drizzle ORM, and Supabase
  • apps/ai_service: FastAPI-based AI prediction service for medical image analysis

πŸ“‹ Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js >=18
  • pnpm >=9.0.0
  • Python >=3.10, <3.15
  • uv (Python package manager)
  • Docker (optional, for containerized deployment)
  • Supabase

πŸš€ Quick Start

1. Clone the repository

Unlike most repositories, this repo includes a submodule for each model and these include large files that store the model weights. To handle these files, Git LFS is used and must be installed before the cloning.

Once it is installed, proceed with the following steps. First clone the repository using the url provided by GitHub

git clone <repository-url>
cd augenai

Then initialize the submodules with

git submodule update --init --recursive

Now all the models have been downloaded. We proceed to install the dependencies.

2. Install dependencies

Install all dependencies for both apps:

pnpm install

This will:

  • Install Node.js dependencies for the web app
  • Install Python dependencies for the AI service (runs uv sync automatically)

3. Set up environment variables

Web Application (apps/web/.env)

Create a .env file in apps/web/ with the following variables:

# Supabase Configuration
SUPABASE_DB_URL=postgresql://postgres.xxx:[email protected]:6543/postgres
SUPABASE_MASTER_API_KEY=sb_secret_your_master_api_key
SUPABASE_JWT_JWK='{"x": "...", "y": "...", "alg": "ES256", "crv": "P-256", "ext": true, "kid": "...", "kty": "EC", "key_ops": ["verify"]}'

# Supabase Public Keys
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY=sb_publishable_your_key

# AI Service
AI_PREDICTION_SERVICE_URL=http://localhost:8000/api/v1
AI_PREDICTION_SERVICE_SECRET_KEY=your_secret_key_here

# Email Service (Resend)
RESEND_API_KEY=re_your_resend_api_key
RESEND_FROM_EMAIL=[email protected]

# Environment
ENVIRONMENT=development

AI Service (apps/ai_service/.env)

Create a .env file in apps/ai_service/ with:

# API Configuration
AI_PREDICTION_SERVICE_SECRET_KEY=your_secret_key_here

Note: Make sure the AI_PREDICTION_SERVICE_SECRET_KEY matches in both .env files.

4. Database Setup

Initialize database structure (tables only):

cd apps/web
pnpm migrate          # Creates tables and schema
cd ../..

Initialize database with essential data:

cd apps/web
pnpm migrate:seed     # Creates tables + loads required data
cd ../..

CAUTION: migrate:seed will delete existing data before loading new data. Use with caution in production.

5. Start the development servers

From the root of the monorepo:

pnpm dev

This will start:

πŸ§ͺ Testing

Run tests for all apps:

pnpm test

πŸ—οΈ Database

This project uses:

  • Drizzle ORM for type-safe database queries
  • PostgreSQL(Supabase) as the database
  • Supabase for authentication and storage

Running Migrations

cd apps/web

# Generate a new migration
pnpm generate -- <migration_name>

# Apply migrations (structure only)
pnpm migrate

# Apply migrations + load essential data
pnpm migrate:seed

🐳 Docker Support

Start the entire stack with Docker Compose:

pnpm docker:build
pnpm docker:run

πŸ“ Project Structure

augenai/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ web/                    # Next.js web application
β”‚   β”‚   β”œβ”€β”€ app/               # Next.js app directory
β”‚   β”‚   β”œβ”€β”€ components/        # React components
β”‚   β”‚   β”œβ”€β”€ server/           # Server-side code
β”‚   β”‚   β”‚   β”œβ”€β”€ db/           # Database schemas and migrations
β”‚   β”‚   β”‚   β”œβ”€β”€ services/     # Business logic
β”‚   β”‚   β”‚   └── zod-schemas/  # Validation schemas
β”‚   β”‚   β”œβ”€β”€ tests/            # Test files
β”‚   β”‚   └── types/            # TypeScript type definitions
β”‚   β”‚
β”‚   └── ai_service/            # FastAPI AI service for medical image analysis
β”‚       β”œβ”€β”€ src/
β”‚       β”‚   └── ai_service/
β”‚       β”‚       β”œβ”€β”€ main.py              # FastAPI app entry point with CORS & logging
β”‚       β”‚       β”œβ”€β”€ config.py            # Environment configuration
β”‚       β”‚       β”œβ”€β”€ logging_config.py    # Structured logging setup
β”‚       β”‚       β”œβ”€β”€ routers/             # API route handlers
β”‚       β”‚       β”‚   β”œβ”€β”€ health.py        # Health check endpoints
β”‚       β”‚       β”‚   β”œβ”€β”€ predictions.py   # ML prediction endpoints
β”‚       β”‚       β”‚   └── api.py           # Main API router
β”‚       β”‚       β”œβ”€β”€ services/            # Business logic layer
β”‚       β”‚       β”‚   β”œβ”€β”€ model/           # Model management services
β”‚       β”‚       β”‚   └── prediction/      # Prediction services
β”‚       β”‚       β”‚       β”œβ”€β”€ service.py           # Prediction orchestration
β”‚       β”‚       β”‚       β”œβ”€β”€ model_pool.py        # Model pooling & caching
β”‚       β”‚       β”‚       └── factories/           # Model factories
β”‚       β”‚       β”œβ”€β”€ models/              # Pydantic schemas
β”‚       β”‚       β”‚   └── schemas.py       # Request/response models
β”‚       β”‚       └── auth/                # Authentication middleware
β”‚       β”œβ”€β”€ tests/                # Pytest test suite
β”‚       β”‚   β”œβ”€β”€ routers/          # Router tests
β”‚       β”‚   β”œβ”€β”€ prediction/       # Prediction service tests
β”‚       β”‚   β”œβ”€β”€ model/            # Model service tests
β”‚       β”‚   └── dr_sample/        # Sample medical images for testing
β”‚       β”œβ”€β”€ weights/              # Pre-trained model weights
β”‚       β”œβ”€β”€ pyproject.toml        # Python dependencies (uv)
β”‚       └── Dockerfile            # Container configuration
β”‚
β”œβ”€β”€ package.json              # Root package.json
β”œβ”€β”€ turbo.json               # Turborepo configuration
└── README.md                # This file

πŸ› οΈ Tech Stack

Web Application

  • Framework: Next.js 16 (App Router)
  • Language: TypeScript
  • Database ORM: Drizzle ORM
  • Database: PostgreSQL (via Supabase)
  • Authentication: Supabase Auth
  • Storage: Supabase Storage
  • UI: Radix UI, Tailwind CSS
  • Testing: Vitest
  • Linting: ESLint
  • Type Checking: TypeScript

AI Service

  • Framework: FastAPI
  • Language: Python 3.13
  • Package Manager: uv
  • Linting/Formatting: Ruff

🀝 Contributing

  1. Create a new branch from main
  2. Make your changes
  3. Run tests and type-checking
  4. Submit a pull request

Code Quality

Before committing, ensure:

# Type-check passes
pnpm check-types

# Linting passes
pnpm lint

# Tests pass
pnpm test

# Code is formatted
pnpm format

πŸ“ License

MIT License

πŸ‘₯ Team

Made with ❀️ by Team Tikismikis πŸŽ―βœ¨πŸš€

πŸ› Issues & Support

For issues and support, please create an issue on GitHub.

About

Web app for aiding medical diagnosis using AI models

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •