Git Product home page Git Product logo

techger / editor.sh Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xuwaters/editor.sh

0.0 1.0 0.0 3.44 MB

Yet another live programming environment for collaborative code editing and running.

Home Page: https://editor.sh

License: MIT License

Ruby 0.32% Go 6.89% Dockerfile 0.04% Smarty 0.75% Shell 0.73% Perl 7.64% Makefile 0.02% Rust 22.18% PLpgSQL 0.19% TypeScript 50.78% JavaScript 0.51% HTML 5.81% CSS 4.15%

editor.sh's Introduction

YEditor

Yet another live programming environment for collaborative code editing and running.

A complete runnable example about Angular, NgRx, Monaco Editor, Xterm.js, actix-web, Diesel, GraphQL, Gin, Docker.

For a live preview: https://editor.sh

Demo ScreenShots

Collaborative Editing

Database Operation

Bird's-eye View


+--------------+
|    CLIENT    +----------------+
+------+-------+                |
       |                        |
       |                        |
       |                        |
       |                        |
       |                        |
+------v-------+        +-------v-------+                  +-----------------+
|              |        |               |                  |                 |
|  API SERVER  |        |  ROOM SERVER  +------------------>  RUNNER SERVER  |
|              |        |               |                  |                 |
+------+-------+        +-------+-------+                  +--------+--------+
       |                        |                                   |
       |                        |                                   |
       |                        |                                   |
       |                        |                                   |
       +------+                 |                                   |
              |                 |                                   |
              |                 |                                   |
        +-----v------+          |                        +----------v----------+
        |            |          |                        |                     |
        |  DATABASE  <----------+                        |  DOCKER CONTAINERS  |
        |            |                                   |                     |
        +------------+                                   +---------------------+

CLIENT (yeditor_client): Single page application implemented in Angular.

API SERVER (yeditor): Responsible for login, authorization and business logic.

ROOM SERVER (yeditor): Responsible for hosting a live room, synchronizing editing operations and terminal operations among room members.

RUNNER SERVER (yrunner-go): Stateless server for running commands and interactive shell in an isolated environment.

YSCRIPT (yscript): Entrypoint of each docker image, providing a unifined interface for running any language.

How to run

  • Start Client
cd yeditor_client && yarn && yarn start
  • Start Database
# data folder
mkdir -p ./var/database/postgres

# start db
docker run --detach --rm --name postgres \
       -e POSTGRES_PASSWORD=postgres \
       -p 127.0.0.1:5432:5432 \
       -v `pwd`/var/database/postgres:/var/lib/postgresql/data \
       postgres:latest


# create db

echo "create database yeditor;" | \
  docker exec -i -e POSTGRES_PASSWORD=postgres postgres psql -Upostgres

  • Prepare for Building
cargo install diesel_cli
  • Migrate database
cd yeditor && cargo run -- --migration && cd ..

# insert demo pad

echo "insert into pads values (1, 'demo', 1, 'demo', 'unused', '', 'typescript');" | \
  docker exec -i -e POSTGRES_PASSWORD=postgres postgres psql -Upostgres yeditor

  • Build Containers
cd containers && make build && cd ..
  • Start Servers
# start API SERVER
cd yeditor && cargo run

# start RUNNER SERVER
cd yrunner-go && go build -o bin/yrunner && ./bin/yrunner service --config config.yaml --debug

  • Open browser
open http://127.0.0.1:4200/demo

Supported Languages

bash
c
csharp
cpp
clojure
coffeescript
crystal
elixir
erlang
fsharp
go
haskell
java
javascript
kotlin
markdown
mysql
ocaml
objc
php
perl
perl6
plaintext
postgres
python2
python3
r
ruby
rust
scala
swift
typescript
vb

Roadmap

  • Implement CRDT algorithm for collaborative code editing.
  • Separate room server and api server, add a load balancer in front of room server, routing by room_hash.
  • Make room server stateless.
  • Add cache layer for database.
  • Language server integration.

Contribution

Welcome for contributions!

editor.sh's People

Contributors

xuwaters avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.