Skip to content

nextify-limited/libra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Libra AI

Libra logo

Open Source Alternative to V0/Lovable

Libra AI: Language as Application - Launch, iterate, and deploy your next web application with a single sentence.

SPONSORED BY CLERK SPONSORED BY E2B FOR STARTUPS SPONSORED BY POSTHOG FOR STARTUPS SPONSORED BY DAYTONA STARTUP GRID SPONSORED BY CLOUDFLARE FOR STARTUPS

Open Source License Made by Nextify2024

🌐 Try Now β€’ πŸ“– Documentation β€’ πŸ’¬ Join Community β€’ ⚑ View Source

πŸ‡¨πŸ‡³ δΈ­ζ–‡η‰ˆ


πŸš€ What is Libra AI?

Libra AI is a production-ready AI-native development platform that enables full lifecycle management of web applications through natural language interaction. Built with modern technology architecture, it covers the complete engineering process from rapid prototyping to enterprise-grade production deployment.

Just as V0 is deeply integrated with the Vercel ecosystem, Libra is specifically designed for the Cloudflare Workers architecture, providing a native AI development experience.

✨ Core Features

πŸ€– AI-Powered Coding

  • Multi-model integration: Claude, OpenAI, Gemini, DeepSeek, and more
  • Natural language-driven production-grade code generation
  • Intelligent context awareness and best practice adherence
  • Multi-sandbox provider support (E2B, Daytona)

πŸ› οΈ Integrated Development Experience

  • Cloud IDE: syntax highlighting, smart indentation, custom plugins
  • Hot Module Replacement (HMR) real-time preview
  • Intelligent dependency analysis and automatic installation

πŸ”— Full-Stack Integration

  • Seamless GitHub integration with one-way sync
  • Cloudflare edge computing deployment
  • Enterprise-grade identity authentication (OAuth 2.0)
  • Stripe commercial subscription management

🌐 Production Deployment

  • Cloudflare Workers edge computing network
  • Serverless architecture with elastic scaling
  • Automated TLS/SSL certificate management
  • Git version control with one-click rollback

Why Open Source?

  • πŸ“‚ Technical Autonomy: Avoid vendor lock-in risks
  • πŸ”§ Architectural Flexibility: Support for deep customization and extension
  • πŸ’ Community Ecosystem: Open source community collaboration

πŸ—οΈ Technical Architecture

Libra is built entirely on Cloudflare. You need to be familiar with the following products:

Compute & Runtime

Product Name Description Application in Libra
Workers Serverless computing platform Core application runtime environment, hosting all service logic
Durable Objects Strong consistency storage Real-time state management and session persistence
Browser Rendering Browser rendering service Web screenshot generation and preview functionality
Workers for Platforms Multi-tenant platform User project isolation deployment and routing management

Data Storage

Product Name Description Application in Libra
KV Global key-value storage Configuration caching and temporary data storage
D1 Serverless SQLite database Authentication data and lightweight business data
Hyperdrive Database connection acceleration PostgreSQL connection pooling and query optimization
R2 Object storage service File uploads, static assets, and build artifact storage

Network & Security

Product Name Description Application in Libra
Turnstile Smart CAPTCHA Security verification for user registration and sensitive operations
Cloudflare for SaaS Custom domain management Custom domain binding and SSL certificates for user projects

Development Tools & Services

Product Name Description Application in Libra
Workflows Workflow orchestration Step-by-step management of complex deployment processes
Queues Message queue service Asynchronous task processing and batch deployment management
AI Gateway AI model gateway Monitor and control your AI applications
Images Image processing optimization Dynamic image transformation and CDN distribution

Libra adopts Turborepo Monorepo architecture design:

