Skip to content

rapnuss/cipher-notes

Repository files navigation

ciphernotes

The project is live on https://ciphernotes.com

Disclaimer

The notes are encrypted before being sent to the server, but the encryption key is stored in the browser's local storage. This way no password is needed to access the notes and they key can easily be shared between devices. You can share the key via a QR code directly from app to app.

Development Setup

Prerequisites

  • nvm (node version manager)
  • Docker (for development database)
  • Bun (for backend)
  • Yarn (for frontend)
  • mkcert (for generating development certificates)

Database Setup

  1. Start the PostgreSQL database:
    docker-compose up -d postgres
    This will start the PostgreSQL database on port 5432.
  2. Initialize the database schema:
    cd backend
    bun db:migrate    # Apply schema changes

Backend Setup

  1. Navigate to the backend directory:
    cd backend
  2. Copy the environment file:
    cp .env.example .env
  3. Install dependencies:
    bun install
  4. Start the backend:
    bun dev

SSL Certificate Setup

  1. Install mkcert (if not already installed):

  2. Install local CA:

    mkcert -install
  3. Navigate to the frontend directory:

    cd frontend
  4. Generate certificates for localhost:

    mkcert -key-file key.pem -cert-file cert.pem localhost 127.0.0.1 ::1

    This will create two files:

    • cert.pem: SSL certificate (trusted by your system)
    • key.pem: Private key

Frontend Setup

  1. Navigate to the frontend directory (if not already there):
    cd frontend
  2. Install node
    nvm install
    nvm use
  3. Install dependencies:
    yarn install
  4. Start the frontend development server:
    yarn dev

Development URLs

Tech Stack

  • Frontend: React + TypeScript + Vite
  • Backend: Bun + TypeScript
  • Server: express-zod-api
  • Database: PostgreSQL 16
  • ORM: Drizzle

Mobile Device Access

  1. Find your computer's local IP address:
    ipconfig # Windows
    ifconfig | grep 'inet ' | grep -v 127.0.0.1 # macOS/Linux
  2. Generate new certificates including your IP:
    mkcert -key-file key.pem -cert-file cert.pem localhost 127.0.0.1 ::1 <your-ip>
  3. Start the frontend:
    yarn dev
  4. Find and install the root CA certificate on your mobile device:
    mkcert -CAROOT
    This shows the folder containing rootCA.pem
  5. Access https://<your-ip>:5173 on your mobile device

TWA

Generate keystore

~\.bubblewrap\jdk\jdk-17.0.11+9\bin\keytool.exe -genkeypair -alias com.ciphernotes.twa -keyalg RSA \
 -keysize 2048 -validity 10000 -keystore android.keystore

Generate SHA256 fingerprint

~\.bubblewrap\jdk\jdk-17.0.11+9\bin\keytool.exe -printcert -jarfile ".\app-release-signed.apk"

About

A local-first note-taking app with end-to-end encryption for your private thoughts and data.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published