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
Authentication Module
Authentication Module
- JWT token management - Magic SDK integration - Role-based access control - Session management
Workflows Module
Workflows Module
- CRUD operations - Version control - Template management - Sharing and collaboration
Executions Module
Executions Module
- Execution tracking - Status management - Log aggregation - Performance monitoring
Blocks Module
Blocks Module
- Block library management - Custom block creation - Marketplace integration - Block validation
AI Module
AI Module
- 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
- User Management
- Workflow System
- Block System
- Billing & Notifications
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
Modular Blocks
Learn about our modular block system
Chain Agnostic
Multi-chain support architecture
AI Engine
AI integration and automation
This architecture is designed for scalability and maintainability. The
monorepo structure enables efficient development while the microservices
approach ensures reliable production deployment and operation.