@sprouted/create-vibes
Version:
Create a new Vibes monorepo
150 lines (129 loc) • 5.17 kB
Markdown
```
┌─────────────────────────────────────────────────────┐
│ 🌊 VIBES │
├─────────────────────────────────────────────────────┤
│ │
│ Apps (Containers) Features (Slices) │
│ ┌──────────────┐ ┌───────────────┐ │
│ │ 📱 Mobile │ │ 📝 Todo │ │
│ │ │ ──────► │ ┝━━━━━━━━━━━┥ │
│ │ TodoScreen │ │ │ UI │ │
│ └──────────────┘ │ │ API │ │
│ │ │ Logic │ │
│ ┌──────────────┐ │ │ Data │ │
│ │ 🌐 Web │ │ └───────────┘ │
│ │ │ ──────► │
│ │ Dashboard │ ┌───────────────┐ │
│ └──────────────┘ │ 👤 User │ │
│ │ ┝━━━━━━━━━━━┥ │
│ ┌──────────────┐ │ │ UI │ │
│ │ ⚡ API │ ──────► │ │ API │ │
│ │ │ │ │ Logic │ │
│ │ Routes │ │ │ Data │ │
│ └──────────────┘ └───────────┘ │
│ │
└─────────────────────────────────────────────────────┘
```
```
feature-name/
│
├── 🎨 ui/ (Presentation Layer)
│ ├── components/ - Reusable UI pieces
│ └── screens/ - Full page views
│
├── 🔌 api/ (HTTP Layer)
│ ├── routes/ - URL endpoints
│ └── handlers/ - Request handlers
│
├── 🧠 logic/ (Business Layer)
│ ├── services/ - Business rules
│ └── validators/ - Data validation
│
├── 💾 data/ (Persistence Layer)
│ ├── models/ - Data structures
│ └── repositories/ - Data access
│
└── 🧪 tests/ (Quality Layer)
├── unit/ - Isolated tests
└── integration/ - Full flow tests
```
```
User Action
│
▼
┌──────────┐
│ App │ (Orchestrator)
└─────┬────┘
│
▼
┌──────────┐
│ Feature │ (Self-contained slice)
├──────────┤
│ UI │ ◄─── Display
├──────────┤ │
│ Logic │ ◄─── Process
├──────────┤ │
│ Data │ ◄─── Store
└──────────┘
```
```
✅ Allowed:
- App imports from Features
- Feature imports from Shared
- Any layer within same Feature
❌ Not Allowed:
- Feature imports from App
- Feature imports from Feature
- Cross-feature dependencies
Example:
app/web/main.ts
└─► @features/todo
└─► @features/user
└─► @shared/ui
features/todo/index.ts
└─► ./ui/TodoList
└─► ./logic/TodoService
└─► @shared/utils ✓
❌ @features/user ✗
```
```bash
features/
└── my-feature/
├── ui/
├── api/
├── logic/
└── data/
```
```typescript
// Import what you need
import {
MyComponent, // UI
myRoutes, // API
MyService // Logic
} from '@features/my-feature';
// Compose in your app
app.use(myRoutes);
app.render(<MyComponent />);
```
```typescript
// Put in shared/ only if:
// 1. Used by multiple features
// 2. Genuinely generic
// 3. Stable and tested
// Otherwise, duplicate first!
```
Think of Vibes like a music festival:
- **Apps** = Different stages (Main Stage, Acoustic Tent, DJ Booth)
- **Features** = Different acts (complete performances)
- **Shared** = Common infrastructure (sound system, lights)
Each act (feature) brings everything they need. Stages (apps) just provide the space and coordinate the show!