-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add different data providers and improve docs
This adds support for switching between in-memory, local filesystem, s3 or sqlite.
- Loading branch information
Showing
10 changed files
with
426 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,69 @@ | ||
# Exalidraw Complete | ||
# Excalidraw Complete: A Self-Hosted Solution | ||
|
||
Frustrated on how difficult it is to setup excalidraw self-hosted but with data | ||
storage and collaboration function this represents and attempt to run the | ||
necessary function with a single binary implemented in go. This includes: | ||
Excalidraw Complete simplifies the deployment of Excalidraw, bringing an | ||
all-in-one solution to self-hosting this versatile virtual whiteboard. Designed | ||
for ease of setup and use, Excalidraw Complete integrates essential features | ||
into a single Go binary. This solution encompasses: | ||
|
||
- the frontend UI | ||
- a in-memory data layer | ||
- socket.io implementation for collaboration | ||
- The intuitive Excalidraw frontend UI for seamless user experience. | ||
- An integrated data layer ensuring fast and efficient data handling based on different data providers. | ||
- A socket.io implementation to enable real-time collaboration among users. | ||
|
||
The project goal is to alleviate the setup complexities traditionally associated with self-hosting Excalidraw, especially in scenarios requiring data persistence and collaborative functionalities. | ||
|
||
## Installation | ||
|
||
To get started, download the latest release binary: | ||
|
||
```bash | ||
# Visit https://github.com/PatWie/excalidraw-complete/releases/ for the download URL | ||
wget <binary-download-url> | ||
chmod +x excalidraw-complete | ||
./excalidraw-complete | ||
``` | ||
|
||
Once launched, Excalidraw Complete is accessible at `localhost:3002`, ready for | ||
drawing and collaboration. | ||
|
||
### Configuration | ||
|
||
Excalidraw Complete adapts to your preferences with customizable storage solutions, adjustable via the `STORAGE_TYPE` environment variable: | ||
|
||
- **Filesystem:** Opt for `STORAGE_TYPE=filesystem` and define `LOCAL_STORAGE_PATH` to use a local directory. | ||
- **SQLite:** Select `STORAGE_TYPE=sqlite` with `DATA_SOURCE_NAME` for local SQLite storage, including the option for `:memory:` for ephemeral data. | ||
- **AWS S3:** Choose `STORAGE_TYPE=s3` and specify `S3_BUCKET_NAME` to leverage S3 bucket storage, ideal for cloud-based solutions. | ||
|
||
These flexible configurations ensure Excalidraw Complete fits seamlessly into your existing setup, whether on-premise or in the cloud. | ||
|
||
## Building from Source | ||
|
||
Interested in contributing or customizing? Build Excalidraw Complete from source with these steps: | ||
|
||
```bash | ||
# Clone and prepare the Excalidraw frontend | ||
git clone https://github.com/excalidraw/excalidraw.git | ||
cd excalidraw | ||
git checkout tags/v0.17.3 | ||
git apply ../frontend.patch | ||
# Follow build instructions to compile assets into the frontend directory | ||
``` | ||
|
||
Compile the Go application: | ||
|
||
Apply the patch to the frontend and build excalidraw into `frontend`. Run | ||
```bash | ||
go run main.go | ||
go build -o excalidraw-complete main.go | ||
``` | ||
|
||
Everything will be served under `localhost:3002` | ||
Start the server: | ||
|
||
```bash | ||
./excalidraw-complete | ||
``` | ||
|
||
Excalidraw Complete is now running on your machine, ready to bring your collaborative whiteboard ideas to life. | ||
|
||
--- | ||
|
||
Excalidraw is a fantastic tool, but self-hosting it can be tricky. I welcome | ||
your contributions to improve Excalidraw Complete — be it through adding new | ||
features, improving existing ones, or bug reports. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package documents | ||
|
||
import ( | ||
"bytes" | ||
"excalidraw-complete/core" | ||
"io" | ||
"net/http" | ||
|
||
"github.com/go-chi/chi/v5" | ||
"github.com/go-chi/render" | ||
) | ||
|
||
type ( | ||
DocumentCreateResponse struct { | ||
ID string `json:"id"` | ||
} | ||
) | ||
|
||
func HandleCreate(documentStore core.DocumentStore) http.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) { | ||
data := new(bytes.Buffer) | ||
_, err := io.Copy(data, r.Body) | ||
if err != nil { | ||
http.Error(w, "Failed to copy", http.StatusInternalServerError) | ||
return | ||
} | ||
id, err := documentStore.Create(r.Context(), &core.Document{Data: *data}) | ||
if err != nil { | ||
http.Error(w, "Failed to save", http.StatusInternalServerError) | ||
return | ||
} | ||
|
||
render.JSON(w, r, DocumentCreateResponse{ID: id}) | ||
render.Status(r, http.StatusOK) | ||
} | ||
} | ||
|
||
func HandleGet(documentStore core.DocumentStore) http.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) { | ||
id := chi.URLParam(r, "id") | ||
document, err := documentStore.FindID(r.Context(), id) | ||
if err != nil { | ||
http.Error(w, "not found", http.StatusNotFound) | ||
return | ||
} | ||
w.Write(document.Data.Bytes()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.