From 36331c11827e7efe6f5d723e0200fea06bb1054bdbd3e4fde2c5b42e77bad35a Mon Sep 17 00:00:00 2001 From: mtrx Date: Sun, 4 May 2025 04:29:50 +0200 Subject: [PATCH] readme init --- README.md | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..577d524 --- /dev/null +++ b/README.md @@ -0,0 +1,63 @@ +# Litelog + +## Philosophy + +With the first iteration of this project, I've learned a lot and realized, it would take a lot of work to get to where I want to be. Instead, I want to rebuild it with an elegant architecture, feature-testing-first philosophy and some leaner frameworks. + +### Features included + +- Aiming for 80% test coverage +- Server side rendered posts using fast templating engine +- Single user session management using CSRF tokens +- Admin panel for post CRUD unlocked via submit token +- Input sanitization +- Post-title based URLs instead of using count-up IDs +- Static file hosting +- Configuration via Environment variables +- Container support +- Request logging +- Minimal CSS for accessibility +- Run profiles for development + +### Features deliberately omitted + +- External stylesheets and fonts +- Multi User / RBAC System +- Any JavaScript + +## Development + +1. Clone this repository +2. Install diesel and create a database +```bash +cd ./site +#cargo install diesel_cli --no-default-features --features "sqlite" +#diesel setup --database-url content/test-db.sqlite3 +#diesel migration run --database-url content/test-db.sqlite3 +cargo test +``` +3. Set up your configuration .env (see below) + +## Configuration environment file + +All configuration options are defined in .env which should be placed in the path where crablog is run. An example configuration is provided: + +`.env` +``` +CL_USERNAME=yourusername # required +CL_EMAIL=me@mydomain.tld # optional +CL_BIND_PORT=8000 # optional +CL_SUBMIT_TOKEN=Submit!123 # required +CL_GITHUB_ACCOUNT=yourusername # optional +CL_TWITTER_ACCOUNT=yourusername # optional +CL_MASTODON_ACCOUNT=yourusername@mastodon.social # optional +CL_REDDIT_ACCOUNT=yourusername # optional +CL_DISCORD_ACCOUNT=yourusername # optional + +# only needed when not using a docker container +CL_ROOT_PATH=/path/to/template/and/sqliteDB/directory +``` + +## Regenerate Migrations from Schema: + +`diesel migration generate --diff-schema=./src/db/schema.rs create_posts`