# Church API Development Commands

## Core Development Commands

### Building & Testing
```bash
# Build the project
cargo build

# Build with release optimizations
cargo build --release

# Run tests
cargo test

# Run specific test module with output
cargo test images::tests -- --nocapture

# Check code without building
cargo check

# Format code
cargo fmt

# Run clippy linter
cargo clippy
```

### Running the Application
```bash
# Run in development mode (from src/main.rs)
cargo run

# Run the named binary
cargo run --bin church-api

# Run with environment variables
RUST_LOG=debug cargo run
```

### Database Management
```bash
# The project uses SQLx with PostgreSQL
# Migration files are likely in the migrations/ directory
# Check for database setup in .env files
```

### System Integration
```bash
# The project includes systemd service management
sudo systemctl restart church-api
sudo systemctl status church-api

# Logs can be viewed with
journalctl -fu church-api
```

### Media Processing
```bash
# The project uses both FFmpeg and GStreamer
# Check Intel Media Stack environment:
export LIBVA_DRIVER_NAME=iHD
export LIBVA_DRIVERS_PATH=/opt/intel/media/lib64

# Check hardware acceleration support
vainfo
intel_gpu_top
```

### Testing & Debugging Scripts
```bash
# Various test scripts are available:
./test.sh                    # General testing
./test_images.sh            # Image processing tests
./test_media_system.sh      # Media system tests
./comprehensive_test.sh     # Full system tests
./server_debug.sh           # Server debugging

# Church-specific scripts:
./church-api-script.sh      # API management
./bible_verse.sh           # Bible verse functionality
```

### File System Organization
```bash
# Uploads directory
ls -la uploads/

# Configuration
cat .env
cat .env.example

# Service files
ls -la *.service

# Migration and backup files
ls -la migrations/
ls -la backup_before_*/
```

### Development Workflow
1. Make changes to code
2. Run `cargo check` for quick syntax validation
3. Run `cargo test` to ensure tests pass
4. Run `cargo build` to compile
5. Test with relevant `test_*.sh` scripts
6. Deploy with `sudo systemctl restart church-api`

## Key Directories
- `src/` - Rust source code
- `migrations/` - Database migrations
- `uploads/` - Media file storage
- `templates/` - HTML templates
- `tests/` - Test files