libra/
β”œβ”€β”€ apps/                    # Core application services
β”‚   β”œβ”€β”€ auth-studio/         # Authentication management console (D1 + drizzle-kit)
β”‚   β”œβ”€β”€ builder/             # Vite build service - code compilation and deployment
β”‚   β”œβ”€β”€ cdn/                 # Hono CDN service - static asset management
β”‚   β”œβ”€β”€ deploy/              # Deployment service V2 - Cloudflare Queues
β”‚   β”œβ”€β”€ deploy-workflow/     # Deployment service V1 - Cloudflare Workflows (deprecated)
β”‚   β”œβ”€β”€ dispatcher/          # Request routing dispatcher (Workers for Platforms)
β”‚   β”œβ”€β”€ docs/                # Technical documentation site (Next.js + FumaDocs)
β”‚   β”œβ”€β”€ email/               # Email service previewer (React Email)
β”‚   β”œβ”€β”€ opennext-cache/      # OpenNext cache service (Cloudflare)
β”‚   β”œβ”€β”€ screenshot/          # Screenshot service - Cloudflare Queues
β”‚   β”œβ”€β”€ vite-shadcn-template/# Project template engine (Vite + shadcn/ui)
β”‚   └── web/                 # Next.js 15 main application (React 19)
β”œβ”€β”€ packages/                # Shared package modules
β”‚   β”œβ”€β”€ api/                 # API layer (tRPC + type safety)
β”‚   β”œβ”€β”€ auth/                # Authentication service (better-auth)
β”‚   β”œβ”€β”€ better-auth-cloudflare/ # Cloudflare authentication adapter
β”‚   β”œβ”€β”€ better-auth-stripe/  # Stripe payment integration
β”‚   β”œβ”€β”€ common/              # Common utility library and type definitions
β”‚   β”œβ”€β”€ db/                  # Main database schema and operations (PostgreSQL)
β”‚   β”œβ”€β”€ email/               # Email service components
β”‚   β”œβ”€β”€ middleware/          # Middleware services and tools
β”‚   β”œβ”€β”€ sandbox/             # Unified sandbox abstraction layer (E2B + Daytona)
β”‚   β”œβ”€β”€ shikicode/           # Code editor (Shiki syntax highlighting)
β”‚   β”œβ”€β”€ templates/           # Project scaffolding templates
β”‚   └── ui/                  # Design system (shadcn/ui + Tailwind CSS v4)
β”œβ”€β”€ tooling/                 # Development tools and configuration
β”‚   └── typescript-config/   # Shared TypeScript configuration
└── scripts/                 # GitHub environment variable management

Application Services Overview

πŸ”’ Authentication Management Center (apps/auth-studio)

  • User, organization, permission, and subscription lifecycle management
  • Main database uses PostgreSQL (via Neon + Hyperdrive), authentication data uses D1 (SQLite)
  • OAuth 2.0 multi-provider authentication system
  • Stripe commercial payment gateway integration

πŸ”¨ Build Compilation Service (apps/builder)

  • Vite high-performance build engine with millisecond-level hot startup
  • Automatic code compilation and seamless production deployment
  • Multi-tech-stack project template rapid instantiation

πŸ“Ί Content Distribution Service (apps/cdn)

  • Hono framework-driven file management system
  • Intelligent image processing and compression optimization
  • Global CDN edge caching acceleration
  • Cloudflare Workers edge deployment

πŸš€ Deployment Service V2 (apps/deploy)

  • Modern deployment architecture based on Cloudflare Queues
  • Batch processing and concurrency control
  • D1 database state management
  • Dead letter queue handling for failed deployments
  • Comprehensive error handling and retry logic

⚑ Deployment Service V1 (apps/deploy-workflow, deprecated)

  • Deployment orchestration based on Cloudflare Workflows
  • Step-by-step deployment process and state management
  • Built-in retry mechanism and error recovery
  • Support for complex deployment scenarios and dependency management

πŸ”€ Request Routing Service (apps/dispatcher)

  • Workers for Platforms core routing component
  • Route user domain requests to corresponding Worker instances
  • Dynamic Worker scheduling and lifecycle management
  • Custom domain binding and SSL certificate handling
  • Unified authentication and access control layer
  • Cloudflare SaaS for Platforms integration

