From bebfd09436cd1e466c13084c1237a8c781eb03df Mon Sep 17 00:00:00 2001 From: Rodney Lab Date: Sat, 30 Oct 2021 09:36:45 +0100 Subject: [PATCH] =?UTF-8?q?docs:=20=F0=9F=93=9A=20update=20docs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.EXAMPLE | 10 ++++++---- README.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/.env.EXAMPLE b/.env.EXAMPLE index fbcf3e7..34c631a 100644 --- a/.env.EXAMPLE +++ b/.env.EXAMPLE @@ -8,11 +8,13 @@ VITE_TWITTER_USERNAME="askRodney" VITE_TWITTER_USER_ID="1234567890" VITE_WIRE_USERNAME="@rodneylab" VITE_HCAPTCHA_SITEKEY="10000000-ffff-ffff-ffff-000000000001" -VITE_WORKER_URL="http://127.0.0.1:8787" VITE_DOMAIN="example.com" VITE_SITE_URL="https://www.example.com" # Sentry -VITE_SENTRY_KEY="123456" -VITE_SENTRY_ORG_ID="9876543" -VITE_SENTRY_PROJECT_ID="01234567891bcdef0123456789abcd" +SENTRY_KEY="123456" +SENTRY_ORG_ID="9876543" +SENTRY_PROJECT_ID="01234567891bcdef0123456789abcd" + +# Cloudflare worker +VITE_WORKER_URL="http://127.0.0.1:8787" diff --git a/README.md b/README.md index 2b3f97e..8ef8786 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,54 @@ Narcissus is a proof of concept backend as a service app which lets you create a blog site quicker by managing important blog features like comment and message forms as well as post views and likes. This demo Svelte site is static and uses Serverless Rust Cloudflare Workers to read and create comments as well as other interactive elements using REST requests, adding spam detection and Captchas without the added hassle of adding spam detection and Captchas. The app is backed by a Supabase PostgreSQL database. + +## Features + +- Message form: let's site visitors send a message to admins. To avoid abuse by bots hCaptcha runs a challenge in browser. On the Cloudflare worker side, there is also a check with the Akismet spam detection service. The worker sends you the details of the message using a Telegram bot. + +- View count: pages views are counted automatically and displayed, letting visitors know what the most popular content is. + +- Likes feature: Users can like blog posts. The Cloudflare worker records new likes to the Supabase database. + +- Comments: users can leave comments on blog posts. As with contact page messages, we check for spam and bots. + +- Static build - the functionality all works on a static site. Latest like comment and view data is sourced at build time, so the browser can display this meta even if JavaScript is disabled. With JavaScript enabled, the users pulls in fresh meta updates made since the last build. + +## Possible Future Features + +- Newsletter subscription form handling, connecting to your preferred service. + +## Trying it Out + +You clone and build this demo SvelteKit site locally yourself: + +1. + +```shell +git clone https://github.com/rodneylab/narcissus-blog.git +cd narcissus-blog +``` + +2. Copy the example the environment variables file and populate it with any of your own details + +```shell +cp .env.EXAMPLE .env +``` + +3. Install packages with pnpm, npm or yarn: + +```shell + pnpm install # or npm install +``` + +4. Start up a development server + +```shell +pnpm run dev +``` + +5. Go to `http://localhost:3000` in your browser. + +## Troubleshooting + +- CORS: if you get CORS issues testing out hCaptcha, try their recommended solution.