This repository contains the source code of Thinktool, an associative note-taking application inspired by TheBrain and Roam Research.
Please note that this software is not open source. The omission of a LICENSE
file is intentional.
As such, the instructions in this README are mostly written for myself, and may not be sufficient to compile this project on your own. That being said, you may find some hints in .github/workflows
.
This project is also not currently accepting issues or pull requests. Please see Thinktool's web page for information about how to contact me with your feedback about Thinktool. Also, I may occationally force push to this repository, since I'm not expecting anyone else to clone it.
If I abandon this project in the future, I intend to make it open source. If you can see that I have not touched this repository in several months, feel free to send me an email reminding me of this fact!
Source code:
The generated output goes in the /dist/
directory. Each subdirectory is intended to be deployed differently:
Directory | Purpose |
---|---|
/dist/ |
Output files generated from /src/ . Each subdirectory represents a sepearte target. |
/dist/static/ |
Static content, including HTML, CSS and JavaScript. |
/dist/server/ |
Code for dynamic server running Node.js. |
Tools and configuration:
Directory | Purpose |
---|---|
/tools/ |
Scripts and other tools used for building, development and deployment. |
/tools/dev/ |
Tools used for development only. |
The application consists of two parts:
- Static resources, output to
/dist/static/
- Node.js server, output to
/dist/server/
- Electron-based desktop client, output to
/dist/desktop/
The static resources should be deployed to a static site hosting service, while the server code should be run on an appropriate server using Node.js. The desktop client is bundled as an executable app.
You will need to have the following dependencies installed:
- Node.js and NPM
- Docker
- Bash and the GNU core utilities
- Curl
- Azure CLI
- PostgreSQL
If you don't want to install these dependencies on your development machine,
there is a Dockerfile
descirbing a Debian system with most of those
dependencies installed available in the tools/dev/
directory. Use a separate
Docker container for PostgreSQL. For example:
$ docker build tools/dev -t thinktool-dev
$ docker run -e POSTGRES_PASSWORD=password -v postgres-data:/var/lib/postgresql/data -d postgres
$ docker run -ti -v $(pwd):/work thinktool-dev
There is also a script that does this for you:
$ tools/dev/start-docker.sh
Set the following environment variables:
DIAFORM_API_HOST
— API server host, including the protocol, e.g.https://api.thinktool.io
.
Then build the web client and other static resources with:
$ ./tools/build-client.sh
$ ./tools/build-static.sh
Then, set AZURE_STORAGE_ACCOUNT
and AZURE_STORAGE_KEY
and run
./tools/deploy-static.sh
to deploy static files to Microsoft Azure Storage.
The desktop client can currently be built for Linux and Windows. We're planning on supporting macOS in the future. It must be built on the same platform that is being targeted.
Start by setting the following environment variables:
DIAFORM_API_HOST
— API server host, including the protocol, e.g.https://api.thinktool.io
.
On Linux, build the desktop client with:
$ ./tools/build-desktop-linux.sh
Even on Windows, you need to use bash
as your shell. Run:
$ ./tools/build-desktop-windows.sh
(Note that building the desktop client clears out the dist/static/
directory.
This is a temporary hack; see the build-desktop-linux.sh
and
build-desktop-windows.sh
files for more information.)
Once you have built the desktop client, the output will be in dist/
. Set
AZURE_STORAGE_ACCOUNT
and AZURE_STORAGE_KEY
and run
./tools/deploy-static.sh
to deploy these files to Microsoft Azure Storage.
The server uses a PostgreSQL database. Set the following environment variables before running the server:
DIAFORM_POSTGRES_HOST
— The hostname containing the database, e.g.localhost
DIAFORM_POSTGRES_PORT
— Port that the database is running on, e.g.5432
DIAFORM_POSTGRES_USERNAME
— Username used to authenticate with the PostgreSQL DB, e.g.postgres
DIAFORM_POSTGRES_PASSWORD
— Password used to authenticate with the PostgreSQL DB, e.g.postgres
You will need to manually set up the database schema. See tools/db/_initialize.sql
, though this may be outdated.
For sending emails (used for "Forgot my password" functionality), we use SendGrid. Configure the following environment variables:
SENDGRID_API_KEY
— SendGrid API key; find or create under Settings → API Keys
Additionally, the server expects the following environment variables to be set:
DIAFORM_STATIC_HOST
— Base URL of the server hosting static resources, e.g.https://thinktool.io
Build the server as a Docker image:
# docker build -t thinktool -f tools/Dockerfile .
Once you have the thinktool
image, run it with the environment variables given above:
# docker run \
-e DIAFORM_POSTGRES_HOST \
-e DIAFORM_POSTGRES_PORT \
-e DIAFORM_POSTGRES_USERNAME \
-e DIAFORM_POSTGRES_PASSWORD \
-e SENDGRID_API_KEY \
-e DIAFORM_STATIC_HOST \
-p 80:80 \
thinktool