πŸ“– Technical Documentation Site (apps/docs)

  • FumaDocs modern documentation solution
  • Cloudflare Workers global distribution

πŸ“§ Email Notification Service (apps/email)

  • React Email component-based email development
  • Multi-scenario email template engine

πŸ”„ OpenNext Cache Service (apps/opennext-cache)

  • Next.js Cloudflare deployment cache optimization
  • OpenNext framework and Cloudflare Workers integration
  • Seamless integration with main web application deployment

πŸ“Έ Screenshot Service (apps/screenshot)

  • Cloudflare Queues-based screenshot generation
  • Asynchronous queue processing for web screenshot requests
  • Automated website preview image generation
  • R2 storage for screenshot files
  • Batch processing and error retry

πŸ”¨ Project Scaffolding Service (apps/vite-shadcn-template)

  • Vite high-performance build toolchain
  • Fast compilation and production deployment
  • Pre-configured shadcn/ui + Tailwind CSS v4
  • Visual template selection and preview

🌐 Core Web Application (apps/web)

  • Next.js 15 App Router + React 19 technology stack
  • Platform main interface and user interaction layer
  • AI-driven intelligent conversation and project management
  • Real-time code editing, preview, deployment, and version control
  • Cloudflare Workers serverless deployment

πŸ› οΈ Core Technology Stack

Frontend Technology Architecture

Technology Framework Application Scenario Version
Next.js React full-stack development framework (App Router) 15.3.5
React User interface library (Server Components) 19.1.1
TypeScript Statically typed JavaScript superset 5.8.3+
Tailwind CSS Utility-first CSS framework 4.1.11
shadcn/ui Component library and design system Based on Radix UI
Radix UI Unstyled accessible UI primitive library 1.2.x-1.3.x
Motion Modern animation engine 12.23.11
Lucide React Vector icon library 0.486.0

Backend & API Architecture

Technology Framework Application Scenario Version
tRPC End-to-end type-safe API development 11.4.3+
Hono Edge computing web framework 4.8.10+
Zod TypeScript data validation library 4.0.14
Drizzle ORM Type-safe TypeScript ORM 0.44.4
better-auth Modern identity authentication solution 1.3.4

AI & Machine Learning

AI Platform Features API Version
AI SDK Multi-provider AI model integration 4.3.19
E2B Secure code execution sandbox 1.2.0-beta.5
Daytona Development environment sandbox provider Latest
Integrated AI Models
Anthropic Claude Advanced reasoning and code generation API v1
Azure OpenAI Enterprise-grade AI model service API v1
Google Gemini Multimodal AI capabilities API v1
DeepSeek Cost-effective code generation API v1

Data Storage Architecture

Database Technology Application Scenario Version
Neon Main database (PostgreSQL) 17+
Cloudflare Hyperdrive Database connection pooling and acceleration Latest
Cloudflare D1 Edge database (SQLite) Latest
Drizzle Kit Database migration tool 0.31.4+

Deployment & Infrastructure

Platform Technology Application Scenario Version
Cloudflare Workers Serverless edge computing platform Latest
OpenNext Next.js Cloudflare deployment adapter 1.6.2
Turborepo High-performance Monorepo build system 2.5.5
Bun JavaScript runtime and package manager 1.2.19

Development Toolchain

Tool Purpose Version
Biome Code formatting and quality checking 2.0.6
Vitest Unit testing framework 3.2.4
Paraglide.js Internationalization i18n solution 2.2.0

⚑ Quick Start

🎯 Choose Your Usage Method

🌐 Cloud Hosted Service (Recommended)

  • Visit libra.dev to get started
  • Quick registration with GitHub OAuth or email
  • Build production-grade applications in minutes

πŸ’» Local Development Deployment (Developers)

  • Complete source code access and control
  • Deep customization development and extension
  • Private/enterprise-grade deployment

πŸ“¦ Environment Requirements

# System dependency requirements
git --version   # >= 2.30.0
node --version  # >= 20.0.0 (recommend 24)
bun --version   # >= 1.0.0

