Your First Conversation

This guide walks you through building your first application with Mosaic Builder, step by step. We'll create a complete task management system through natural conversation.

Before You Start

Make sure you have:

  • • ✅ Mosaic Builder running locally (Installation Guide)
  • • ✅ Logged in or created an account
  • • ✅ The chat interface open at http://localhost:3000
  • Understanding the Interface

    Main Components

    ┌─────────────────────────────────────────────┐
    │  Mosaic Builder                            │
    ├──────────────┬──────────────────────────────┤
    │              │                              │
    │   Chat       │      DSL Panel               │
    │   Messages   │   ┌──────────────────┐       │
    │              │   │ Phase: Discovering│       │
    │   [Input]    │   │ Readiness: 0%     │       │
    │              │   │ Entities: []      │       │
    │              │   └──────────────────┘       │
    └──────────────┴──────────────────────────────┘

  • Left: Chat conversation
  • Right: Real-time DSL extraction
  • Bottom Right: Code generation button (appears at 75%+ readiness)
  • Step 1: Start the Conversation

    Your First Message

    Type this in the chat:
    I need a task management application for my team

    What Happens

    Watch as the AI responds and the DSL panel updates: AI Response: > I'll help you build a task management application. Let me understand your requirements... > > I can see you'll need to track tasks for your team. Let me ask a few questions to better understand your needs: > - Should tasks be organized into projects or categories? > - Do you need user accounts and authentication? > - What information should each task contain? DSL Panel Updates:
  • • Phase: Discovering 🔵
  • • Readiness: 10%
  • • Entities detected: Task, Team
  • Step 2: Add More Details

    Provide Requirements

    Continue the conversation:
    Yes, tasks should be organized into projects. 
    Each task needs a title, description, status (todo, in progress, done), 
    priority (low, medium, high), assignee, and due date. 
    Team members should be able to create and edit tasks.

    Observe the Evolution

    AI Response: > Great! I'm understanding your structure better. You want: > - Projects to organize tasks > - Tasks with detailed tracking fields > - Team members who can manage tasks > > Should team members have different roles (like admin, member)? > And do you want to track task history or comments? DSL Panel Updates:
  • • Phase: Clarifying 🟡
  • • Readiness: 35%
  • • Entities:
  •   - Project
      - Task (fields: title, description, status, priority, dueDate)
      - TeamMember

  • • Relationships:
  •   - Project → Tasks (one-to-many)
      - Task → TeamMember (many-to-one: assignee)

    Step 3: Clarify and Refine

    Add Business Logic

    Yes, we need two roles: admin and member. 
    Admins can create projects and invite members. 
    Members can only work on tasks in their projects. 
    Add comments on tasks for collaboration.

    Watch Confidence Build

    AI Response: > Perfect! I now have a clear picture of your task management system. Here's what I understand: > > Entities: > - User (with roles: admin, member) > - Project > - Task (with all the fields you mentioned) > - Comment > > Key Relationships: > - Projects have many Tasks > - Tasks belong to one Project > - Tasks have one assignee (User) > - Tasks have many Comments > - Users can be in many Projects > > Permissions: > - Admins: full access, create projects, invite members > - Members: create/edit tasks in their projects > > Is this correct? Should I add anything else like task attachments or notifications? DSL Panel Updates:
  • • Phase: Proposing 🟣
  • • Readiness: 65%
  • • Complete entity structure visible
  • • Confidence indicators show high certainty
  • Step 4: Confirm Structure

    Validate Understanding

    That's exactly right! Also add:
    - Task attachments for files
    - Email notifications when tasks are assigned
    - Activity log to track changes

    Final Refinements

    AI Response: > Excellent! I've added those features. Your task management system now includes: > > ✅ Complete entity model with Users, Projects, Tasks, Comments, Attachments > ✅ Role-based permissions (Admin/Member) > ✅ File attachments on tasks > ✅ Email notifications for assignments > ✅ Activity logging for audit trail > > The structure is ready for code generation. Would you like me to explain any part of the model, or shall we proceed with generating the code? DSL Panel Updates:
  • • Phase: Confirming 🟢
  • • Readiness: 85%
  • • All entities fully defined
  • • Code Generation button appears! 🎉
  • Step 5: Generate Code

    Review Before Generation

    Check the DSL Panel to see:

    Entities:
      User:
        - id: uuid
        - email: string (unique)
        - name: string
        - role: enum [admin, member]
        - createdAt: datetime
        
      Project:
        - id: uuid
        - name: string
        - description: text
        - ownerId: uuid (ref: User)
        - createdAt: datetime
        
      Task:
        - id: uuid
        - title: string
        - description: text
        - status: enum [todo, in_progress, done]
        - priority: enum [low, medium, high]
        - projectId: uuid (ref: Project)
        - assigneeId: uuid (ref: User)
        - dueDate: datetime
        - createdAt: datetime
        - updatedAt: datetime
        
      Comment:
        - id: uuid
        - content: text
        - taskId: uuid (ref: Task)
        - authorId: uuid (ref: User)
        - createdAt: datetime
        
      Attachment:
        - id: uuid
        - filename: string
        - url: string
        - taskId: uuid (ref: Task)
        - uploadedBy: uuid (ref: User)
        - createdAt: datetime
        
      ActivityLog:
        - id: uuid
        - action: string
        - entityType: string
        - entityId: uuid
        - userId: uuid (ref: User)
        - metadata: json
        - createdAt: datetime
    
    Relationships:
      - User → Projects (many-to-many via membership)
      - Project → Tasks (one-to-many)
      - Task → Comments (one-to-many)
      - Task → Attachments (one-to-many)
      - User → ActivityLogs (one-to-many)

    Click Generate Code

    Click the "Generate Code" button. Options appear:

  • Database Schema
  • - [ ] Prisma Schema - [ ] Drizzle Schema - [ ] SQL Migrations
  • Backend Code
  • - [ ] API Routes - [ ] Authentication - [ ] Authorization
  • Frontend
  • - [ ] React Components - [ ] Forms - [ ] Tables/Lists

    Select what you need and click "Generate".

    Step 6: Review Generated Code

    Prisma Schema Example

    model User {
      id        String   @id @default(uuid())
      email     String   @unique
      name      String
      role      Role     @default(MEMBER)
      createdAt DateTime @default(now())
      
      ownedProjects Project[]      @relation("ProjectOwner")
      projects      ProjectMember[]
      assignedTasks Task[]
      comments      Comment[]
      attachments   Attachment[]
      activities    ActivityLog[]
    }
    
    model Project {
      id          String   @id @default(uuid())
      name        String
      description String?
      ownerId     String
      owner       User     @relation("ProjectOwner", fields: [ownerId], references: [id])
      createdAt   DateTime @default(now())
      
      tasks   Task[]
      members ProjectMember[]
    }
    
    model Task {
      id          String    @id @default(uuid())
      title       String
      description String?
      status      Status    @default(TODO)
      priority    Priority  @default(MEDIUM)
      projectId   String
      project     Project   @relation(fields: [projectId], references: [id])
      assigneeId  String?
      assignee    User?     @relation(fields: [assigneeId], references: [id])
      dueDate     DateTime?
      createdAt   DateTime  @default(now())
      updatedAt   DateTime  @updatedAt
      
      comments    Comment[]
      attachments Attachment[]
    }
    
    enum Role {
      ADMIN
      MEMBER
    }
    
    enum Status {
      TODO
      IN_PROGRESS
      DONE
    }
    
    enum Priority {
      LOW
      MEDIUM
      HIGH
    }

    API Route Example

    // app/api/tasks/route.ts
    export async function GET(request: Request) {
      const tasks = await prisma.task.findMany({
        include: {
          assignee: true,
          project: true,
          comments: { take: 5 }
        }
      });
      return Response.json(tasks);
    }
    
    export async function POST(request: Request) {
      const data = await request.json();
      const task = await prisma.task.create({
        data: {
          ...data,
          // Send notification
          // Log activity
        }
      });
      return Response.json(task);
    }

    Step 7: Iterate and Improve

    Continue the Conversation

    You can keep refining:
    Add a dashboard that shows:
    - Tasks due today
    - Overdue tasks
    - Team workload
    - Project progress

    The AI will update the DSL and you can regenerate code with the new features.

    Common Patterns

    Adding Features Progressively

    Start simple, then add complexity:
  • "I need a blog" → Basic blog
  • "Add categories" → Blog with categories
  • "Add comments" → Blog with comments
  • "Add moderation" → Full-featured blog
  • Clarifying Relationships

    Be explicit about connections:
  • • ✅ "Each user can create many posts"
  • • ✅ "Posts can have multiple tags"
  • • ✅ "Users can follow other users"
  • Specifying Business Rules

    Include logic and constraints:
  • • ✅ "Only admins can delete posts"
  • • ✅ "Tasks become overdue after the due date"
  • • ✅ "Users can only edit their own comments"
  • Tips for Success

    1. Start with Core Entities

    Begin with the main objects:
  • • Task manager → Tasks
  • • Blog → Posts
  • • E-commerce → Products
  • 2. Add Relationships Naturally

    Describe how things connect:
  • • "Tasks belong to projects"
  • • "Users can comment on posts"
  • • "Orders contain multiple products"
  • 3. Include Important Fields

    Mention specific data needs:
  • • "Tasks need priority and due dates"
  • • "Products have SKU and inventory count"
  • • "Users have email and profile photo"
  • 4. Describe Workflows

    Explain how things work:
  • • "When a task is completed, notify the reporter"
  • • "Archive posts older than 6 months"
  • • "Calculate shipping based on weight"
  • What's Next?

    Explore More Features

  • Understanding DSL Extraction
  • Conversation Phases
  • Code Generation Options
  • Build Complex Applications

  • Tutorial: Building a CRM
  • Tutorial: E-commerce Platform
  • Deploy Your Application

  • Deploy to Vercel
  • Database Setup
  • Troubleshooting

    DSL Not Updating?

  • • Ensure your message contains entities or relationships
  • • Be specific about structure
  • • Check the browser console for errors
  • Low Confidence?

  • • Provide more details
  • • Clarify ambiguous relationships
  • • Confirm the AI's understanding
  • Generation Failed?

  • • Ensure readiness is above 75%
  • • Check all entities have required fields
  • • Verify relationships make sense
  • Get Help

  • • 📖 Documentation
  • • 💬 Community Discord
  • • 🐛 Report Issues