Files
botsmann/docs/archive/PROJECT_STRUCTURE.md
g-butandClaude Opus 4.6 2d5dc85501 refactor: remove dead code, archive historical docs, fix README
- Remove duplicate ApiResponse, apiSuccess, apiError, withErrorHandling,
  requireAuth, ERROR_MESSAGES from lib/api-utils.ts — only verifyUser
  was actually imported anywhere. Response utils SSOT is lib/api/responses.ts
- Archive 14 historical LEX-era design docs to docs/archive/ — docs/
  now has only 9 active reference files (down from 29)
- Remove mock data and placeholder images from Amazon/Ricardo platform
  integrations — functions return [] until real APIs are implemented
- Update platform tests to match actual behavior
- Fix README.md: update backend tech (Groq/OpenRouter), add Supabase
  to prerequisites

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 10:46:04 +01:00

12 KiB

Lex Project Structure

📁 Complete File Organization

botsmann/
│
├── 📚 DOCUMENTATION (Root Level)
│   ├── README_LEX.md                      # Main entry point - START HERE
│   ├── LEX_PROJECT_OVERVIEW.md           # Vision, features, roadmap
│   ├── LEX_TECHNICAL_ARCHITECTURE.md     # System design, data models
│   ├── MOBILE_FIRST_IMPROVEMENTS.md      # UX/UI decisions, responsive design
│   ├── DEMO_IMPROVEMENTS.md              # Feature evolution, before/after
│   ├── DATA_ROOM_GUIDE.md                # User manual for data room
│   ├── WORKSPACE_DASHBOARD_GUIDE.md      # Complete workspace/portal documentation
│   └── IMPLEMENTATION_SUMMARY.md         # What we built (this sprint)
│
├── app/bots/legal-expert/                # Main application
│   │
│   ├── page.tsx                          # Main page orchestrator
│   ├── BotNavigation.tsx                 # Navigation component
│   ├── styles.css                        # Custom styles & animations
│   │
│   └── components/
│       │
│       ├── 🎯 demo/                      # CORE - Interactive Demo
│       │   ├── DemoSection.tsx           # 4-step wizard orchestrator
│       │   ├── WorkspaceDashboard.tsx    # 🚀 Full-screen workspace portal
│       │   ├── DataRoomDemo.tsx          # ⭐ Live chat + file interface
│       │   ├── JurisdictionSelector.tsx  # Hierarchical jurisdiction picker
│       │   ├── FileUploader.tsx          # Drag-and-drop file upload
│       │   ├── LawyerMatcher.tsx         # AI-powered lawyer matching
│       │   ├── AIWorkspace.tsx           # File organization display
│       │   ├── jurisdictions.ts          # 130+ hierarchical jurisdictions
│       │   ├── constants.ts              # Legal areas, mock lawyers
│       │   ├── types.ts                  # TypeScript interfaces
│       │   └── README.md                 # Component architecture docs
│       │
│       ├── hero/
│       │   └── HeroSection.tsx           # Landing hero section
│       │
│       ├── disclaimer/
│       │   └── DisclaimerSection.tsx     # Legal disclaimer
│       │
│       ├── features/
│       │   └── FeaturesSection.tsx       # Features showcase
│       │
│       ├── how-it-works/
│       │   └── HowItWorksSection.tsx     # How it works explanation
│       │
│       ├── usecases/
│       │   └── UseCasesSection.tsx       # Use cases examples
│       │
│       ├── testimonials/
│       │   └── TestimonialsSection.tsx   # User testimonials (platform style)
│       │
│       ├── vision/
│       │   └── VisionSection.tsx         # Long-term vision
│       │
│       ├── tech/
│       │   └── TechSection.tsx           # Technology stack
│       │
│       └── cta/
│           └── CallToActionSection.tsx   # Waitlist form + honest KPIs
│
└── package.json                          # Dependencies

🔑 Key Files Explained

Documentation (Start Here)

1. README_LEX.md (Main Entry)

  • Project overview
  • Quick start guide
  • Tech stack
  • Features list
  • Read this first!

2. LEX_PROJECT_OVERVIEW.md (Business Context)

  • Vision and mission
  • Core features detailed
  • User flows
  • Success criteria
  • Roadmap
  • For understanding "why"