πŸš€ Local Environment Setup

Step 1: Get Source Code

git clone https://github.com/nextify-limited/libra.git
cd libra
bun install
# (Optional) Generate i18n files for apps/web
cd apps/web && bun run prebuild && cd ../..

Step 2: Configure Environment Variables

cp .env.example .env

Edit the .env file to configure necessary environment variables.

Step 3: Initialize Database

Main database (PostgreSQL) initialization:

# Generate and run migrations from project root
cd packages/db
bun db:generate
bun db:migrate

Authentication database (D1/SQLite) initialization:

# Test D1 database connection (local environment)
cd apps/web && bun wrangler d1 execute libra --local --command='SELECT 1'

# Generate and run authentication database migrations
cd packages/auth
bun db:generate
bun db:migrate

Step 4: Start Development Services

# Start all services
bun dev

# Or start main application separately
cd apps/web && bun dev

Step 5: Configure Stripe Payment (Required)

Configure corresponding products:

stripe listen --forward-to localhost:3000/api/auth/stripe/webhook

🌐 Local Service Addresses

After setup, you can access various services through the following addresses:

πŸš€ Deployment Options

🌐 Cloud Hosted Service (Recommended)

Ready-to-use cloud development experience:

  1. Visit libra.dev official platform
  2. Quick registration with GitHub OAuth or email
  3. AI-driven rapid application building
  4. One-click deployment to custom domains

Cloud Service Advantages:

  • Zero-configuration out-of-the-box
  • Elastic scaling and automatic updates
  • Built-in AI model integration
  • Enterprise-grade technical support

🏠 Self-Hosted Deployment

1. Deploy Libra Platform Itself

All Libra platform services are deployed on Cloudflare Workers:

# Deploy various services to Cloudflare Workers
# Refer to the following workflow files for complete deployment process:
# - .github/workflows/web.yml - Main application deployment
# - .github/workflows/cdn.yml - CDN service deployment
# - .github/workflows/deploy.yml - Deployment service deployment
# - .github/workflows/dispatcher.yml - Routing service deployment
# - .github/workflows/screenshot.yml - Screenshot service deployment
# - .github/workflows/docs.yml - Documentation site deployment

2. Deploy User Projects as PaaS Platform

Libra uses Workers for Platforms technology to provide project deployment capabilities for users, offering two deployment service architectures:

  1. Workers for Platforms Architecture:

    • Each user project is deployed as an independent Worker
    • Intelligent routing through dispatcher service
    • Support for custom domain binding
    • Completely isolated runtime environment (process-level isolation through Workers for Platforms)
  2. Deployment Service Architecture Options:

    V2 Queue Architecture (apps/deploy):

    • Cloudflare Queues: Asynchronous queue processing for deployment tasks
    • Batch Processing: Support for concurrency control and batch deployment
    • Dead Letter Queue: Retry mechanism for handling failed deployments
    • Use Cases: High concurrency, large-scale deployment needs

    V1 Workflow Architecture (apps/deploy-workflow, deprecated):

    • Cloudflare Workflows: Step-by-step deployment orchestration
    • State Persistence: Built-in state management and recovery mechanism
    • Complex Processes: Support for complex deployment dependencies and conditional logic
    • Use Cases: Complex deployment processes, scenarios requiring precise control
  3. General Deployment Process:

    • Verify user permissions and project quotas
    • Create sandbox environment for secure building (supports E2B or Daytona)
    • Sync project files
    • Execute build commands (bun install & bun build)
    • Deploy to user's Worker instance using Wrangler API
    • Update routing configuration, clean up temporary environment
  4. Technical Features:

    • Sandbox Environment: Secure isolated build environment (supports E2B or Daytona)
    • Global Distribution: Leverage Cloudflare edge computing network
    • Flexible Architecture: Choose appropriate deployment service based on needs

🎯 Hosted Platform vs Open Source

πŸ“Š Feature Comparison

