antigluten/amgi

An open-source, offline-first Anki-compatible iOS flashcard client with sync server support, powered by the official Anki Rust backend via C FFI.

Swift

258

358 commits

updated Sep 20, 2026

See the code

README

Amgi

암기 (amgi) — Korean for "memorization"

An open-source, offline-first Anki-compatible iOS flashcard client with sync server support.

Swift 6.2 iOS 18+ watchOS 11+ Rust FFI AGPL-3.0


Amgi wraps the official ankitects/anki Rust backend via C FFI, giving you a native SwiftUI experience backed by the same battle-tested engine that powers Anki Desktop and AnkiDroid. Sync your decks with any compatible sync server (including self-hosted), study with FSRS scheduling, and keep your review history in perfect sync across all your devices.

Screenshots

Library — due-today hero card with streak, and the deck tree with per-state counts Study — today's queue across every deck, with an up-next list Review — a card showing the next interval on every rating button Browse — Anki search with deck and tag filter chips Statistics — streak, last-month summary, and the future-due forecast

Highlights

  • The real FSRS engine — scheduling, templates, search and sync are the upstream Rust code, not a reimplementation.
  • Offline-first — everything works without a connection; sync when you have one.
  • Any sync server — AnkiWeb or self-hosted, with a safe merge when collections diverge.
  • Built-in EPUB reader — with offline Yomitan-compatible dictionary lookup, so cards come from what you are reading.
  • Beyond the phone — home-screen widgets, an Apple Watch app that runs the engine on-device, and Shortcuts/Siri actions.
  • Image occlusion, card templates, FSRS simulator — the power-user surface, not a cut-down mobile client.

The full list is in Documentation/FEATURES.md.

Quick start

Install the toolchain first — Xcode 26, Rust (stable and nightly, for the watchOS slice), protoc and xcodegen. Documentation/BUILDING.md has the exact commands, plus how to run the tests.

git clone --recursive https://github.com/antigluten/amgi.git
cd amgi

./scripts/build-xcframework.sh            # Rust engine → xcframework
./scripts/generate-protos.sh              # protobuf → Swift types
cd AmgiApp && xcodegen generate && cd ..  # project is generated, not checked in
open AmgiApp/AmgiApp.xcodeproj

Documentation

DocumentWhat it covers
FeaturesEverything the app does today
BuildingRequirements, setup, build, tests, the watch target
ArchitectureLayers, package layout, design decisions
Rust bridgeThe C FFI seam, protobuf dispatch, the build pipeline
Data flowsSync, study, browse, stats and widgets, RPC by RPC
Code styleSwift conventions and the module boundaries that matter
ContributingIssues, branches, commits, pull requests
ChangelogWhat changed in each release

AGENTS.md at the repo root routes a coding agent to a per-package guide (AmgiFeatures/AGENTS.md, Sources/AGENTS.md, …) plus the reference notes in agents/.

Architecture in one diagram

SwiftUI feature modules (AmgiFeatures)
    |
@DependencyClient structs (AnkiClients)
    |
Service facades (AnkiServices)
    |
Typed protobuf requests (AnkiProtoBridge)
    |
AnkiBackend (Swift wrapper)
    |
C FFI (4 functions)
    |
Rust dynamic framework (ankitects/anki rslib)

Swift owns the UI. Rust owns everything else — database, sync, FSRS scheduling, card templates, search, import/export, statistics.

Tech stack

  • UI: SwiftUI with strict concurrency (Swift 6.2, language mode v6)
  • Dependency Injection: swift-dependencies (@DependencyClient struct-closure pattern)
  • Backend: ankitects/anki Rust crate via C FFI
  • Serialization: Protocol Buffers (25 .proto service definitions)
  • Database: SQLite (owned by Rust backend)
  • EPUB: vendored EPUBKit (MIT), with hoshidicts for Yomitan dictionaries
  • Build: SPM for library and feature modules, xcodegen for the app, widget, and watch targets

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) because it incorporates ankitects/anki (copyright Ankitects Pty Ltd), which is also AGPL-3.0. See LICENSE for the full license text.

The AGPL requires that if you distribute this software or run it as a network service, you must make the complete source code available under the same license.

Contributing

Contributions are welcome. See CONTRIBUTING.md for guidelines, code style, and the development setup. A list of contributors is maintained in CONTRIBUTORS.md.

Acknowledgments

  • Damien Elmes and the ankitects/anki contributors for the Rust backend that powers this app
  • DreamAfar for the v0.0.3 fork that contributed Image Occlusion, the multi-theme system, the Settings tab, the card template editor, retrievability stats, tag management, the rich note editor, and the GitHub Actions IPA workflow
  • AnkiDroid for pioneering the Rust backend bridge pattern on mobile
  • Point-Free for swift-dependencies
anki
flashcards
fsrs
ios
rust
space-repetition
swift
swiftui

Significant stargazers

langfield

30 followers · starred Apr 2026

小猫

282 followers · starred Jul 2026

Chanhyo Jung

115 followers · starred Sep 2026

antigluten/amgi