3. LEX_TECHNICAL_ARCHITECTURE.md (Engineering)

  • System architecture diagrams
  • Data models
  • Security design
  • AI integration
  • API documentation
  • For understanding "how"

4. MOBILE_FIRST_IMPROVEMENTS.md (UX/Design)

  • Responsive principles
  • Touch optimization
  • Design system
  • User experience
  • For designers/frontend

5. DATA_ROOM_GUIDE.md (User Manual)

  • How data room works
  • Chat usage
  • File management
  • Security & privacy
  • For end users

6. IMPLEMENTATION_SUMMARY.md (Sprint Summary)

  • What we built
  • How it fits together
  • Next steps
  • For stakeholders

Core Application Files

Demo Components (⭐ Most Important)

DemoSection.tsx

  • Main 4-step wizard
  • Orchestrates entire demo flow
  • State management
  • Navigation logic
  • Opens WorkspaceDashboard on step 3

WorkspaceDashboard.tsx (⭐ FLAGSHIP)

  • Full-screen immersive workspace portal
  • 5 views: Overview, Files, Chat, Timeline, Settings
  • Multi-level file visibility controls
  • Real-time AI + lawyer chat
  • Drag-and-drop file upload anywhere
  • Complete audit trail
  • This is the WOW factor!

DataRoomDemo.tsx

  • Live chat interface (AI + lawyer)
  • File management tabs
  • Activity timeline
  • Real-time simulation
  • Used in old Step 4 (now integrated in WorkspaceDashboard)

JurisdictionSelector.tsx

  • 130+ hierarchical jurisdictions
  • Search functionality
  • Breadcrumb navigation
  • Progressive disclosure

FileUploader.tsx

  • Drag-and-drop upload
  • File validation
  • AI auto-categorization
  • Status indicators

LawyerMatcher.tsx

  • AI-powered matching
  • Rich lawyer profiles
  • Real-time availability
  • One-tap selection

AIWorkspace.tsx

  • File organization display
  • Category-based view
  • AI insights
  • Processing status

Data & Types

jurisdictions.ts

  • 130+ jurisdictions
  • Hierarchical structure
  • US (50 states)
  • EU (27 countries)
  • Switzerland (26 cantons)
  • UAE, Singapore, Hong Kong, etc.

constants.ts

  • 12 legal areas
  • Mock lawyer profiles
  • File categories
  • Demo data

types.ts

  • TypeScript interfaces
  • Data models
  • Type safety

📊 Component Hierarchy

App
└── Page (legal-expert/page.tsx)
    ├── BotNavigation
    ├── HeroSection
    ├── DisclaimerSection
    ├── DemoSection ⭐
    │   ├── Step 1: Input
    │   │   ├── JurisdictionSelector
    │   │   ├── LegalAreaGrid
    │   │   ├── DescriptionTextarea
    │   │   ├── UrgencySelector
    │   │   └── FileUploader
    │   ├── Step 2: Matching
    │   │   ├── CaseSummary
    │   │   └── LawyerMatcher
    │   ├── Step 3: Workspace
    │   │   └── AIWorkspace
    │   └── Step 4: Data Room ⭐
    │       └── DataRoomDemo
    │           ├── ChatTab
    │           ├── FilesTab
    │           └── TimelineTab
    ├── FeaturesSection
    ├── HowItWorksSection
    ├── UseCasesSection
    ├── TestimonialsSection
    ├── VisionSection
    ├── TechSection
    └── CallToActionSection

🔄 Data Flow

User Journey

1. User lands on page
   └── Views hero + features

2. Tries demo
   └── DemoSection.tsx

3. Step 1: Inputs case details
   ├── Selects jurisdiction (JurisdictionSelector)
   ├── Chooses legal area
   ├── Writes description
   ├── Sets urgency
   └── Uploads files (FileUploader)

4. Step 2: Finds lawyer
   ├── AI matches lawyers (LawyerMatcher)
   └── User selects lawyer

5. Step 3: Views workspace
   └── Files organized (AIWorkspace)

6. Step 4: Enters data room ⭐
   ├── Chats with AI + lawyer (DataRoomDemo)
   ├── Manages files
   └── Views timeline

State Management

