# Introduction

This repository contains the comprehensive documentation for **DreamLend**, the first decentralized P2P lending protocol built on Somnia L1.

## 🚀 Quick Start

### Prerequisites

* **Bun** (recommended) or Node.js 18+
* **GitBook CLI** for traditional GitBook features

### Installation

```bash
# Install dependencies
bun install

# Or with npm
npm install
```

### Development

```bash
# Start development server
bun run dev

# Or for GitBook specifically
cd packages/docs && gitbook serve
```

### Building

```bash
# Build all packages
bun run build

# Build GitBook documentation
bun run gitbook:build
```

## 📖 Documentation Structure

The documentation is organized into several key sections:

* **🏠 Overview**: Introduction and architecture
* **🎯 Getting Started**: Quick setup guides
* **👥 User Guides**: Detailed guides for lenders, borrowers, and liquidators
* **📋 Smart Contracts**: API documentation and contract details
* **🔮 Oracle & Price Feeds**: Oracle integration details
* **💎 $DREAM Token**: Tokenomics and rewards
* **🛠️ Developer Resources**: Integration guides and SDKs
* **📊 API Reference**: Complete API documentation
* **❓ FAQ & Support**: Common questions and troubleshooting

## 🏗️ Project Structure

```
dreamlend-docs/
├── packages/
│   └── docs/                 # GitBook documentation
│       ├── README.md         # Main landing page
│       ├── SUMMARY.md        # Table of contents
│       ├── book.json         # GitBook configuration
│       ├── getting-started/  # Setup guides
│       ├── user-guides/      # User documentation
│       ├── api/              # API documentation
│       └── ...
├── package.json              # Root package configuration
├── turbo.json               # Turbo build configuration
├── biome.json               # Code formatting rules
└── README.md                # This file
```

## 🛠️ Development Workflow

### Adding New Documentation

1. **Create new markdown files** in the appropriate directory under `packages/docs/`
2. **Update SUMMARY.md** to include your new pages in the navigation
3. **Test locally** with `bun run dev`
4. **Format code** with `bun run format`

### Available Scripts

```bash
# Development
bun run dev                   # Start development server
bun run format               # Format all files with Biome
bun run format:check         # Check formatting without changes

# Building
bun run build                # Build all packages
bun run gitbook:build        # Build GitBook documentation
bun run gitbook:pdf          # Generate PDF version
bun run gitbook:epub         # Generate EPUB version

# Maintenance
bun run clean                # Clean build artifacts
bun run clean-deps           # Clean all node_modules
bun run typecheck            # Run TypeScript checks
```

## 🎨 Styling and Customization

The documentation uses custom CSS located in `packages/docs/styles/website.css` with:

* **DreamLend branding colors**
* **Responsive design**
* **Dark/light mode support**
* **Custom components and layouts**

## 📝 Writing Guidelines

### Markdown Standards

* Use **clear, descriptive headings**
* Include **code examples** with syntax highlighting
* Add **emojis** for visual appeal and navigation
* Use **tables** for structured data
* Include **links** to related sections

### Code Examples

```javascript
// Always include complete, working examples
const dreamLendContract = new ethers.Contract(
  "0xddDa4e2B1B8E6f06086F103dA6358E7aCbd020ec",
  DREAMLEND_ABI,
  provider
);
```

### API Documentation

* **Complete function signatures**
* **Parameter descriptions**
* **Return value details**
* **Usage examples**
* **Error handling**

## 🔗 Links and Resources

* **DreamLend App**: [dreamlend.finance](https://www.dreamlend.finance/)
* **GitHub**: [github.com/dreamlend](https://github.com/dreamlend)
* **Discord**: [discord.gg/dreamlend](https://discord.gg/dreamlend)
* **Twitter**: [@DreamlendFi](https://x.com/DreamlendFi)

## 🤝 Contributing

We welcome contributions to improve the documentation:

1. **Fork the repository**
2. **Create a feature branch**
3. **Make your changes**
4. **Test locally**
5. **Submit a pull request**

### Contribution Guidelines

* Follow the existing **formatting and style**
* **Test all code examples**
* **Update navigation** in SUMMARY.md
* **Add screenshots** for UI-related documentation
* **Keep content up-to-date** with protocol changes

## 📄 License

This documentation is licensed under the MIT License. See the [LICENSE](https://github.com/harshmittal1750/dreamlendfi-docs/blob/main/LICENSE/README.md) file for details.

## 🆘 Support

If you need help with the documentation:

* **Create an issue** on GitHub
* **Join our Discord** for real-time support
* **Email us** at <docs@dreamlend.finance>

***

*Built with ❤️ for the DreamLend community - Making DeFi accessible through comprehensive documentation.*
