Build
SCALABLE
Apps
Next.js monorepo following Clean Architecture and Domain-Driven Design. Production-ready, type-safe, and built for scale.
Built for Claude Code, Cursor & AI assistants
Built for AI Assistants
Every architectural decision is documented and optimized for AI comprehension.
Claude Code Ready
Complete CLAUDE.md with architecture context. AI understands your codebase instantly.
Explicit Patterns
Result<T>, Option<T>, and DDD patterns documented for AI comprehension.
.cursorrules Included
Architectural rules defined. AI follows Clean Architecture automatically.
AI-Optimized DX
Type-safe patterns and helper scripts. Build faster with AI assistance.
# AI Development Guidelines
## Mandatory Rules
### Respect the Dependency Rule (CRITICAL)
- Domain MUST NOT import from Application
- All dependencies point INWARD
### Error Handling Pattern (MANDATORY)
**NEVER throw exceptions** in Domain/Application.
Use Result<T> pattern:
const result = Email.create(input.email)
if (result.isFailure) {
return Result.fail(result.error)
}Features
Clean Architecture
Separation of concerns with clear boundaries. Testable, maintainable, and independent of frameworks.
Domain-Driven Design
Rich domain models with Entities, Value Objects, and Aggregates. Business logic where it belongs.
Type Safety
End-to-end TypeScript with Zod validation. Catch errors at compile time, not runtime.
Monorepo Ready
Turborepo + PNPM workspaces. Shared packages, optimized builds, and seamless development.
How It Works
┌─ CLEANSTACK ARCHITECTURE ────────────────────┐ │ │ │ HTTP Request │ │ ↓ │ │ ┌──────────────────────────────────────┐ │ │ │ [Adapters] │ │ │ │ Controllers & Presenters │ │ │ └──────────────────────────────────────┘ │ │ ↓ │ │ ┌──────────────────────────────────────┐ │ │ │ [Application] │ │ │ │ Use Cases & Business Logic │ │ │ └──────────────────────────────────────┘ │ │ ↓ │ │ ┌──────────────────────────────────────┐ │ │ │ [Domain] │ │ │ │ Entities & Value Objects │ │ │ │ Aggregates & Domain Events │ │ │ └──────────────────────────────────────┘ │ │ ↓ │ │ ┌──────────────────────────────────────┐ │ │ │ [Infrastructure] │ │ │ │ Database & External APIs │ │ │ └──────────────────────────────────────┘ │ │ │ └───────────────────────────────────────────────┘
CleanStack follows Clean Architecture principles with clear layer separation:
- →Adapters handle HTTP requests and present responses
- →Application layer contains use cases and orchestrates business logic
- →Domain layer holds pure business rules and entities
- →Infrastructure layer manages external dependencies
Code Examples
export class Email extends ValueObject<EmailProps> {
protected validate(props: EmailProps): Result<EmailProps> {
if (!emailRegex.test(props.value)) {
return Result.fail("Invalid email");
}
return Result.ok(props);
}
get value(): string {
return this.props.value;
}
}Ready to build better apps?
Get started in less than 5 minutes