# 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 - Fail2Ban for submit token submission request - 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 (mocking) and production ### 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`