Feature Hosted Platform Open Source Notes
πŸ€– AI Code Generation βœ… Out-of-the-box ❌ Requires API key configuration Multi-AI provider integration
πŸ”§ Development Environment βœ… Zero configuration ❌ Requires sandbox environment setup Cloud IDE and real-time preview
πŸ“‚ GitHub Integration βœ… One-click connection ❌ Requires OAuth authorization setup Repository auto-creation and sync
🌐 Deployment Service βœ… Built-in support ❌ Requires deployment environment setup Cloudflare native integration
🎨 Editor βœ… Full features ❌ Basic visual editing Visual editing and preview
πŸ”’ Data Control πŸ”’ Cloud hosted βœ… Complete private control Self-hosted data complete control
πŸ› οΈ Custom Development ⚠️ Platform limitations βœ… Unlimited customization Source-level modification and extension
πŸ“ž Technical Support βœ… Professional service 🀝 Community support Official service vs open source community
πŸ’° Cost Structure πŸ’° Pay-as-you-go πŸ†“ Infrastructure costs SaaS subscription vs self-maintenance

πŸ€” How to Choose the Right Version?

Choose Cloud Hosting if you

  • πŸš€ Quick Launch: No complex configuration needed, start application development immediately
  • πŸ’Ό Business Priority: Focus on product development rather than infrastructure operations
  • πŸ‘₯ Team Collaboration: Need enterprise-grade team management features
  • πŸ“ž Professional Service: Expect official technical support and SLA guarantees
  • πŸ”„ Automatic Operations: Want platform automated updates and maintenance

Choose Open Source if you

  • 🏠 Data Autonomy: Complete control over data storage and processing
  • πŸ”§ Deep Customization: Need to modify core functionality or integrate proprietary business logic
  • πŸ’° Cost Control: Have technical team, need to optimize long-term operational costs
  • 🌍 Special Deployment: Specific region/private network/offline environment deployment
  • πŸ“š Technical Learning: Deep understanding of complete technical architecture design

❓ Frequently Asked Questions

πŸ†š Product Versions

Q: What are the core differences between the hosted platform and open source version?

A: Cloud hosting is an official SaaS service, ready to use upon registration, including complete AI capabilities and enterprise-grade features. Open source version provides core source code, supports self-deployment and deep customization, but requires self-configuration of AI APIs and operational environment.

Q: How complete are the features in the open source version?

A: The open source version includes the platform's core functional architecture. We follow the principle of "99% features open source, 1% commercial services" to ensure developers can access complete technical capabilities.

πŸ› οΈ Technical Issues

Q: What technical background is required to use Libra?

A: Depends on usage method:

  • Hosted platform users: No technical background required, just need to use a browser
  • Local developers: Need basic web development knowledge and Node.js experience
  • Self-hosted deployment: Need server and DevOps practical experience

Q: How is the quality of AI-generated code?

A: We always pursue production-grade code quality:

  • Complete TypeScript type safety guarantee
  • Follow modern React development patterns and industry best practices
  • Responsive design implementation based on Tailwind CSS
  • Accessible components integrated with Radix UI
  • Clear and maintainable code structure and comments

Q: Can I customize AI behavior and prompts?

A: Full customization is supported in the open source version:

  • Custom AI prompt engineering
  • Flexible model selection logic configuration
  • Modify code generation templates
  • Integrate third-party AI services

πŸ’Ό Commercial Use

Q: Can Libra be used for commercial projects?

A: Absolutely. We provide multiple commercial solutions:

  • Hosted platform: Business-friendly pay-as-you-go model
  • Open source version: Follows AGPL-3.0 open source license, requires derivative projects to also be open source
  • Commercial licensing: Provides commercial open source licenses for enterprises requiring closed-source deployment

Q: How about data security and privacy protection?

A: We provide different levels of data protection solutions:

  • Hosted platform: Data processed in our secure infrastructure, compliant with international security standards
  • Self-hosted deployment: You have complete control over data storage, processing, and access permissions
  • Enterprise customization: Can provide customized solutions based on special security requirements and compliance needs

