Skip to main content

Architecture Overview

Zyra is a production-ready, scalable monorepo platform designed to deliver advanced hybrid Web2/Web3 automation with AI agents, comprehensive blockchain integration, and enterprise-grade security features.

System Architecture

Frontend Layer

βš›οΈNext.js UIReact 19 + TypeScript
🎨Tailwind CSSStyling & Components
πŸ”—Web3 IntegrationWagmi + Viem + ConnectKit

Backend Layer

πŸš€NestJS API Serverβœ… Production - REST APIs & Session Keys
βš™οΈNestJS Workerβœ… Production - AI Agents & Blockchain
πŸ€–AI Engineβœ… Production - MCP Servers & Multi-LLM

Data Layer

πŸ—„οΈPostgreSQLPrimary Database
πŸ”§Prisma ORMβœ… Primary Database Client
πŸ“¦Shared Packagesβœ… Types + Database + Blocks

Monorepo Structure

πŸ“ Zzyra Monorepo

Organized with Turbo for optimal development experience

πŸ“±apps/ui/Next.js Frontend Application
app/ - Next.js App Router
components/ - React Components
lib/ - Core Services
hooks/ - Custom React Hooks
πŸš€apps/api/🚧 NestJS API Server (In Development)
src/auth/ - Authentication
src/workflows/ - Workflow Management
src/executions/ - Execution Tracking
src/blocks/ - Block Library
βš™οΈapps/zzyra-worker/βœ… NestJS Worker Service
src/workers/ - Worker Implementations
src/services/ - Business Services
src/handlers/ - Block Handlers
πŸ“¦packages/Shared Packages
βœ… @zzyra/database - Prisma Client & Repositories
βœ… @zzyra/types - Shared TypeScript Types
πŸ“‹ @zzyra/blocks - Block Library (Planned)

Core Components

Frontend Application (apps/ui/)

βš›οΈ Next.js Frontend

Next.js 15.3.1React 19.0.0TypeScript 5.xTailwind CSS 3.4.17

Workflow Builder

  • Visual drag-and-drop interface - React Flow integration - Real-time collaboration - AI Copilot assistance

Web3 Integration

  • Magic SDK authentication - Wagmi + Viem integration - Multi-wallet support - Transaction management

Block Catalog

  • Pre-built automation blocks - Custom block creation - Block marketplace - Version management

Dashboard & Analytics

  • Execution monitoring - Performance metrics - Real-time updates - Custom reporting

API Server (apps/api/)

πŸš€ NestJS API Server

NestJS 10.0.0TypeScript 5.1.3JWT AuthenticationSwagger/OpenAPI
  • JWT token management - Magic SDK integration - Role-based access control - Session management
  • CRUD operations - Version control - Template management - Sharing and collaboration
  • Execution tracking - Status management - Log aggregation - Performance monitoring
  • Block library management - Custom block creation - Marketplace integration - Block validation
  • OpenRouter integration - Workflow generation - Natural language processing - Intelligent suggestions

Worker Service (apps/zzyra-worker/)

βš™οΈ NestJS Worker Service

NestJS 10.0.0RabbitMQLangChainEthers.js

Execution Worker

  • Asynchronous workflow execution - Message queue processing - Error handling and retries - Resource management

Block Handlers

  • Individual block execution - External API integration - Web3 transaction handling - AI model interactions

Monitoring

  • Prometheus metrics - Winston logging - Health checks - Performance tracking

Queue Management

  • RabbitMQ integration - Message routing - Dead letter queues - Priority handling

Data Flow Architecture

πŸ‘€

User creates or executes workflow

β†’
πŸš€

Request validated and processed

β†’
πŸ“¨

Execution queued in RabbitMQ

β†’
βš™οΈ

Worker executes workflow nodes

β†’
πŸ—„οΈ

Results stored in PostgreSQL

β†’
πŸ“±

Frontend receives real-time updates

Database Schema

πŸ—„οΈ PostgreSQL with Prisma ORM

Comprehensive schema with 20+ models supporting all platform features

UserCore user accounts and authentication
ProfileExtended user profile information
TeamTeam collaboration and permissions
TeamMemberTeam membership and roles

Technology Stack Details

πŸ› οΈ Development Tools

Package Managerpnpm 9.15.2
MonorepoTurbo 2.5.3
LanguageTypeScript 5.x
ContainerizationDocker Compose

πŸ” Authentication & Security

Web3 AuthMagic SDK 29.0.6
JWTPassport.js
Validationclass-validator

πŸ€– AI Integration

AI ProviderOpenRouter AI SDK
LangChainAI Framework
OllamaLocal AI Models

Deployment Architecture

πŸš€ Production Deployment

Multi-environment deployment with monitoring and scaling

Frontend

Platform:Netlify
Framework:Next.js
Build:pnpm build

API Server

Platform:AWS EC2 / GCP
Process Manager:PM2
Health Check:/health endpoint

Worker Service

Platform:Container / VM
Scaling:Multiple instances
Monitoring:Prometheus + Winston

Database

Platform:AWS RDS / GCP SQL
Type:PostgreSQL 14
Backups:Automated daily

Development Workflow

1

Local Development

  • Docker Compose for infrastructure - Hot reloading for all services - Shared TypeScript types - Prisma migrations
2

Testing

  • Unit tests for all components - Integration tests for API - E2E tests for workflows - Performance testing
3

CI/CD Pipeline

  • Automated testing - Type checking - Database migrations - Deployment to staging
4

Production Deployment

  • Blue-green deployment - Health checks - Monitoring setup - Rollback procedures

Next Steps

This architecture is designed for scalability and maintainability. The monorepo structure enables efficient development while the microservices approach ensures reliable production deployment and operation.