Rust implementation of https://en.wikipedia.org/wiki/Zettelkasten
Zettelkasten is build up out of the following modules:
runtime
, what runtime is being used?data
, how is the data stored?front
, one or multiple frontendsThe following confirmations are available:
runtime |
data |
front |
---|---|---|
async-std |
sqlite |
terminal |
postgres |
Note that these modules can be mixed and matched in any way you want.
To run a particular combination, pass the set you want as feature flags. e.g.:
# runtime: async-std
# data: sqlite
# front: terminal
cargo run --features runtime-async-std,data-sqlite,front-terminal
Additionally you can use just:
cargo install just
And then run one of:
command |
runtime |
data |
front |
---|---|---|---|
just run_terminal |
async-std |
sqlite |
terminal |
We highly recommend installing sqlx-cli
:
cargo install sqlx-cli --no-default-features --features rustls,sqlite,postgres
Some configs require custom setup instructions
data-sqlite
data-sqlite
will look for, or create, a database in the following places:
DATABASE_URL
ZETTELKASTEN_DATABASE_URL
.env
file present, this will be loaded<DATA_DIR>/zettelkasten/database.db
where <DATA_DIR>
is the value from dirs::data_dir
$XDG_DATA_HOME
or $HOME/.local/share
C:/Users/<user>/AppData/Roaming/
./database.db
)For local development where you also have a running zettelkasten system, we highly recommend setting DATABASE_URL
to a temp database while working on this project.
To set a temp database you need to:
DATABASE_URL=sqlite://<path>
to .env
DATABASE_URL=sqlite://database.db
cargo install sqlx-cli --no-default-features --features sqlite,rustls
sqlx database setup --source data/sqlite/migrations
data/sqlite/migrations/*.up.sql
data-postgres
data-postgres
will look for a database connection string in one of the following environment variables:
DATABASE_URL
ZETTELKASTEN_DATABASE_URL
If such an environment variable is not set, postgres will not be able to run.
For local development where you also have a running zettelkasten system, we highly recommend setting DATABASE_URL
to a temp database while working on this project.
To set a temp database you need to:
DATABASE_URL=postgres://<path>
to .env
cargo install sqlx-cli --no-default-features --features postgres,rustls
sqlx database setup --source data/postgres/migrations
data/postgres/migrations/*.up.sql
When a change in the database schema is made, please follow the following steps to make sure the sqlx-data.json
is properly updated:
.env
and updated database.db
exist in the data/sqlite
folderjust prepare_sqlite
from this folder (not data/sqlite
)cargo sqlx prepare -- --features runtime-async-std
from the data/sqlite
folderdata/sqlite/sqlx-data.json