Q: Do you provide enterprise-grade technical support?

A: Yes. Our enterprise services include:

  • Private cloud environment deployment
  • Custom feature development services
  • Dedicated technical support team
  • Service Level Agreement (SLA) guarantees
  • Security auditing and compliance support

For enterprise services, please contact: [email protected]

πŸ”§ Development & Deployment

Q: Which deployment platforms are supported?

A: Currently only supports deployment on Cloudflare

Q: How to participate in open source project contributions?

A: We warmly welcome community contributions. For specific methods, please refer to the Community Contribution Guidelines below.

🀝 Community Contribution

We warmly welcome contributions from developers worldwide! Here are the ways you can participate:

🌟 Usage & Promotion

  • Experience Libra platform and share your usage experience
  • Create amazing application projects and showcase them in the community
  • Write technical blog articles or create tutorial videos
  • Share and recommend Libra on social media platforms

πŸ”§ Code Contribution

# 1. Fork our repository on GitHub
# 2. Clone your fork to local
git clone https://github.com/your-username/libra.git
cd libra

# 3. Create feature development branch
git checkout -b feature/your-amazing-feature

# 4. Develop and test thoroughly
bun install
bun dev

# 5. Commit code with clear commit messages
git commit -m "feat: add incredible new feature"

# 6. Push branch and create Pull Request
git push origin feature/your-amazing-feature

πŸ“ Other Contribution Methods

  • Documentation Improvement: Improve usage guides, add example code, fix documentation errors
  • Issue Reporting: Help us discover and locate system issues
  • Feature Suggestions: Propose improvement ideas and new feature requirements
  • Multi-language Support: Help translate Libra into more languages
    • Project uses Paraglide.js for internationalization
    • Translation file location: apps/web/messages/[locale].json
    • Add new language: Add language code in apps/web/project.inlang/settings.json
  • Community Support: Help other users in forum and GitHub discussions

🎯 Contribution Guidelines

  • Please follow our Code of Conduct
  • Read and follow Contribution Guidelines
  • Use standardized commit message format (Conventional Commits)
  • Provide corresponding test cases for new features
  • Update relevant documentation in a timely manner

πŸ“„ Open Source License

πŸ“œ AGPL-3.0 Open Source License

Libra is released under the GNU Affero General Public License v3.0 open source license.

βœ… Your Rights

  • πŸ†“ Free Use: Free to use for personal, educational, and commercial projects
  • πŸ”§ Modification and Customization: Free to modify and extend code functionality
  • πŸ“€ Distribution and Sharing: Can share with others under the same license
  • 🏒 Commercial Deployment: Allowed for commercial purpose deployment

πŸ“‹ Your Obligations

  • πŸ“„ Retain Copyright Information: Must retain original copyright notices
  • πŸ”“ Open Source Derivative Works: Must provide source code for any modifications
  • πŸ“§ Network Service Open Source: Must open source when providing services over network
  • πŸ”— Use Same License: Derivative works must use AGPL-3.0 license

πŸ’Ό Commercial License

If you need more flexibility, we provide commercial licenses suitable for:

  • Closed-source proprietary modifications
  • Product distribution without open sourcing
  • Customized licensing terms

Commercial licensing consultation: [email protected]

πŸ’¬ Participate in Roadmap Discussion

We welcome community participation in roadmap planning:

πŸ™ Acknowledgments

Thanks to the following excellent sponsors for their valuable support to the Libra project, enabling us to focus on building better AI development experiences for developers:

Clerk - The most comprehensive user management platform

E2B - E2B is an open-source runtime environment for executing AI-generated code in secure cloud sandboxes, suitable for intelligent agents and AI application scenarios.

PostHog - A single platform for analytics, testing, observing, and deploying new features

Daytona - Daytona is a secure and resilient infrastructure for running AI-generated code

Cloudflare - Global leading edge computing and network infrastructure provider


Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •