/danoweb

Yet another distributed authoring environment built with deno

Primary LanguageJavaScriptMIT LicenseMIT

danoweb

distributed authoring environment built with deno for the web

how to use

  1. anyone can (collaboratively) edit any served text files by appending ?mode=edit query parameter -- どのページも URL 末尾に ?mode=edit をつけると編集できます
  2. those who know the authentication token (USER_PASSWORD) can save the edits to update the served files (ask me if interested) -- 編集結果をファイルに書き戻すには USER_PASSWORD が必要です

concept

  • what you see is what you can (collaboratively) edit
    • like a WebDAV server but with a code editor that appears with ?mode=edit query parameter
    • like a Wiki site but with focus on serving raw files
  • built with Deno for Deno

backend

  1. for collaborative editing, Firebase Realtime Database is used
  2. for serving files and saving the edits, native file system is used

plans

  • see GitHub issues for short-term goals
  • Wiki-like links in the editor (currently, the code editor renders the code as-is, but there is much space for PX improvements)
  • better collaborative editing experience (e.g., asking the user to login using GitHub etc. to show collaborators)
  • TypeScript auto completion for all the Deno code on the web!

deploy

a) use pre-built Docker image

docker run --name danoweb -p 8000:8000 \
  -e API_KEY=... \
  -e AUTH_DOMAIN=... \
  -e DATABASE_URL=... \
  -e PROJECT_ID=... \
  -e STORAGE_BUCKET=bucket_id.appspot.com \
  -e MESSAGING_SENDER_ID=... \
  -e APP_ID=... \
  -e DATABASE_PREFIX=prefix_ \
  -e USER_PASSWORD=password \
  arcatdmz/danoweb

b) build docker image and run

  1. git clone
  2. see "environment variables" section and put the .env file accordingly
  3. docker build and run
git clone https://github.com/arcatdmz/danoweb.git
cd danoweb
vi ./server/.env
docker build . -t danoweb
docker build . --file Dockerfile.local -t danoweb:local
docker run --name danoweb -v ./public:/work/server/public -p 8000:8000 danoweb:local

c) deploy to Heroku

  1. git clone
  2. see "environment variables" section and put the .env file accordingly
  3. create a Heroku project
  4. run heroku config:push to save .env content as config vars
  5. git push to make the project public
git clone https://github.com/arcatdmz/danoweb.git
cd danoweb
vi ./server/.env
heroku create <your app name>
heroku stack:set container
heroku config:push -f ./server/.env
git push heroku master

environment variables

  • before starting the server, put .env file in ./server/ -- all the values except for USER_PASSWORD are related to firebase cand can be retrieved from the website
API_KEY={YOUR_FIREBASE_API_KEY}
AUTH_DOMAIN={YOUR_FIREBASE_AUTH_DOMAIN}
DATABASE_URL={YOUR_FIREBASE_DATABASE_URL}
PROJECT_ID={YOUR_FIREBASE_PROJECT_ID}
STORAGE_BUCKET={YOUR_FIREBASE_STORAGE_BUCKET}
MESSAGING_SENDER_ID={YOUR_MESSAGING_SENDER_ID}
APP_ID={YOUR_APP_ID}
DATABASE_PREFIX={PATH_PREFIX_FOR_YOUR_DATABASE(optional)}
USER_PASSWORD={PASSWORD_FOR_AUTHENTICATION}
  • optionally provide the following environment variables
  • do NOT define these variables when the application runs in a Docker container (especially Heroku that provides a unique PORT for every deploy)
USER_DIR=./public
HOST=127.0.0.1
PORT=8000

develop

build

  1. install deno (tested with v1.7.1)
  2. build client-side code (requires yarn) -- this can be skipped since the built files are included in the repo
cd client/
yarn install
yarn build

start

start the server with deno run (use deno without run for deno below v0.4.0)

cd server/
deno run --allow-env --allow-net --allow-read --allow-write --unstable server.ts

or yarn

cd server/
yarn start

https://github.com/arcatdmz/danoweb