forgedb 0.1.0

ForgeDB — an application database generator. Compiles a declarative .forge schema into tailored Rust database code, a TypeScript SDK, and a REST API.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
# ForgeDB Publishing Guide

**Last Updated:** October 2025

Complete guide for releasing and publishing ForgeDB crates to crates.io.

## Table of Contents

- [Overview]#overview
- [Release Checklist]#release-checklist
- [Version Bumping]#version-bumping
- [Publishing to crates.io]#publishing-to-cratesio
- [GitHub Releases]#github-releases
- [Changelog Format]#changelog-format
- [Rollback Procedures]#rollback-procedures

---

## Overview

### Release Types

**Public Crates** (published to crates.io):
- `forgedb-types`
- `forgedb-storage`
- `forgedb-wal`
- `forgedb-crud-api`
- `forgedb-query-params`
- `forgedb-query-optimization`
- `forgedb-fulltext`
- `forgedb-http-server`
- `forgedb-compaction`
- `forgedb-ffi`

**Internal Crates** (NOT published):
- `forgedb-parser`
- `forgedb-validation`
- `forgedb-watcher`
- `forgedb-migrations`
- `forgedb-lsp-server`
- `forgedb` (CLI binary)

### Version Policy

All public crates are versioned together using [Semantic Versioning 2.0.0](https://semver.org/):

**MAJOR.MINOR.PATCH**
- **MAJOR**: Breaking API changes
- **MINOR**: New features, backward compatible
- **PATCH**: Bug fixes, backward compatible

**Pre-1.0 Policy:**
- Currently at `0.x.x` (pre-1.0)
- MINOR bumps MAY include breaking changes
- PATCH bumps are backward compatible

**Post-1.0 Policy:**
- MAJOR bumps for breaking changes
- MINOR bumps for new features (every 2-3 months)
- PATCH bumps for bug fixes (as needed)

---

## Release Checklist

### Pre-Release (1-2 weeks before)

- [ ] **Feature freeze**: No new features, only bug fixes
- [ ] **Update dependencies**: `cargo update` and test
- [ ] **Run full test suite**: `cargo test --all`
- [ ] **Run clippy**: `cargo clippy --all-targets --all-features -- -D warnings`
- [ ] **Check documentation**: `cargo doc --all --no-deps`
- [ ] **Test examples**: Run all examples and verify they work
- [ ] **Update CHANGELOG.md**: Document all changes since last release
- [ ] **Update version in docs**: Check all documentation for version references
- [ ] **Review open issues**: Address critical bugs
- [ ] **Review PRs**: Merge or defer pending pull requests

### Version Bump

- [ ] **Decide version number**: MAJOR.MINOR.PATCH
- [ ] **Update Cargo.toml files**: Bump version in all public crates
- [ ] **Update dependency versions**: Internal dependencies reference new version
- [ ] **Update README.md**: Version badges and installation instructions
- [ ] **Update documentation**: Any version-specific references
- [ ] **Commit version bump**: `git commit -m "chore: bump version to X.Y.Z"`

### Pre-Publish Verification

- [ ] **Clean build**: `cargo clean && cargo build --release`
- [ ] **Run tests**: `cargo test --all --release`
- [ ] **Test installation**: Create test project and verify dependency resolution
- [ ] **Check crate contents**: `cargo package --list` for each crate
- [ ] **Dry-run publish**: `cargo publish --dry-run` for each crate
- [ ] **Verify documentation builds**: Check docs.rs compatibility

### Publishing

- [ ] **Publish crates**: In dependency order (see below)
- [ ] **Verify on crates.io**: Check each crate page
- [ ] **Verify documentation**: Check docs.rs for each crate
- [ ] **Test installation**: `cargo new test && cargo add forgedb-storage`

### Post-Release

- [ ] **Create Git tag**: `git tag -a vX.Y.Z -m "Release X.Y.Z"`
- [ ] **Push tag**: `git push origin vX.Y.Z`
- [ ] **Create GitHub release**: With changelog and binaries
- [ ] **Announce release**: Blog post, Twitter, Discord, etc.
- [ ] **Update project board**: Close milestone, create next one
- [ ] **Monitor issues**: Watch for bug reports

---

## Version Bumping

### Manual Version Bump

**1. Determine new version:**
```bash
# Current version
CURRENT_VERSION="0.1.0"

# New version (choose one)
NEW_VERSION="0.1.1"  # Patch release
NEW_VERSION="0.2.0"  # Minor release
NEW_VERSION="1.0.0"  # Major release
```

**2. Update Cargo.toml files:**

Update version in all public crates:
```bash
# List all public crate Cargo.toml files
find crates -name Cargo.toml | grep -E "(storage|wal|crud-api|http-server|query-params|query-optimization|fulltext|compaction|ffi|types)" | xargs -I {} sed -i "s/version = \"$CURRENT_VERSION\"/version = \"$NEW_VERSION\"/" {}
```

**3. Update internal dependencies:**

Update dependency versions in Cargo.toml files:
```bash
# Update forgedb-storage dependency references
find crates -name Cargo.toml -exec sed -i "s/forgedb-storage = { version = \"$CURRENT_VERSION\"/forgedb-storage = { version = \"$NEW_VERSION\"/" {} \;

# Repeat for all public crates
```

**4. Update README.md:**
```markdown
<!-- Update version badge -->
[![Crates.io](https://img.shields.io/crates/v/forgedb-storage.svg)](https://crates.io/crates/forgedb-storage)

<!-- Update installation instruction -->
```toml
[dependencies]
forgedb-storage = "0.2.0"  # Update version here
```
```

**5. Verify changes:**
```bash
# Check all version changes
git diff | grep "version ="

# Ensure Cargo.lock is updated
cargo check

# Verify it compiles
cargo build --all
```

**6. Commit version bump:**
```bash
git add -A
git commit -m "chore: bump version to $NEW_VERSION"
```

### Automated Version Bump Script

Create `scripts/bump-version.sh`:
```bash
#!/bin/bash
set -e

if [ -z "$1" ]; then
    echo "Usage: $0 <new-version>"
    exit 1
fi

NEW_VERSION=$1
CURRENT_VERSION=$(grep '^version =' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')

echo "Bumping version from $CURRENT_VERSION to $NEW_VERSION"

# Public crates
PUBLIC_CRATES=(
    "types"
    "storage"
    "wal"
    "crud-api"
    "query-params"
    "query-optimization"
    "fulltext"
    "http-server"
    "compaction"
    "ffi"
)

# Update version in each crate
for crate in "${PUBLIC_CRATES[@]}"; do
    CARGO_TOML="crates/$crate/Cargo.toml"
    if [ -f "$CARGO_TOML" ]; then
        echo "Updating $CARGO_TOML"
        sed -i "s/version = \"$CURRENT_VERSION\"/version = \"$NEW_VERSION\"/" "$CARGO_TOML"
    fi
done

# Update dependencies
for crate in "${PUBLIC_CRATES[@]}"; do
    find crates -name Cargo.toml -exec sed -i \
        "s/forgedb-$crate = { version = \"$CURRENT_VERSION\"/forgedb-$crate = { version = \"$NEW_VERSION\"/" {} \;
done

# Update root Cargo.toml
sed -i "s/version = \"$CURRENT_VERSION\"/version = \"$NEW_VERSION\"/" Cargo.toml

# Update Cargo.lock
cargo check

echo "Version bump complete. Review changes with 'git diff'"
```

**Usage:**
```bash
chmod +x scripts/bump-version.sh
./scripts/bump-version.sh 0.2.0
```

---

## Publishing to crates.io

### Prerequisites

**1. Crates.io Account:**
- Create account at [crates.io]https://crates.io
- Get API token from [crates.io/me]https://crates.io/me

**2. Configure Cargo:**
```bash
cargo login <your-api-token>
```

**3. Verify Ownership:**
Ensure you have owner/co-owner permissions for all crates.

### Publishing Order

**IMPORTANT**: Publish in dependency order to avoid failures.

**Order:**
```
1. forgedb-types (no dependencies)
2. forgedb-wal (no ForgeDB dependencies)
3. forgedb-storage (depends on: types, wal)
4. forgedb-crud-api (depends on: storage)
5. forgedb-query-params (no ForgeDB dependencies)
6. forgedb-query-optimization (depends on: storage, types)
7. forgedb-fulltext (no ForgeDB dependencies)
8. forgedb-compaction (no ForgeDB dependencies)
9. forgedb-http-server (no ForgeDB dependencies)
10. forgedb-ffi (depends on: storage, types)
```

### Publishing Script

Create `scripts/publish.sh`:
```bash
#!/bin/bash
set -e

# Publish crates in dependency order
CRATES=(
    "types"
    "wal"
    "storage"
    "crud-api"
    "query-params"
    "query-optimization"
    "fulltext"
    "compaction"
    "http-server"
    "ffi"
)

for crate in "${CRATES[@]}"; do
    echo "================================================"
    echo "Publishing forgedb-$crate..."
    echo "================================================"
    
    cd "crates/$crate"
    
    # Dry run first
    cargo publish --dry-run
    
    # Publish
    cargo publish
    
    cd ../..
    
    # Wait for crates.io to index
    echo "Waiting 30 seconds for crates.io to index..."
    sleep 30
done

echo "================================================"
echo "All crates published successfully!"
echo "================================================"
```

**Usage:**
```bash
chmod +x scripts/publish.sh
./scripts/publish.sh
```

### Manual Publishing

**For each crate (in order):**

```bash
cd crates/types

# 1. Verify package contents
cargo package --list

# 2. Dry-run (test without publishing)
cargo publish --dry-run

# 3. Publish
cargo publish

# 4. Wait for crates.io to index (30 seconds)
sleep 30

# 5. Move to next crate
cd ../wal
# Repeat...
```

### Verification

**After publishing each crate:**

```bash
# Check crate page
open https://crates.io/crates/forgedb-storage

# Verify documentation builds
open https://docs.rs/forgedb-storage

# Test installation
cargo new /tmp/test-install
cd /tmp/test-install
cargo add forgedb-storage --vers "0.2.0"
cargo build
```

### Troubleshooting Publishing

**Issue: "crate not found" for dependency**
- Wait longer for crates.io to index previous crate
- Verify previous crate was published successfully

**Issue: Documentation fails to build**
- Check for missing documentation features
- Verify all dependencies are available
- Test locally: `cargo doc --no-deps`

**Issue: Package too large**
- Check `.cargo_vcs_info.json` size
- Exclude unnecessary files in `Cargo.toml`:
  ```toml
  [package]
  exclude = ["tests/fixtures/*", "benches/*"]
  ```

**Issue: Yanking a release**
```bash
# Yank specific version (prevents new projects from using it)
cargo yank --vers 0.2.0 forgedb-storage

# Unyank if needed
cargo yank --undo --vers 0.2.0 forgedb-storage
```

---

## GitHub Releases

### Creating a Release

**1. Create Git Tag:**
```bash
# Tag the commit
git tag -a v0.2.0 -m "Release 0.2.0"

# Push tag
git push origin v0.2.0
```

**2. Create Release on GitHub:**

Go to: `https://github.com/yourusername/forgedb/releases/new`

**Release Template:**
```markdown
## ForgeDB v0.2.0

Release date: YYYY-MM-DD

### What's New

- Feature 1 description
- Feature 2 description

### Breaking Changes

- Breaking change 1 (if any)
- Migration guide: [link]

### Bug Fixes

- Fix 1 (#123)
- Fix 2 (#124)

### Documentation

- Updated guides
- New examples

### Installation

**Cargo.toml:**
```toml
[dependencies]
forgedb-storage = "0.2.0"
forgedb-http-server = "0.2.0"
```

**CLI:**
```bash
cargo install forgedb --version 0.2.0
```

### Full Changelog

See [CHANGELOG.md](./CHANGELOG.md) for complete changes.

### Checksums

- forgedb-linux: `sha256:...`
- forgedb-macos: `sha256:...`
- forgedb-windows: `sha256:...`
```

**3. Attach Binaries:**

Build release binaries for each platform:
```bash
# Linux
cargo build --release --bin forgedb
tar -czf forgedb-v0.2.0-x86_64-linux.tar.gz -C target/release forgedb

# macOS
cargo build --release --target x86_64-apple-darwin --bin forgedb
tar -czf forgedb-v0.2.0-x86_64-macos.tar.gz -C target/x86_64-apple-darwin/release forgedb

# Windows
cargo build --release --target x86_64-pc-windows-msvc --bin forgedb
zip forgedb-v0.2.0-x86_64-windows.zip target/x86_64-pc-windows-msvc/release/forgedb.exe
```

**4. Generate Checksums:**
```bash
sha256sum forgedb-*.tar.gz forgedb-*.zip > checksums.txt
```

### Automated Release (GitHub Actions)

Create `.github/workflows/release.yml`:
```yaml
name: Release

on:
  push:
    tags:
      - 'v*'

jobs:
  build:
    name: Build ${{ matrix.target }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
          - os: macos-latest
            target: x86_64-apple-darwin
          - os: windows-latest
            target: x86_64-pc-windows-msvc
    
    steps:
      - uses: actions/checkout@v3
      
      - name: Install Rust
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          target: ${{ matrix.target }}
      
      - name: Build
        run: cargo build --release --target ${{ matrix.target }}
      
      - name: Package
        shell: bash
        run: |
          cd target/${{ matrix.target }}/release
          if [ "${{ matrix.os }}" = "windows-latest" ]; then
            7z a ../../../forgedb-${{ github.ref_name }}-${{ matrix.target }}.zip forgedb.exe
          else
            tar czf ../../../forgedb-${{ github.ref_name }}-${{ matrix.target }}.tar.gz forgedb
          fi
      
      - name: Upload Artifact
        uses: actions/upload-artifact@v3
        with:
          name: forgedb-${{ matrix.target }}
          path: forgedb-*
  
  release:
    name: Create Release
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      
      - name: Download Artifacts
        uses: actions/download-artifact@v3
      
      - name: Create Release
        uses: softprops/action-gh-release@v1
        with:
          files: forgedb-*/*
          body_path: CHANGELOG.md
          draft: false
          prerelease: false
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

---

## Changelog Format

### CHANGELOG.md Structure

Follow [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format:

```markdown
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added
- Feature in development (#PR)

### Changed
- Upcoming change (#PR)

## [0.2.0] - 2025-10-20

### Added
- Full-text search support (#101)
- SIMD query optimization (#102)
- Response caching in HTTP server (#103)

### Changed
- Improved error messages in parser (#104)
- Updated Axum to 0.8 (#105)

### Fixed
- Fixed memory leak in compaction (#106)
- Corrected index corruption issue (#107)

### Security
- Updated rustls to fix CVE-2023-XXXX (#108)

## [0.1.0] - 2025-09-15

### Added
- Initial release
- Columnar storage engine
- Write-Ahead Log
- HTTP server infrastructure
- Basic CRUD operations

[Unreleased]: https://github.com/yourusername/forgedb/compare/v0.2.0...HEAD
[0.2.0]: https://github.com/yourusername/forgedb/compare/v0.1.0...v0.2.0
[0.1.0]: https://github.com/yourusername/forgedb/releases/tag/v0.1.0
```

### Changelog Categories

**Added**: New features
```markdown
### Added
- Full-text search with ranking (#101)
- New `forgedb-ffi` crate for C bindings (#102)
```

**Changed**: Changes to existing functionality
```markdown
### Changed
- Improved query optimizer performance by 2x (#103)
- Updated API to use `Result<T, Error>` instead of `Option<T>` (#104)
```

**Deprecated**: Soon-to-be removed features
```markdown
### Deprecated
- `old_method()` in favor of `new_method()` (#105)
- Will be removed in v1.0.0
```

**Removed**: Removed features
```markdown
### Removed
- Removed deprecated `legacy_api` module (#106)
```

**Fixed**: Bug fixes
```markdown
### Fixed
- Fixed race condition in WAL compaction (#107)
- Corrected off-by-one error in column indexing (#108)
```

**Security**: Security fixes
```markdown
### Security
- Fixed SQL injection vulnerability in query parser (#109)
- Updated dependencies to fix known CVEs (#110)
```

---

## Rollback Procedures

### Yanking a Release

If a critical bug is discovered:

**1. Yank the problematic version:**
```bash
cargo yank --vers 0.2.0 forgedb-storage
```

This prevents NEW projects from using it, but existing projects can still access it.

**2. Publish a patch release:**
```bash
# Fix the issue
# Bump version to 0.2.1
./scripts/bump-version.sh 0.2.1

# Publish fixed version
./scripts/publish.sh
```

**3. Update GitHub release:**
- Mark release as "Pre-release" or add warning
- Link to fixed version

### Reverting a Git Tag

If you need to remove a tag:
```bash
# Delete local tag
git tag -d v0.2.0

# Delete remote tag
git push origin :refs/tags/v0.2.0
```

### Emergency Hotfix Process

**1. Create hotfix branch:**
```bash
git checkout -b hotfix/0.2.1 v0.2.0
```

**2. Apply fix:**
```bash
# Make minimal changes to fix critical issue
git commit -m "fix: critical security issue"
```

**3. Bump version:**
```bash
./scripts/bump-version.sh 0.2.1
```

**4. Publish:**
```bash
./scripts/publish.sh
```

**5. Merge back:**
```bash
git checkout main
git merge hotfix/0.2.1
git push origin main
```

---

## Post-Release Checklist

### Immediate (Same Day)

- [ ] Verify all crates published successfully
- [ ] Check docs.rs for all crates
- [ ] Test installation: `cargo add forgedb-storage@0.2.0`
- [ ] Create GitHub release with binaries
- [ ] Update project website (if exists)
- [ ] Post announcement on social media

### Short-term (1-3 Days)

- [ ] Monitor GitHub issues for bug reports
- [ ] Check crates.io download stats
- [ ] Respond to community feedback
- [ ] Update examples to use new version
- [ ] Write blog post about release (optional)

### Long-term (1-2 Weeks)

- [ ] Evaluate release success
- [ ] Plan next release
- [ ] Update roadmap
- [ ] Document lessons learned

---

## Additional Resources

- [Semantic Versioning]https://semver.org/
- [Keep a Changelog]https://keepachangelog.com/
- [Cargo Book - Publishing]https://doc.rust-lang.org/cargo/reference/publishing.html
- [Architecture Documentation]./ARCHITECTURE.md
- [Contributing Guide]./CONTRIBUTING.md

---

**Questions?** Open an issue or contact maintainers.