crypta
(n.) an underground vault or chamber, especially one beneath a church that is used as a burial place.
Or an offline-first blazing fast & secure note taking application. Check the latest development version at: https://cryptaa.pages.dev. Note that the name is "Cryptaa", with two 'a's instead of one. The application has a first version. However, I started from scratch here to explore some better ideas.
For a note-taking application, I wanted these attributes:
It surprised me that I couldn't find anything that check all the boxes. Some check more than the others, but in the end, all of them are inadequate and served as the inspiration for Cryptaa. Or NIH syndrome kicked in, and I wanted to use that chance to polish my skills/play around with new technologies.
Cryptaa uses Triplit under the hood. Triplit runs in your browser (persisting to IndexedDB), and can be run within an independent server (persisting to SQLite) as well.
sequenceDiagram
actor u as User
participant c1 as Client 1 (Mobile)
participant s as Server
participant c2 as Client 2 (Desktop)
u ->> c1: create notes
c1 ->> c1: store the data
c1 ->> s: send data
s ->> s: store the data
s ->> c2: send data
node
and npm
ready:node --version
# v18.18.2
npm --version
# 9.8.1
npm install
npm run dev
npm run server
# or
npx triplit dev
yarn build
The built files should be available in a folder named build/
. You are free to
copy this somewhere else and serve it as a static website using a web server
like Nginx or Caddy.
npm run preview
Or you can move to the folder and try serving it yourself:
# cd build
python -m http.server
Clone the repository on the machine that you want to deploy the server. Make
sure that npm
is ready and the dependencies are installed (look at the
section for "Development").
Set your environment variables at .env
:
TRIPLIT_JWT_SECRET=super-secret
TRIPLIT_PROJECT_ID=cryptaa-server
# to run the server at port 5432
npm run server
# or specify another port
PORT=8888 npm run server
Service Token
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ4LXRyaXBsaXQtdG9rZW4[...]
A good security practice is to "hide" the port from public access (does not
allow access to http://<your-ip>:5432
), and use a HTTPS reverse proxy to it
(allow access to https://cryptaa-server.<your-domain>
). Feel free to use
Nginx or Caddy or anything that you're comfortable with.
Demo server's credentials:
URL: https://cryptaa-server-demo.nguyenhuythanh.com
Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ4LXRyaXBsaXQtdG9rZW4tdHlwZSI6InNlY3JldCIsIngtdHJpcGxpdC1wcm9qZWN0LWlkIjoiY3J5cHRhYS1zZXJ2ZXIifQ.IDJB0XN3CjpBbWJxyGpHKbPU6rTQkndsFZYF2h4WEto
Thanks to JetBrains for granting this project's previous version an Open Source License.