https://github.com/peruibeloko/typewriter
Simple CMS for simple blogging
https://github.com/peruibeloko/typewriter
blogging cms deno hono restful selfhosted
Last synced: 10 months ago
JSON representation
Simple CMS for simple blogging
- Host: GitHub
- URL: https://github.com/peruibeloko/typewriter
- Owner: peruibeloko
- Created: 2020-01-16T20:25:19.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-03-03T17:07:03.000Z (over 1 year ago)
- Last Synced: 2025-04-02T15:51:14.216Z (about 1 year ago)
- Topics: blogging, cms, deno, hono, restful, selfhosted
- Language: TypeScript
- Homepage:
- Size: 537 KB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Typewriter
Simple CMS written in TypeScript, runs on [Hono](https://hono.dev/) and [Deno](https://deno.com/). Data is stored using Markdown files on disk and SQLite for metadata.
## Installation
0. Install Deno
1. `git clone`
2. `deno install`
3. [Configure typewriter](#configuration)
4. `deno task start`
## Configuration
Typewriter uses two sources for its config: Either a **TOML file** or **environment variables**. The former takes precedence over the latter.
### TOML file example (for self hosting)
```toml
# A signing secret for your JWT
JWT_SECRET = "some big random string for signing JWTs"
# [Optional] Contains either:
# - A folder where a database file will be created for you
# - A database file itself
DB_PATH = "/some/path/to/folder/or/typewriter.db"
# [Optional] Enables console verbosity. Also prints all registered routes
VERBOSE = false
```
### Environment variables example (for cloud hosting)
```bash
# A signing secret for your JWT
export TYPEWRITER_JWT_SECRET="some big random string for signing JWTs"
# [Optional] Contains either:
# - A folder where a database file will be created for you
# - A database file itself
export TYPEWRITER_DB_PATH="/some/path/to/folder/or/typewriter.db"
# [Optional] Enables console verbosity. Also prints all registered routes
export TYPEWRITER_VERBOSE=false
```
## Authentication
Typewriter's authentication model is a combination of an allowlist with OTPs.
There are three steps:
1. Send a `register ` command on the typewriter CLI to get your email on the allowlist
```
> register test@example.com
successfully registered test@example.com
```
2. Send a `POST` request to `/auth/signup` to get an OTP secret
```json
{
"displayName": "John Smith",
"email": "john@example.com"
}
```
3. Send a `POST` request to `/auth/login` to get your JWT
```json
{
"email": "john@example.com",
"code": "123456",
}
```
## Usage
Typewriter has its own web server, which answers to RESTful requests. The full API is outlined [here](https://carlinhos.dev.br/typewriter/swagger) (Not built yet)
It also provides a simple CLI for issuing administrative commands, such as registering a new user and gracefully shutting down the server.
### Commands
> TODO