diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6bd5a38d4888c1717fc598ddb6c223967cbc20de..0421d3368bbf1ffc58230409ae81c941d842a641 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -349,7 +349,7 @@ ExternalProject_Add(liblektor_rs
     SOURCE_DIR        "${CMAKE_SOURCE_DIR}/src/rust/liblektor-rs"
     BUILD_COMMAND     ${RUST_BUILD_CMD}
     COMMAND           ${RUST_BUILD_CMD}
-    BUILD_BYPRODUCTS  "${CMAKE_SOURCE_DIR}/src/rust/target/${RUST_BUILD_TYPE}/liblektor_rs.a"
+    BUILD_BYPRODUCTS  "${CMAKE_SOURCE_DIR}/src/rust/target/${RUST_BUILD_TYPE}/liblektor_unsafe.a"
     BUILD_ALWAYS      1
     BUILD_IN_SOURCE   1
 )
@@ -358,7 +358,7 @@ add_dependencies(lektord liblektor_rs)
 
 target_link_libraries(lektord
     PRIVATE
-    "${CMAKE_SOURCE_DIR}/src/rust/target/${RUST_BUILD_TYPE}/liblektor_rs.a"
+    "${CMAKE_SOURCE_DIR}/src/rust/target/${RUST_BUILD_TYPE}/liblektor_unsafe.a"
     ${MPV_LIBRARY}
     ${CMAKE_DL_LIBS}
     ${SQLITE3_LIBRARY}
diff --git a/README.md b/README.md
index 77dd649e98472cec38d9983f3a108b40580fad9d..0fb73390d75f79acc998473f38f187a4ed6ce94e 100644
--- a/README.md
+++ b/README.md
@@ -68,6 +68,14 @@ the correct sqlite support on your system:
 cargo install diesel_cli --no-default-features --features sqlite
 ```
 
+To visualize dependencies of the rust part of lektor, you can write the
+following commands from the root of each rust workspaces:
+
+```sh
+cargo install cargo-depgraph
+cargo depgraph --all-deps --dedup-transitive-deps | dot -Tpng > dependencies.png
+```
+
 ### Building instructions
 
 The manual way of installing and setting up lektor:
diff --git a/lektor.code-workspace b/lektor.code-workspace
index c3d879e217e39f7cb345aede1f5458f2c2a06407..73cb939728b97d2a0e214fd1589442fcf92ef68b 100644
--- a/lektor.code-workspace
+++ b/lektor.code-workspace
@@ -28,6 +28,8 @@
         "json.format.enable": true,
         "rust-analyzer.checkOnSave.command": "clippy",
         "rust-analyzer.inlayHints.parameterHints.enable": false,
-        "rust-analyzer.procMacro.attributes.enable": true
+        "rust-analyzer.diagnostics.enable": true,
+        "rust-analyzer.procMacro.enable": true,
+        "rust-analyzer.procMacro.attributes.enable": true,
     }
 }
\ No newline at end of file
diff --git a/src/rust/liblektor-rs/Cargo.toml b/src/rust/liblektor-rs/Cargo.toml
index b2d3cdaed6da8387ef20e02f32ddebe9ca112175..583e4d5f04b626d3fa1463dbafa6935e09a76a29 100644
--- a/src/rust/liblektor-rs/Cargo.toml
+++ b/src/rust/liblektor-rs/Cargo.toml
@@ -1,12 +1,20 @@
-[package]
-name = "lektor-rs"
-version = "0.1.0"
-edition = "2021"
+[workspace]
+resolver = "2"
+members = [
+    "lektor_c_compat",
+    "lektor_db",
+    "lektor_repo",
+    "lektor_unsafe",
+    "kurisu_api",
+]
 
-[lib]
-crate-type = ["staticlib"]
+[workspace.package]
+edition = "2021"
+authors = ["Maƫl MARTIN"]
+version = "0.1.0"
+license = "MIT"
 
-[dependencies]
+[workspace.dependencies]
 log = "0.4"
 libc = "0.2.0"
 diesel_migrations = "2"
diff --git a/src/rust/liblektor-rs/dependencies.png b/src/rust/liblektor-rs/dependencies.png
new file mode 100644
index 0000000000000000000000000000000000000000..5e4e4ce12258caed146c834abbf8cb57e1a821a1
Binary files /dev/null and b/src/rust/liblektor-rs/dependencies.png differ
diff --git a/src/rust/liblektor-rs/kurisu_api/Cargo.toml b/src/rust/liblektor-rs/kurisu_api/Cargo.toml
new file mode 100644
index 0000000000000000000000000000000000000000..32bad39ffee91b571960b90401ee0d23b9c4c84d
--- /dev/null
+++ b/src/rust/liblektor-rs/kurisu_api/Cargo.toml
@@ -0,0 +1,10 @@
+[package]
+name = "kurisu_api"
+version.workspace = true
+edition.workspace = true
+authors.workspace = true
+license.workspace = true
+
+[dependencies]
+log.workspace = true
+serde.workspace = true
diff --git a/src/rust/liblektor-rs/src/kurisu_api/mod.rs b/src/rust/liblektor-rs/kurisu_api/src/lib.rs
similarity index 100%
rename from src/rust/liblektor-rs/src/kurisu_api/mod.rs
rename to src/rust/liblektor-rs/kurisu_api/src/lib.rs
diff --git a/src/rust/liblektor-rs/src/kurisu_api/v1.rs b/src/rust/liblektor-rs/kurisu_api/src/v1.rs
similarity index 100%
rename from src/rust/liblektor-rs/src/kurisu_api/v1.rs
rename to src/rust/liblektor-rs/kurisu_api/src/v1.rs
diff --git a/src/rust/liblektor-rs/lektor_c_compat/Cargo.toml b/src/rust/liblektor-rs/lektor_c_compat/Cargo.toml
new file mode 100644
index 0000000000000000000000000000000000000000..75e61449adc94ad5544a67a850eb87f6c8e62947
--- /dev/null
+++ b/src/rust/liblektor-rs/lektor_c_compat/Cargo.toml
@@ -0,0 +1,10 @@
+[package]
+name = "lektor_c_compat"
+version.workspace = true
+edition.workspace = true
+authors.workspace = true
+license.workspace = true
+
+[dependencies]
+log.workspace = true
+libc.workspace = true
diff --git a/src/rust/liblektor-rs/src/compat.rs b/src/rust/liblektor-rs/lektor_c_compat/src/c_types.rs
similarity index 59%
rename from src/rust/liblektor-rs/src/compat.rs
rename to src/rust/liblektor-rs/lektor_c_compat/src/c_types.rs
index 0588c98aa0b5f67a27b04a9b4f3f2f7266a452d9..f522e478773e7b1b530c3e7e3d2622c319d74b23 100644
--- a/src/rust/liblektor-rs/src/compat.rs
+++ b/src/rust/liblektor-rs/lektor_c_compat/src/c_types.rs
@@ -1,4 +1,5 @@
-pub const LEKTOR_TAG_MAX: usize = 256;
+//! Types defined in the C part of the project. Don't use them from safe C code,
+//! only use the safe wrappers.
 
 pub struct LktQueue;
 pub struct LktDb;
diff --git a/src/rust/liblektor-rs/lektor_c_compat/src/lib.rs b/src/rust/liblektor-rs/lektor_c_compat/src/lib.rs
new file mode 100644
index 0000000000000000000000000000000000000000..f17bb99be820c5d443aa5f50249cb9c62eb58f16
--- /dev/null
+++ b/src/rust/liblektor-rs/lektor_c_compat/src/lib.rs
@@ -0,0 +1,12 @@
+//! Defines functions and types that matches the one defined in the C part of
+//! the lektor source code.
+//!
+//! From safe rust code you *must not* use the types defined in the [c_types]
+//! module.
+
+pub mod c_types;
+
+pub use libc::{c_char, c_int, c_long, c_void, size_t};
+
+/// The maximal length of a tag in lektor.
+pub const LEKTOR_TAG_MAX: usize = 256;
diff --git a/src/rust/liblektor-rs/lektor_db/Cargo.toml b/src/rust/liblektor-rs/lektor_db/Cargo.toml
new file mode 100644
index 0000000000000000000000000000000000000000..5410dc3a4246390205c36a68108da7601e74cadf
--- /dev/null
+++ b/src/rust/liblektor-rs/lektor_db/Cargo.toml
@@ -0,0 +1,15 @@
+[package]
+name = "lektor_db"
+version.workspace = true
+edition.workspace = true
+authors.workspace = true
+license.workspace = true
+
+[dependencies]
+log.workspace = true
+serde.workspace = true
+
+diesel_migrations = "2"
+diesel = { version = "2", default-features = false, features = ["sqlite"] }
+
+kurisu_api = { path = "../kurisu_api" }
diff --git a/src/rust/liblektor-rs/build.rs b/src/rust/liblektor-rs/lektor_db/build.rs
similarity index 96%
rename from src/rust/liblektor-rs/build.rs
rename to src/rust/liblektor-rs/lektor_db/build.rs
index e259c52ba764fe4e902b88b3e7a81574427c5708..ad4572e446309b368c9d5a298a0fbc8e057e0972 100644
--- a/src/rust/liblektor-rs/build.rs
+++ b/src/rust/liblektor-rs/lektor_db/build.rs
@@ -34,7 +34,7 @@ fn main() {
         .canonicalize()
         .expect("failed to canonicalize OUT_DIR");
     let source_dir = out_dir
-        .join("../../../../../liblektor-rs")
+        .join("../../../../../liblektor-rs/lektor_db")
         .canonicalize()
         .expect("failed to canonicalize the source path");
     let migration_dir = source_dir
diff --git a/src/rust/liblektor-rs/diesel.toml b/src/rust/liblektor-rs/lektor_db/diesel.toml
similarity index 100%
rename from src/rust/liblektor-rs/diesel.toml
rename to src/rust/liblektor-rs/lektor_db/diesel.toml
diff --git a/src/rust/liblektor-rs/migrations/2022-09-30-204512_initial/down.sql b/src/rust/liblektor-rs/lektor_db/migrations/2022-09-30-204512_initial/down.sql
similarity index 100%
rename from src/rust/liblektor-rs/migrations/2022-09-30-204512_initial/down.sql
rename to src/rust/liblektor-rs/lektor_db/migrations/2022-09-30-204512_initial/down.sql
diff --git a/src/rust/liblektor-rs/migrations/2022-09-30-204512_initial/up.sql b/src/rust/liblektor-rs/lektor_db/migrations/2022-09-30-204512_initial/up.sql
similarity index 100%
rename from src/rust/liblektor-rs/migrations/2022-09-30-204512_initial/up.sql
rename to src/rust/liblektor-rs/lektor_db/migrations/2022-09-30-204512_initial/up.sql
diff --git a/src/rust/liblektor-rs/src/database/connexion.rs b/src/rust/liblektor-rs/lektor_db/src/connexion.rs
similarity index 94%
rename from src/rust/liblektor-rs/src/database/connexion.rs
rename to src/rust/liblektor-rs/lektor_db/src/connexion.rs
index 368c238dedf3518b6760ee9b712d2081985f242e..36cb14a954c28114f4cca742d9b6b42ffb8d558b 100644
--- a/src/rust/liblektor-rs/src/database/connexion.rs
+++ b/src/rust/liblektor-rs/lektor_db/src/connexion.rs
@@ -1,25 +1,18 @@
-use super::{
+use crate::{
+    models::*,
     queue::{LktDatabasePriority, LktDatabaseQueueRangeIter},
     *,
 };
-use crate::{database::models::*, kurisu_api::v1 as api_v1};
-use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
-
-/// The migrations!
-const MIGRATIONS: EmbeddedMigrations = embed_migrations!();
-
-/// Run migrations in a connexion!
-fn run_migration(conn: &mut SqliteConnection) -> Result<(), String> {
-    conn.run_pending_migrations(MIGRATIONS)
-        .map_err(|err| err.to_string())
-        .map(|_| ())
-}
+use kurisu_api::v1 as api_v1;
 
 /// Create a connexion to a database and run automatically the migrations.
 fn establish_connection(path: impl AsRef<str>) -> Result<SqliteConnection, String> {
+    use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
+    const MIGRATIONS: EmbeddedMigrations = embed_migrations!();
     let mut conn = SqliteConnection::establish(path.as_ref())
         .map_err(|err| format!("error connecting to {}: {}", path.as_ref(), err))?;
-    self::run_migration(&mut conn)?;
+    conn.run_pending_migrations(MIGRATIONS)
+        .map_err(|err| err.to_string())?;
     Ok(conn)
 }
 
@@ -32,7 +25,9 @@ pub struct LktDatabaseConnection {
 /// expression...
 macro_rules! with_dsl {
     ($table: ident => $expr: expr) => {{
+        #[allow(unused_imports)]
         use self::schema::$table::dsl::*;
+        #[allow(unused_imports)]
         use diesel::dsl::*;
         $expr
     }};
diff --git a/src/rust/liblektor-rs/src/database/schema.rs b/src/rust/liblektor-rs/lektor_db/src/database/schema.rs
similarity index 100%
rename from src/rust/liblektor-rs/src/database/schema.rs
rename to src/rust/liblektor-rs/lektor_db/src/database/schema.rs
diff --git a/src/rust/liblektor-rs/src/database/error.rs b/src/rust/liblektor-rs/lektor_db/src/error.rs
similarity index 98%
rename from src/rust/liblektor-rs/src/database/error.rs
rename to src/rust/liblektor-rs/lektor_db/src/error.rs
index d0fd2eb7d42e821e43a1a2c2bb38b3777fb35e03..2655c99d0bf1727e04ea63ef5f71175d450dcc23 100644
--- a/src/rust/liblektor-rs/src/database/error.rs
+++ b/src/rust/liblektor-rs/lektor_db/src/error.rs
@@ -1,5 +1,3 @@
-use super::*;
-
 pub enum LktDatabaseError {
     DieselConnection(diesel::ConnectionError),
     DieselResult(diesel::result::Error),
diff --git a/src/rust/liblektor-rs/src/database/mod.rs b/src/rust/liblektor-rs/lektor_db/src/lib.rs
similarity index 91%
rename from src/rust/liblektor-rs/src/database/mod.rs
rename to src/rust/liblektor-rs/lektor_db/src/lib.rs
index 5360847921a2f92449fde49ab8f5ec8e448f3f1c..123d70c57d28f3c29d018753297a9d43ea681df4 100644
--- a/src/rust/liblektor-rs/src/database/mod.rs
+++ b/src/rust/liblektor-rs/lektor_db/src/lib.rs
@@ -5,11 +5,9 @@ pub mod error;
 pub mod models;
 pub mod queue;
 pub mod schema;
-pub mod unsafe_interface;
 
 pub(self) use diesel::prelude::*;
 pub(self) use error::*;
-pub(self) use log::*;
 pub(self) use std::{
     collections::VecDeque,
     ops::{Index, Range},
diff --git a/src/rust/liblektor-rs/src/database/models.rs b/src/rust/liblektor-rs/lektor_db/src/models.rs
similarity index 95%
rename from src/rust/liblektor-rs/src/database/models.rs
rename to src/rust/liblektor-rs/lektor_db/src/models.rs
index b22a1be9756f5daa531e9cd4f386a09dde9c4f20..c8c2b21c75d53d9ed39c2d3f387b89d39b5822db 100644
--- a/src/rust/liblektor-rs/src/database/models.rs
+++ b/src/rust/liblektor-rs/lektor_db/src/models.rs
@@ -1,9 +1,7 @@
 //! Models used for querying, inserting or updating the database.
 
-use crate::{
-    database::{schema::*, *},
-    kurisu_api::v1 as api_v1,
-};
+use crate::{schema::*, *};
+use kurisu_api::v1 as api_v1;
 
 // First the insertable things
 
diff --git a/src/rust/liblektor-rs/src/database/queue.rs b/src/rust/liblektor-rs/lektor_db/src/queue.rs
similarity index 100%
rename from src/rust/liblektor-rs/src/database/queue.rs
rename to src/rust/liblektor-rs/lektor_db/src/queue.rs
diff --git a/src/rust/liblektor-rs/lektor_db/src/schema.rs b/src/rust/liblektor-rs/lektor_db/src/schema.rs
new file mode 100644
index 0000000000000000000000000000000000000000..d45ece40bea531314208616dbd3352cc5b07f7bb
--- /dev/null
+++ b/src/rust/liblektor-rs/lektor_db/src/schema.rs
@@ -0,0 +1,86 @@
+// @generated automatically by Diesel CLI.
+
+diesel::table! {
+    history (epoch) {
+        id -> Integer,
+        epoch -> Integer,
+    }
+}
+
+diesel::table! {
+    iso_639_1 (code) {
+        code -> Text,
+        name_en -> Text,
+        is_iso -> Bool,
+        is_macro -> Bool,
+    }
+}
+
+diesel::table! {
+    kara (id) {
+        id -> Integer,
+        is_dl -> Bool,
+        song_title -> Text,
+        song_type -> Text,
+        song_origin -> Text,
+        source_name -> Text,
+        language -> Text,
+        file_hash -> Text,
+    }
+}
+
+diesel::table! {
+    kara_makers (id, name) {
+        id -> Integer,
+        name -> Text,
+    }
+}
+
+diesel::table! {
+    kara_tags (kara_id, tag_id, value) {
+        kara_id -> Integer,
+        tag_id -> Integer,
+        value -> Nullable<Text>,
+    }
+}
+
+diesel::table! {
+    repo (id) {
+        id -> Integer,
+        name -> Text,
+    }
+}
+
+diesel::table! {
+    repo_kara (repo_id, repo_kara_id, local_kara_id) {
+        repo_id -> Integer,
+        repo_kara_id -> Integer,
+        local_kara_id -> Integer,
+    }
+}
+
+diesel::table! {
+    tag (id) {
+        id -> Integer,
+        name -> Text,
+    }
+}
+
+diesel::joinable!(history -> kara (id));
+diesel::joinable!(kara -> iso_639_1 (language));
+diesel::joinable!(kara_makers -> kara (id));
+diesel::joinable!(kara_tags -> kara (kara_id));
+diesel::joinable!(kara_tags -> tag (tag_id));
+diesel::joinable!(repo_kara -> kara (local_kara_id));
+diesel::joinable!(repo_kara -> repo (repo_id));
+
+diesel::allow_tables_to_appear_in_same_query!(
+    history,
+    iso_639_1,
+    kara,
+    kara_makers,
+    kara_tags,
+    repo,
+    repo_kara,
+    tag,
+);
diff --git a/src/rust/liblektor-rs/lektor_repo/Cargo.toml b/src/rust/liblektor-rs/lektor_repo/Cargo.toml
new file mode 100644
index 0000000000000000000000000000000000000000..f9811726002f145c2feb40bcbef596c80599bc12
--- /dev/null
+++ b/src/rust/liblektor-rs/lektor_repo/Cargo.toml
@@ -0,0 +1,19 @@
+[package]
+name = "lektor_repo"
+version.workspace = true
+edition.workspace = true
+authors.workspace = true
+license.workspace = true
+
+[dependencies]
+log.workspace = true
+serde.workspace = true
+
+reqwest = { version = "0.11", default-features = false, features = [
+    "default-tls",
+    "multipart",
+    "json",
+] }
+
+lektor_c_compat = { path = "../lektor_c_compat" }
+kurisu_api = { path = "../kurisu_api" }
diff --git a/src/rust/liblektor-rs/lektor_repo/src/lib.rs b/src/rust/liblektor-rs/lektor_repo/src/lib.rs
new file mode 100644
index 0000000000000000000000000000000000000000..3552656f182833a2c4dc1722e156462e21cd7e8f
--- /dev/null
+++ b/src/rust/liblektor-rs/lektor_repo/src/lib.rs
@@ -0,0 +1,8 @@
+//! The crate responsible of downloading karas from kurisu.
+
+use lektor_c_compat::c_types::*;
+
+/// The structure responsible to download karas from kurisu.
+pub struct LktModuleRepoRs {
+    queue: LktQueuePtr,
+}
diff --git a/src/rust/liblektor-rs/lektor_unsafe/Cargo.toml b/src/rust/liblektor-rs/lektor_unsafe/Cargo.toml
new file mode 100644
index 0000000000000000000000000000000000000000..588c5d84a6becbf28686058b17aeba3bb71f9b5a
--- /dev/null
+++ b/src/rust/liblektor-rs/lektor_unsafe/Cargo.toml
@@ -0,0 +1,14 @@
+[package]
+name = "lektor_unsafe"
+version.workspace = true
+edition.workspace = true
+
+[lib]
+crate-type = ["staticlib"]
+
+[dependencies]
+log.workspace = true
+
+lektor_c_compat = { path = "../lektor_c_compat" }
+lektor_repo = { path = "../lektor_repo" }
+lektor_db = { path = "../lektor_db" }
diff --git a/src/rust/liblektor-rs/src/database/unsafe_interface.rs b/src/rust/liblektor-rs/lektor_unsafe/src/db.rs
similarity index 86%
rename from src/rust/liblektor-rs/src/database/unsafe_interface.rs
rename to src/rust/liblektor-rs/lektor_unsafe/src/db.rs
index 80655afb9d5556034c011a67ee8d4b843ca1da36..32cb3bdaf96a9a8ad123806cfcf7a9809865846f 100644
--- a/src/rust/liblektor-rs/src/database/unsafe_interface.rs
+++ b/src/rust/liblektor-rs/lektor_unsafe/src/db.rs
@@ -4,11 +4,13 @@
 //! Be carefull when naming things because those names might collide with things
 //! defined in lektor's C code...
 
-use super::{connexion::LktDatabaseConnection, *};
-use std::{mem::ManuallyDrop, path::PathBuf};
+use crate::*;
+use lektor_db::connexion::LktDatabaseConnection;
 
 /// Wrap the [`establish_connection`] function. On error log the message and
 /// return a [`std::ptr::null_mut`].
+/// ### Safety
+/// The passed path must be a valid C-str.
 #[no_mangle]
 pub unsafe extern "C" fn lkt_database_establish_connection(
     path: *const u8,
@@ -32,6 +34,9 @@ pub unsafe extern "C" fn lkt_database_establish_connection(
 /// pointer is passed to the function log the error and do nothing. If the
 /// passed pointer was not obtained by the correct function the behaviour is
 /// undefined.
+/// ### Safety
+/// The passed db pointer must be created by
+/// [`lkt_database_establish_connection`].
 #[no_mangle]
 pub unsafe extern "C" fn lkt_database_close_connection(db: *mut LktDatabaseConnection) {
     if db.is_null() {
@@ -46,6 +51,9 @@ pub unsafe extern "C" fn lkt_database_close_connection(db: *mut LktDatabaseConne
 /// pointer must be allocated by the [lkt_database_establish_connection]
 /// function. The function will return `true` on success, `false` otherwise. Any
 /// error will be logged.
+/// ### Safety
+/// The passed db pointer must be created by
+/// [`lkt_database_establish_connection`].
 #[no_mangle]
 pub unsafe extern "C" fn lkt_database_delete_kara_by_repo(
     db: *mut LktDatabaseConnection,
@@ -61,6 +69,9 @@ pub unsafe extern "C" fn lkt_database_delete_kara_by_repo(
 /// Delete a kara by its local id. The passed database pointer must be allocated
 /// by the [lkt_database_establish_connection] function. The function will
 /// return `true` on success, `false` otherwise. Any error will be logged.
+/// ### Safety
+/// The passed db pointer must be created by
+/// [`lkt_database_establish_connection`].
 #[no_mangle]
 pub unsafe extern "C" fn lkt_database_delete_kara_by_local_id(
     db: *mut LktDatabaseConnection,
diff --git a/src/rust/liblektor-rs/lektor_unsafe/src/lib.rs b/src/rust/liblektor-rs/lektor_unsafe/src/lib.rs
new file mode 100644
index 0000000000000000000000000000000000000000..c89df43fe07807fb2a561a1b16bc2e877e40d854
--- /dev/null
+++ b/src/rust/liblektor-rs/lektor_unsafe/src/lib.rs
@@ -0,0 +1,11 @@
+//! Create C functions to calls things defined in the rust language from C code.
+//! See the headers inside the liblektor-rs folder from the C include directory.
+
+#![allow(unused_variables)]
+
+pub mod db;
+pub mod repo;
+
+pub(crate) use lektor_c_compat::*;
+pub(crate) use log::error;
+pub(crate) use std::{mem::ManuallyDrop, path::PathBuf};
diff --git a/src/rust/liblektor-rs/src/module/repo_rs.rs b/src/rust/liblektor-rs/lektor_unsafe/src/repo.rs
similarity index 83%
rename from src/rust/liblektor-rs/src/module/repo_rs.rs
rename to src/rust/liblektor-rs/lektor_unsafe/src/repo.rs
index b55dc959428e48f04bce8d60388133620e30719f..f5bd90de2787d9d302c27cda5e1f836e22c44d8c 100644
--- a/src/rust/liblektor-rs/src/module/repo_rs.rs
+++ b/src/rust/liblektor-rs/lektor_unsafe/src/repo.rs
@@ -1,9 +1,8 @@
-use crate::*;
+use crate::{c_types::*, *};
+use lektor_repo::*;
 
-type LktModuleRepoRsPtr = *mut LktModuleRepoRs;
-struct LktModuleRepoRs {
-    queue: LktQueuePtr,
-}
+/// A pointer to the repo structure. This is the only thing the C code will see.
+pub type LktModuleRepoRsPtr = *mut LktModuleRepoRs;
 
 #[no_mangle]
 extern "C" fn lkt_module_repo_rs_get_struct_size() -> size_t {
diff --git a/src/rust/liblektor-rs/src/lib.rs b/src/rust/liblektor-rs/src/lib.rs
deleted file mode 100644
index 7aacf0b761ce85ab72543a84933a3e375b476b15..0000000000000000000000000000000000000000
--- a/src/rust/liblektor-rs/src/lib.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-#![allow(dead_code, unused_imports)]
-
-mod compat;
-mod database;
-pub mod kurisu_api;
-mod module;
-
-pub(crate) use compat::*;
-pub(crate) use libc::{c_char, c_int, c_long, c_void, size_t};
diff --git a/src/rust/liblektor-rs/src/module/mod.rs b/src/rust/liblektor-rs/src/module/mod.rs
deleted file mode 100644
index 0d27c386baba8054092d2636eed4ac06612a4cc5..0000000000000000000000000000000000000000
--- a/src/rust/liblektor-rs/src/module/mod.rs
+++ /dev/null
@@ -1 +0,0 @@
-pub(crate) mod repo_rs;