https://github.com/satyarohith/kament
https://github.com/satyarohith/kament
comment-system
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/satyarohith/kament
- Owner: satyarohith
- Created: 2021-01-24T06:38:53.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-02-15T15:12:19.000Z (almost 5 years ago)
- Last Synced: 2025-02-05T08:08:32.241Z (11 months ago)
- Topics: comment-system
- Language: TypeScript
- Homepage: https://kament.deno.dev
- Size: 260 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Kament
Kament is a basic comments widget for static sites. It uses FaunaDB and runs
on Deploy.
Features offered by Kament:
- Serverless. Runs only when someone makes a request.
- Data stays on your own accounts.
- Login with GitHub - reduces spam to a good extent.
- Supports markdown formatting.
To use Kament on your site, you need to first deploy the **Kament API** and then
embed the **Kament Client** script on your site. The embeded script will
communicate with the API to make comments happen. The following sections will
detail the steps required to deploy and embed Kament on your site.
- [Deploy Kament API](#deploy-kament-api)
- [Embed Kament on a Website](#embed-kament-on-a-website)
## Deploy Kament API
We use Fauna to store the comments and user data. And GitHub for login facility.
So in addition to deploying the API on Deploy, we need to acquire some
credentials from both the platforms.
Our aim in the coming sections is to gather values for the following secrets
that we will create on Deploy.
- `GITHUB_CLIENT_ID`
- `GITHUB_CLIENT_SECRET`
- `FAUNA_SECRET`
- `JWT_SIGNING_SECRET`
**Fauna**
1. Create an account on Fauna.com and a database (name it anything but `kament`
would be a good choice).
2. Import the schema available at [`db/schema.gql`](db/schema.gql) by
downloading it and uploading it on Fauna Dashboard of the just created
database.
3. After import, go to Security section and create a new key with "Server" role.
4. Grab the value and create a file named secrets.txt and paste the value
corresponding to the key name (`FAUNA_SECRET`). Use this method to store
values until we reach to the Deploy step.
**GitHub**
1. Go to https://github.com/settings/applications/new and fill the form to
create a new oAuth application. Choose the callback url same as the website
url you're going to embed Kament on.
2. After successful creation, you'll be routed to the application page and
presented with Client Id and a button to generate a new client secret.
3. Grab the client Id and create a secret named `GITHUB_CLIENT_ID` with the ID.
Click on "generate client secret" and grab the presented value to create a
secret named `GITHUB_CLIENT_SECRET`.
The Client ID is used in the Kament's client side script to initiate auth flow
when a new user tries to comment.
And now you have only one secret left to fill out: `JWT_SIGNING_SECRET`. Create
a random string that includes wide variety of characters.
**Deploy**
TODO
## Embed Kament on a Website
Add these two elements to the `` of your page.
```html
```
And then create a `div` with id named `kament` providing the data attributes
required by kament.
```html
```
The value of the `data-post-id` should be unique for every page and the value
`data-kament-endpoint` should be the base URL of the Kament API. The value of
`data-github-client-id` should be the same as the one provided in the
`GITHUB_CLIENT_ID` secret (don't worry - it is completely safe to expose the
GitHub client id).