DemoSection (Parent)
├── caseContext: CaseContext
│   ├── jurisdiction: string
│   ├── legalArea: string
│   ├── description: string
│   ├── files: UploadedFile[]
│   └── urgency: string
│
├── selectedLawyer: string | null
├── step: 'input' | 'lawyer-match' | 'workspace' | 'dataroom'
│
└── Passes to children via props

📱 Responsive Breakpoints

/* Mobile First Approach */

Mobile:   base        /* < 640px */
Tablet:   sm: 640px+
Desktop:  lg: 1024px+
Wide:     xl: 1280px+

/* Example Usage */
.container {
  @apply grid grid-cols-1      /* Mobile: 1 column */
         sm:grid-cols-2         /* Tablet: 2 columns */
         lg:grid-cols-3         /* Desktop: 3 columns */
         xl:grid-cols-4; /* Wide: 4 columns */
}

🎨 Design System

Colors

Primary:   Blue-to-Cyan gradient (#3B82F6 → #06B6D4)
Success:   Green (#10B981)
Warning:   Yellow (#F59E0B)
Error:     Red (#EF4444)
Neutral:   Gray scale (#F3F4F6 → #111827)

Typography Scale

Mobile:   text-sm (14px) → text-lg (18px)
Tablet:   text-base (16px) → text-xl (20px)
Desktop:  text-lg (18px) → text-2xl (24px)

Spacing

Tight:    gap-2  (8px)
Normal:   gap-4  (16px)
Relaxed:  gap-6  (24px)
Loose:    gap-8  (32px)

🔍 Finding Things Quickly

Need to...

Understand the project? → Start with README_LEX.md

See technical architecture? → Read LEX_TECHNICAL_ARCHITECTURE.md

Know what was built? → Check IMPLEMENTATION_SUMMARY.md

Modify jurisdiction list? → Edit components/demo/jurisdictions.ts

Add new legal area? → Update components/demo/constants.ts

Change data room chat? → Edit components/demo/DataRoomDemo.tsx

Adjust mobile layout? → Review MOBILE_FIRST_IMPROVEMENTS.md then edit components

Update lawyer profiles? → Modify MOCK_LAWYERS in constants.ts

Change file categories? → Edit FILE_CATEGORIES in constants.ts

Add TypeScript types? → Update components/demo/types.ts


📦 Dependencies

Core

  • Next.js 14+
  • React 18
  • TypeScript 5+
  • Tailwind CSS 3+

Dev Tools

  • ESLint
  • Prettier (recommended)
  • TypeScript strict mode

🚀 Quick Commands

# Install
npm install

# Development
npm run dev

# Build
npm run build

# Type check
npx tsc --noEmit

# Lint
npm run lint

# Format (if Prettier configured)
npm run format

📊 File Stats

Total Documentation:     7 files
Total Components:        14 files
Total Lines of Code:     ~5,000
Total Documentation:     ~15,000 words
TypeScript Coverage:     100%
Mobile Responsive:       ✅ Yes
Production Ready:        ✅ Yes

🎯 What Each File Does (One-Liner)

File Purpose
README_LEX.md Main project documentation and quick start
LEX_PROJECT_OVERVIEW.md Business vision, features, roadmap
LEX_TECHNICAL_ARCHITECTURE.md System design, data models, API
MOBILE_FIRST_IMPROVEMENTS.md UX decisions, responsive design
DATA_ROOM_GUIDE.md User manual for data room feature
DEMO_IMPROVEMENTS.md Feature changelog and evolution
IMPLEMENTATION_SUMMARY.md Sprint summary and deliverables
DemoSection.tsx Main demo wizard orchestrator
DataRoomDemo.tsx Live chat + file interface
JurisdictionSelector.tsx 130+ hierarchical jurisdictions
FileUploader.tsx Drag-and-drop file upload
LawyerMatcher.tsx AI-powered lawyer matching
AIWorkspace.tsx File organization display
jurisdictions.ts Jurisdiction data (130+ items)
constants.ts Legal areas, mock data
types.ts TypeScript type definitions

This structure is designed for:

  • ✅ Easy onboarding (new engineers)
  • ✅ Quick navigation (find files fast)
  • ✅ Clear organization (logical grouping)
  • ✅ Scalability (easy to add features)
  • ✅ Maintainability (well-documented)

Last Updated: January 2026