RAGNA Studio Backend is the API-Server built with NestJS, featuring Retrieval-Augmented Generation (RAG), Named Entity Recognition (NER), multi-provider AI integrations, multi-AI-Agent capabilities with function calling, TextToImage and much more (see frontend for full feature list). This project provides a robust foundation for building AI applications with document processing, chat interfaces, and intelligent assistants.
- Not a Turnkey Solution: This API Server is part of a larger ecosystem and requires additional microservices to function fully
- Not Production Ready: This software is provided for educational and development purposes
- API Keys Required: You'll need API keys from AI providers to use AI features
- Resource Intensive: AI operations require significant computational resources
This backend is part of the complete RAGNA Studio platform:
- RAGNA Studio Backend (this repository) - NestJs API backend
- RAGNA Studio Frontend - Modern Vue3-based user interface
- RAGNA SDK - TypeScript SDK for easy integration into your own software
- RAG Server: Handles document parsing and embedding generation
- NER Server: Performs Named Entity Recognition on text data
- WebSocket Gateway: Manages real-time communication for chat features
- WebScraper Server: Fetches and processes web content
For the full experience, you'll want to set up both the backend, the frontend and all the microservices. The SDK provides a convenient way to integrate RAGNA Studio's AI capabilities into your own applications with type-safe API calls and built-in error handling.
- NestJS Framework: Efficient, scalable, and high-performance async API endpoints
- Modular Design: Maintainable architecture that scales with your needs
- TypeScript: Full type safety throughout the codebase
- Prisma ORM: Type-safe database interactions with PostgreSQL
- Redis Integration: Caching and session management
- BullMQ: Background job processing for heavy operations
- WebSocket Support: Real-time communication capabilities
- OpenAPI Documentation: Auto-generated API documentation
- RAG (Retrieval-Augmented Generation): Advanced document retrieval and generation
- Multi-Provider AI Support: OpenAI, Anthropic, Google, Mistral, and more
- Named Entity Recognition (NER): Extract and process entities from text
- Document Processing: Support for various file formats (PDF, DOCX, etc.)
- Embedding Generation: Vector embeddings for semantic search
- Chat Interfaces: Real-time chat with AI assistants
- Role-Based Access Control (RBAC): Granular permission management
- JWT Authentication: Secure token-based authentication with rotation
- Session Management: Secure user session handling
- Input Sanitization: Protection against malicious inputs
- CORS Configuration: Cross-origin resource sharing controls
- Rate Limiting: API abuse protection
- Comprehensive Logging: Structured logging with debug traces
- Clean Architecture: Object-oriented design with dependency injection
- Separation of Concerns: Modular code organization
- TypeScript SDK: Pre-built, type-safe API client
- Code Quality Tools: Prettier, ESLint, and comprehensive testing
- Environment Configuration: Easy setup for different environments
- Docker Support: Containerized development and deployment
- Node.js 22+ and npm/yarn
- Docker & Docker Compose (recommended for development)
- PostgreSQL 17+ (if not using Docker)
- Redis 7+ (if not using Docker)
- Minimum 8GB RAM (for AI model operations)
-
Clone the repository
git clone https://github.com/hopkins385/ragna-studio-backend.git cd ragna-studio-backend
-
Install dependencies
npm install
-
Environment Setup
# Copy the example environment file cp .env.example .env # Edit the .env file with your configuration nano .env
-
Database Setup
# Start PostgreSQL and Redis with Docker docker-compose up -d postgres redis # Run database migrations npm run migrate # Seed the database (optional) npm run seed:init
-
Start the Development Server
npm run dev
For a complete development environment with all services:
# Start all services
docker-compose -f docker-compose.dev.yml up
# Or run in detached mode
docker-compose -f docker-compose.dev.yml up -d
- API Documentation: Available at
/swagger
when running the server (dev-only) - Database Schema: Check
prisma/schema.prisma
for the complete data model - Environment Variables: See
.env.example
for all configuration options
src/
├── modules/ # Feature modules (auth, chat, documents, etc.)
├── common/ # Shared utilities, guards, decorators
├── config/ # Configuration files
└── filter/ # Exception filters
prisma/
├── schema.prisma # Database schema
├── migrations/ # Database migrations
└── seed/ # Database seeders
- Auth: User authentication and authorization
- Chat: Real-time chat functionality with AI assistants
- AI Models: Integration with various AI providers
- Assistants: Configurable AI assistants with tools
- Collections: Document collections and knowledge bases
We welcome contributions! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with NestJS
- Database ORM by Prisma
- AI integrations powered by Vercel AI SDK
- And many other amazing open-source projects