Skip to content

📝 [DOCS] Document Cairo Contracts vs Dojo Contracts #177

@jimenezz22

Description

@jimenezz22

📝 Issue Title: Document Cairo Contracts vs Dojo Contracts: Key Differences and When to Use Each

🔍 Scope

Create concise documentation comparing pure Cairo smart contracts with Dojo-powered contracts for game development. Use comparison tables and clear guidelines to help developers choose the right approach for their projects.

This will be part of the Cairo fundamentals section under /getting-started/cairo/contracts-comparison and should serve as a quick decision guide for developers.


🔄 How to Implement the Issue

📁 Documentation Structure

  1. Provide clear definitions and use cases for each approach
    2 Create comparison tables highlighting key differences
  2. Include decision framework for choosing between approaches

📄 Content Requirements

Step 1: Overview & Definitions

Pure Cairo Contracts

  • Traditional Starknet smart contracts for general blockchain applications
  • Manual state management and infrastructure setup
  • Maximum flexibility and customization

Dojo Framework

  • Specialized framework for onchain games and autonomous worlds
  • ECS architecture with automatic tooling and indexing
  • Opinionated structure optimized for gaming

Step 2: Architecture Comparison Table

Aspect Pure Cairo Dojo Framework
Architecture Standalone contracts World + Systems + Models
State Management Manual storage patterns Automatic ECS models
Data Access Custom queries/events Auto-generated GraphQL
Development Speed Slower, more setup Rapid prototyping
Learning Curve Starknet + Cairo Dojo conventions + Cairo
Flexibility Maximum customization Gaming-focused patterns
Tooling General Starknet tools Integrated gaming stack
Infrastructure Manual indexing setup Built-in Torii indexer

Step 3: Use Cases Comparison Table

Project Type Recommended Approach Reasoning
DeFi Protocols Pure Cairo Financial logic, custom economics
Onchain Games Dojo Framework Gaming patterns, rapid development
NFT Marketplaces Pure Cairo Standard patterns, existing tools
Autonomous Worlds Dojo Framework Complex state, real-time queries
Governance Systems Pure Cairo Custom voting logic, flexibility
Game Tournaments Dojo Framework Player tracking, leaderboards
Cross-chain Bridges Pure Cairo Infrastructure focus
MMO Games Dojo Framework Complex multiplayer state

Step 4: Development Experience Comparison

Development Aspect Pure Cairo Dojo Framework
Setup Time Hours to days Minutes
Boilerplate Code High Minimal
State Queries Manual implementation Auto-generated GraphQL
Frontend Integration Custom bindings Auto-generated TypeScript
Testing Manual test setup Built-in testing patterns
Deployment Manual process Streamlined with sozo

Step 5: Decision Framework

When to Choose Pure Cairo:

  • ✅ Building DeFi or financial applications
  • ✅ Need maximum gas optimization
  • ✅ Require custom architecture patterns
  • ✅ Integrating with existing Starknet ecosystems
  • ✅ Have specific performance requirements

When to Choose Dojo:

  • ✅ Building games or autonomous worlds
  • ✅ Need rapid development and prototyping
  • ✅ Want built-in indexing and querying
  • ✅ Prefer opinionated, gaming-focused patterns
  • ✅ Team is new to blockchain game development

Step 6: Migration Considerations

From Pure Cairo to Dojo

  • Benefits: Faster development, better tooling
  • Challenges: Learning Dojo patterns, architectural changes
  • Best for: Projects adding gaming features

From Dojo to Pure Cairo

  • Benefits: More control, custom optimizations
  • Challenges: Building infrastructure, more complexity
  • Best for: Scaling beyond gaming use cases

✅ Acceptance Criteria

✅ Clear Comparisons

  • Comparison tables clearly highlight differences between approaches
  • Decision framework helps developers choose the right approach
  • Use cases are practical and based on real project needs

✅ Concise Content

  • Documentation is focused and scannable
  • Tables are well-organized and easy to read
  • Avoids unnecessary technical depth or code examples

✅ Practical Value

  • Serves as a quick reference for architecture decisions
  • Helps teams evaluate trade-offs efficiently
  • Provides actionable recommendations

📸 Additional Context

  • Target Length: ~150–200 lines (concise and focused)
  • Format: Heavy use of comparison tables and bullet points
  • Focus: Decision-making tool rather than deep technical tutorial

Success Criteria:

  • Developers can quickly understand the key differences
  • Teams can make informed architecture decisions in under 5 minutes of reading
  • Clear guidance on when each approach provides optimal value

🙏 Contribution Guidelines

Please ensure you read and follow the contribution guidelines in the project's README file

  • Keep content concise and table-focused
  • Research real-world examples to validate use case recommendations
  • Follow the established documentation format used in other guides of Dojo By Example

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions