https://github.com/phukon/clack
Clack syncs your writing ✍🏽 activity from Notion and Google Docs, and comes with an AI assistant and a Notion-style WYSIWYG editor
https://github.com/phukon/clack
cloudflare-worker postgresql vercel-ai-sdk
Last synced: 2 months ago
JSON representation
Clack syncs your writing ✍🏽 activity from Notion and Google Docs, and comes with an AI assistant and a Notion-style WYSIWYG editor
- Host: GitHub
- URL: https://github.com/phukon/clack
- Owner: phukon
- License: agpl-3.0
- Created: 2024-02-08T01:49:27.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-15T18:25:32.000Z (about 1 year ago)
- Last Synced: 2024-07-15T22:39:00.263Z (about 1 year ago)
- Topics: cloudflare-worker, postgresql, vercel-ai-sdk
- Language: TypeScript
- Homepage: https://clack.rkph.me
- Size: 8.73 MB
- Stars: 10
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Clack
Track your
writing progress effortlessly
Learn more »
Introduction ·
Features ·
Tech Stack ·
Author
## Introduction
Clack syncs your writing activity from Notion and Google Docs, and comes with an AI assistant and a Notion-style WYSIWYG editor.
## Features
- Encrypted Notes
- Google Integration
- Notion Integration
- Notion Widget
- AI Writing Assistant
- Notion-style WYSIWYG editor
- 14 Heatmap Themes## Tech Stack
- [Next.js](https://nextjs.org/) – framework
- [TypeScript](https://www.typescriptlang.org/) – language
- [Tailwind](https://tailwindcss.com/) – CSS
- [Vercel KV](https://vercel.com/docs/storage/vercel-kv) – redis
- [Cloudflare Workers KV](https://www.cloudflare.com/en-in/developer-platform/workers-kv/) – Low latency KV data store
- [Prisma](https://www.prisma.io/) - orm
- [Neon](https://neon.tech/) – database
- [NextAuth.js](https://next-auth.js.org/) – auth
- [Stripe](https://stripe.com/) – payments
- [Resend](https://resend.com/) – emails
- [Vercel](https://vercel.com/) – deployments## Author
- Riki Phukon ([@kungfukon](https://twitter.com/kungfukon))
### Nuances
- Always use `finally` in async worksloads if a UI state depends on it!!. Otherwise, the UI will forever be stuck and never update after the async work is done.### Cron Job
- A vercel cronjob triggers at 0000hrs UTC to set the word-count reference.
- A second cronjob from an EC2 instance triggers at 0530hrs IST or 0000hrs UTC for redundancy.## Encryption
**Type** : `AES-256-CBC`
- The key should be **32 bytes** or **256 bits** in length!!
- Initialization Vector should be **16 bytes** or **128 bits**.## Contribution logic
- Update wordcount Ref if a document is removed.
- Missing contributions are showed as blank on the canvas. No need to add blank contribution data to keep contributions array filled with consecutive dates.
- Works only if the day comes before the current system date.
- Non-consecutive dates after the current system date are not rendered.## ⚠ Documents
- Added specific error handling for Prisma's known request errors
- Checked for error code 'P2002' to identify unique constraint violations
- Checked if the 'url' field was involved in the constraint violation
- Provided a custom error message for duplicate URL scenarios
- Added checks for unauthorized request on another User's documents.This change enhances the reliability and user experience of the addDocument function by ensuring that duplicate URLs are handled in a more informative and user-friendly manner.
### Prisma
- After schema changes run `npx prisma migrate dev`
- Reset KV store by sending a GET request on the KV worker url with the param `?sayonara` and a populated `X-Custom-Auth-Key` header.- User registers
- Generate a new verification token using the email they used to register
- Send verification token to that email
- Inside the email send the route '/auth/new-verification'
- Add that route to the public route
- That route renders the new verification form
- Inside that page, use the search params to fetch the token -->