An open-source, offline-first Anki-compatible iOS flashcard client with sync server support, powered by the official Anki Rust backend via C FFI.

Swift

258

358 commits

updated Sep 20, 2026

See the code

README

Amgi

암기 (amgi) — Korean for "memorization"

An open-source, offline-first Anki-compatible iOS flashcard client with sync server support.

Swift 6.2 iOS 18+ watchOS 11+ Rust FFI AGPL-3.0


Amgi wraps the official ankitects/anki Rust backend via C FFI, giving you a native SwiftUI experience backed by the same battle-tested engine that powers Anki Desktop and AnkiDroid. Sync your decks with any compatible sync server (including self-hosted), study with FSRS scheduling, and keep your review history in perfect sync across all your devices.

Screenshots

Library — due-today hero card with streak, and the deck tree with per-state counts Study — today's queue across every deck, with an up-next list Review — a card showing the next interval on every rating button Browse — Anki search with deck and tag filter chips Statistics — streak, last-month summary, and the future-due forecast

Highlights

  • The real FSRS engine — scheduling, templates, search and sync are the upstream Rust code, not a reimplementation.
  • Offline-first — everything works without a connection; sync when you have one.
  • Any sync server — AnkiWeb or self-hosted, with a safe merge when collections diverge.
  • Built-in EPUB reader — with offline Yomitan-compatible dictionary lookup, so cards come from what you are reading.
  • Beyond the phone — home-screen widgets, an Apple Watch app that runs the engine on-device, and Shortcuts/Siri actions.
  • Image occlusion, card templates, FSRS simulator — the power-user surface, not a cut-down mobile client.

The full list is in Documentation/FEATURES.md.

Quick start

Install the toolchain first — Xcode 26, Rust (stable and nightly, for the watchOS slice), protoc and xcodegen. Documentation/BUILDING.md has the exact commands, plus how to run the tests.

git clone --recursive https://github.com/antigluten/amgi.git
cd amgi

./scripts/build-xcframework.sh            # Rust engine → xcframework
./scripts/generate-protos.sh              # protobuf → Swift types
cd AmgiApp && xcodegen generate && cd ..  # project is generated, not checked in
open AmgiApp/AmgiApp.xcodeproj

Documentation

DocumentWhat it covers
FeaturesEverything the app does today
BuildingRequirements, setup, build, tests, the watch target
ArchitectureLayers, package layout, design decisions
Rust bridgeThe C FFI seam, protobuf dispatch, the build pipeline
Data flowsSync, study, browse, stats and widgets, RPC by RPC
Code styleSwift conventions and the module boundaries that matter
ContributingIssues, branches, commits, pull requests
ChangelogWhat changed in each release

AGENTS.md at the repo root routes a coding agent to a per-package guide (AmgiFeatures/AGENTS.md, Sources/AGENTS.md, …) plus the reference notes in agents/.

Architecture in one diagram

SwiftUI feature modules (AmgiFeatures)
    |
@DependencyClient structs (AnkiClients)
    |
Service facades (AnkiServices)
    |
Typed protobuf requests (AnkiProtoBridge)
    |
AnkiBackend (Swift wrapper)
    |
C FFI (4 functions)
    |
Rust dynamic framework (ankitects/anki rslib)

Swift owns the UI. Rust owns everything else — database, sync, FSRS scheduling, card templates, search, import/export, statistics.

Tech stack

  • UI: SwiftUI with strict concurrency (Swift 6.2, language mode v6)
  • Dependency Injection: swift-dependencies (@DependencyClient struct-closure pattern)
  • Backend: ankitects/anki Rust crate via C FFI
  • Serialization: Protocol Buffers (25 .proto service definitions)
  • Database: SQLite (owned by Rust backend)
  • EPUB: vendored EPUBKit (MIT), with hoshidicts for Yomitan dictionaries
  • Build: SPM for library and feature modules, xcodegen for the app, widget, and watch targets

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) because it incorporates ankitects/anki (copyright Ankitects Pty Ltd), which is also AGPL-3.0. See LICENSE for the full license text.

The AGPL requires that if you distribute this software or run it as a network service, you must make the complete source code available under the same license.

Contributing

Contributions are welcome. See CONTRIBUTING.md for guidelines, code style, and the development setup. A list of contributors is maintained in CONTRIBUTORS.md.

Acknowledgments

  • Damien Elmes and the ankitects/anki contributors for the Rust backend that powers this app
  • DreamAfar for the v0.0.3 fork that contributed Image Occlusion, the multi-theme system, the Settings tab, the card template editor, retrievability stats, tag management, the rich note editor, and the GitHub Actions IPA workflow
  • AnkiDroid for pioneering the Rust backend bridge pattern on mobile
  • Point-Free for swift-dependencies
anki
flashcards
fsrs
ios
rust
space-repetition
swift
swiftui

Significant stargazers

langfield

30 followers · starred Apr 2026

小猫

282 followers · starred Jul 2026

Chanhyo Jung

115 followers · starred Sep 2026

Languages

Swift

96.6%

JavaScript

2.0%