feat: Add Rust API Server with REST and GraphQL support

- Implement JWT authentication layer
- Add Engine Registry with 20+ conversion engines
- Implement Conversion Service with background job processing
- REST API endpoints for file conversion operations
- GraphQL API with queries and mutations
- Comprehensive error handling with conversion suggestions
- Integration tests for both REST and GraphQL APIs
- Complete API documentation

Features:
- REST API: /api/v1/* endpoints
- GraphQL API: /graphql endpoint with playground
- JWT Bearer token authentication
- Engine validation with alternative suggestions
- File download via API (not exposing file paths)
- Support for FFmpeg, ImageMagick, LibreOffice, Pandoc, and more
This commit is contained in:
Your Name 2026-01-21 11:40:03 +08:00
parent d0388066a5
commit e083e5d11d
18 changed files with 5235 additions and 0 deletions

63
api-server/Cargo.toml Normal file
View file

@ -0,0 +1,63 @@
[package]
name = "convertx-api"
version = "0.1.0"
edition = "2021"
authors = ["ConvertX Team"]
description = "ConvertX API Server - REST & GraphQL file conversion API"
license = "MIT"
repository = "https://github.com/your-username/ConvertX-CN"
[dependencies]
# Web framework
axum = { version = "0.7", features = ["multipart"] }
tokio = { version = "1.0", features = ["full"] }
tower = "0.4"
tower-http = { version = "0.5", features = ["cors", "trace", "fs"] }
# GraphQL
async-graphql = { version = "7.0", features = ["uuid"] }
async-graphql-axum = "7.0"
# Authentication
jsonwebtoken = "9.0"
# Serialization
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
# Async utilities
futures = "0.3"
async-trait = "0.1"
# UUID for job IDs
uuid = { version = "1.0", features = ["v4", "serde"] }
# File handling
mime_guess = "2.0"
tempfile = "3.0"
# Logging
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
# Error handling
thiserror = "1.0"
anyhow = "1.0"
# Time
chrono = { version = "0.4", features = ["serde"] }
# Base64 encoding
base64 = "0.22"
# Configuration
dotenvy = "0.15"
# Process execution (for calling converters)
tokio-process = "0.2"
[dev-dependencies]
axum-test = "14.0"
tokio-test = "0.4"
reqwest = { version = "0.11", features = ["json", "multipart"] }
pretty_assertions = "1.0"