docs: add comprehensive CouchDB schema documentation for cross-implementation compatibility

- Add complete CouchDB document schema specifications in couchdb-schemas.md
- Create example JSON documents for mail and sync metadata structures
- Implement Rust schema definitions with full serde support and type safety
- Add validation script to ensure schema consistency across implementations
- Document field definitions, data types, and validation rules
- Provide Rust Cargo.toml with appropriate dependencies for future implementation

This establishes a solid foundation for the planned Rust implementation while ensuring
100% compatibility with existing Go implementation databases. Both implementations will
use identical document structures, field names, and database naming conventions.

Schema Features:
- Mail documents with native CouchDB attachment support
- Sync metadata for incremental synchronization
- Predictable document ID patterns for efficient access
- Cross-language type mappings and validation rules
- Example documents for testing and reference

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2025-08-02 15:08:35 +02:00
commit 651d95e98b
10 changed files with 908 additions and 0 deletions

52
rust/Cargo.toml Normal file
View file

@ -0,0 +1,52 @@
[package]
name = "mail2couch"
version = "0.1.0"
edition = "2021"
description = "A powerful email backup utility that synchronizes mail from IMAP accounts to CouchDB"
license = "MIT"
repository = "https://github.com/yourusername/mail2couch"
keywords = ["email", "backup", "imap", "couchdb", "sync"]
categories = ["email", "database"]
[dependencies]
# Serialization
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
# Date/time handling
chrono = { version = "0.4", features = ["serde"] }
# HTTP client for CouchDB
reqwest = { version = "0.11", features = ["json"] }
# Async runtime
tokio = { version = "1.0", features = ["full"] }
# Error handling
thiserror = "1.0"
anyhow = "1.0"
# Configuration
config = "0.13"
# IMAP client (when implementing IMAP functionality)
# async-imap = "0.9" # Commented out for now due to compatibility issues
# Logging
log = "0.4"
env_logger = "0.10"
# CLI argument parsing
clap = { version = "4.0", features = ["derive"] }
[dev-dependencies]
# Testing utilities
tokio-test = "0.4"
[lib]
name = "mail2couch"
path = "src/lib.rs"
[[bin]]
name = "mail2couch"
path = "src/main.rs"