ephemeride Svelte Themes

Ephemeride

mood tracker & micro-journaling — written in Rust & Svelte (WIP)

📆 Ephemeride

A mood tracking / short journaling web app built with Rust and Svelte.

Backend GitHub Actions Build Badge Frontend GitHub Actions Build Badge

👩‍💻 Getting Started

⚒️ Backend

All of the following commands should be run from the backend directory.

$ cd backend

Run

$ cargo run

Test

$ cargo test

Lint

$ cargo fmt
$ cargo clippy

Build

$ cargo build

Testing With Frisby

Run the backend locally which frisby will test against. Or configure env.ts to point to a different backend.

$ cargo run

Run frisby.

$ cd frisby
$ yarn
$ yarn test

🖥️ Frontend

All of the following commands should be run from the frontend directory.

$ cd frontend

Install

$ yarn

Build

When the frontend is built, it can be served by the backend.

$ yarn build

Dev Server

$ yarn dev

⛽ Diesel

This project uses Diesel and Postgres.

Running this project requires installation and setup of both diesel_cli and postgresql, as well as creating a .env file to store the database url.

🐚 setup.sh

There is a setup.sh script that will install the required dependencies, setup the database, and create required .env files.

⚠️ WARNING: This will overwrite any existing .env files.

$ ./setup.sh

📝 Manual Setup

Installing postgres

$ sudo apt-get install postgresql postgresql-contrib libpq-dev
$ sudo -u postgres createuser <username>
$ sudo -u postgres createdb <database>

Creating a user and database

$ sudo -u postgres psql
psql=# ALTER USER <username> WITH PASSWORD <password>;
psql=# GRANT ALL PRIVILEGES ON DATABASE <database> TO <username>;

Installing diesel_cli and running migrations

$ cd backend
$ cargo install diesel_cli --no-default-features --features postgres
$ echo DATABASE_URL=postgres://<username>:<password>@<host>/<database> > .env
$ diesel setup
$ diesel migration run

Redoing migrations

$ cd backend
$ diesel migration redo --all

🩺 Backend Tests

GitHub actions will run cargo test ci --verbose on commit to main or when creaing a pull request. In order to have a backend test run using GitHub actions, include ci in the test name.

As an example util::unix_time::ci_unit::positive could be defined as:

#[cfg(test)]
mod ci_unit {
  use super::*;

  #[test]
  fn positive() {
    let unix_time = unix_time();

    assert!(unix_time > 0, "unix_time should be positive");
  }
}

📂 Conventional Commits

This project uses Conventional Commits to manage commits.

Use the following format when committing:

$ git commit -m "type(scope): message"

📃 Commit Types

feat A new feature

fix A bug fix

docs Documentation only changes

style Changes that do not affect the meaning of the code

refactor A code change that neither fixes a bug nor adds a feature

perf A code change that improves performance

test Adding missing tests or correcting existing tests

build Changes that affect the build system or external dependencies

ci Changes to our CI configuration files and scripts

chore Other changes that don't modify src or test files

revert Reverts a previous commit

📚 Scope

The scope is optional and should be a GitHub issue number if applicable.



But how could you live and have no story to tell? — Fyodor Dostoevsky
🖤


Top categories

Loading Svelte Themes