Tech Stack
Architecture
┌─────────────────────────────────────────────────────────────────────────┐
│ PHONY - ARCHITECTURE │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ ╔═══════════════════════════════════════════════════════════════════╗ │
│ ║ OSS LIBRARIES ║ │
│ ╠═══════════════════════════════════════════════════════════════════╣ │
│ ║ ║ │
│ ║ APPROACH: Pure native implementation per language ║ │
│ ║ DEVELOPMENT: AI-assisted (AI writes, human reviews) ║ │
│ ║ FORMAT: Shared .phony model format (MessagePack) ║ │
│ ║ ║ │
│ ║ TIMELINE: ║ │
│ ║ ├── Year 1: PHP/Laravel (phonyland/phony) ║ │
│ ║ ├── Year 2: Python (phony - pip) ★ Revenue focus ║ │
│ ║ ├── Year 3: TypeScript (@phonyland/phony) - Optional ║ │
│ ║ └── Future: Community contributions for other languages ║ │
│ ║ ║ │
│ ║ PERFORMANCE: ~50-100K records/sec (good enough for typical use) ║ │
│ ║ MAINTENANCE: Community can maintain non-PHP implementations ║ │
│ ║ ║ │
│ ╚═══════════════════════════════════════════════════════════════════╝ │
│ │
│ ╔═══════════════════════════════════════════════════════════════════╗ │
│ ║ CLOUD PLATFORM ║ │
│ ╠═══════════════════════════════════════════════════════════════════╣ │
│ ║ ║ │
│ ║ STACK: Nuxt + Go + Rust (3 languages) ║ │
│ ║ ║ │
│ ║ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ║ │
│ ║ │ NUXT │ │ GO │ │ RUST │ ║ │
│ ║ │ Dashboard │ │ Engine │ │ Core │ ║ │
│ ║ │ │ │ │ │ │ ║ │
│ ║ │ • Vue 3 │ │ • DB Sync │ │ • N-gram │ ║ │
│ ║ │ • TypeScript│ → │ • Mock API │ → │ • Train │ ║ │
│ ║ │ • Auth │ │ • Training │ │ • Generate │ ║ │
│ ║ │ • Billing │ │ • pgx (DB) │ │ • Model I/O │ ║ │
│ ║ │ │ │ │ │ │ ║ │
│ ║ └─────────────┘ └─────────────┘ └─────────────┘ ║ │
│ ║ ║ │
│ ║ NO LARAVEL: Go handles all backend (sync, API, processing) ║ │
│ ║ PERFORMANCE: ~5M records/sec (Rust-powered) ║ │
│ ║ SCALE: TB-level database sync capable ║ │
│ ║ ║ │
│ ╚═══════════════════════════════════════════════════════════════════╝ │
│ │
│ ╔═══════════════════════════════════════════════════════════════════╗ │
│ ║ MONETIZATION ║ │
│ ╠═══════════════════════════════════════════════════════════════════╣ │
│ ║ ║ │
│ ║ OSS (Free): Pure native, ~100K/sec, good for typical use ║ │
│ ║ Cloud (Paid): Rust-powered, ~5M/sec, TB-scale, Mock API hosting ║ │
│ ║ ║ │
│ ║ → Heavy users naturally upgrade to Cloud ║ │
│ ║ → Clear value differentiation ║ │
│ ║ ║ │
│ ╚═══════════════════════════════════════════════════════════════════╝ │
│ │
└─────────────────────────────────────────────────────────────────────────┘Why This Architecture?
| Decision | Rationale |
|---|---|
| No Laravel | Go already handles sync/API; Laravel would be overhead |
| Nuxt for Dashboard | Vue familiarity (from Inertia), TypeScript, easy deploy |
| Go for Engine | Best DB libraries (pgx), great concurrency, fast HTTP |
| Rust for Core | Maximum N-gram performance, memory efficiency |
| Pure native OSS | Easy install, no binary deps, community maintainable |
| AI-assisted dev | Makes unfamiliar languages feasible |
Timeline
CLOUD PLATFORM (5-6 months):
├── Week 1-4: Rust Core (ngram, generator, model)
├── Week 5-10: Go Engine (sync, mock API, training)
└── Week 11-22: Nuxt Dashboard (UI, auth, billing)
OSS LIBRARIES (parallel):
├── Year 1: PHP/Laravel (alongside Cloud development)
├── Year 2: Python (after Cloud launch, revenue focus)
└── Year 3: TypeScript (optional, based on demand)Layer Details
Layer 1: Nuxt (TypeScript + Vue)
| Aspect | Detail |
|---|---|
| Purpose | Web dashboard, auth, billing UI |
| Why | Vue familiarity, TypeScript, easy deploy to Vercel |
| Tech | Nuxt 3, Vue 3, Auth.js, Stripe SDK |
Layer 2: Go Engine
| Aspect | Detail |
|---|---|
| Purpose | DB sync, Mock API server, training orchestration |
| Why | Goroutines for concurrency, memory efficiency, fast HTTP |
| Tech | Go 1.22+, pgx, go-mysql, asynq |
Layer 3: Rust Core
| Aspect | Detail |
|---|---|
| Purpose | N-gram train/generate/save/load |
| Why | Maximum performance for hot path (5M/sec) |
| Tech | Rust stable, MessagePack (serde), FFI to Go |
Communication Flow
Nuxt ──HTTP──► Go Engine ──FFI (CGO)──► Rust CoreAI-Assisted Development
Development leverages AI agents for code generation with human review.
What AI Does Well
- Writing isolated modules with clear interfaces
- Test generation
- Boilerplate and CRUD operations
- Documentation
- Code translation between languages
What Needs Human Expertise
- Architectural decisions
- Performance optimization strategies
- Debugging complex issues
- Security review
- Production incident response
Language-Specific AI Effectiveness
| Language | AI Code Quality | Review Difficulty |
|---|---|---|
| TypeScript | ★★★★★ | Easy |
| Go | ★★★★ | Medium (readable) |
| Rust | ★★★★ | Hard (lifetimes, borrowing) |
Key Insight: AI can write Rust well, but reviewing Rust for correctness requires understanding ownership/borrowing. Go is more forgiving for reviewers.