learn-anything / learn-anything

Organize world's knowledge, explore connections and curate learning paths

Home Page:https://learn-anything.xyz

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Learn Anything

Explanation of project's high level goals is here.

Current focus is on making Tauri app working. Essentially an app like Obsidian.

Reference file structure to make sense of how code is laid out in the repo.

Read setup to get started with development.

Sharing current tasks in readme until MVP is released.

Ask questions on Discord if interested in developing the project or you get issues with setup.

File structure

Setup

This project is a monorepo setup using pnpm workspaces.

Everything is driven using pnpm .. commands. First run:

pnpm i
pnpm dev-setup

pnpm dev-setup will git clone seed repo. It's needed for dev setup + test suite to work.

Run Tauri app

to complete

Moving code from Electron version.

Check tasks.

Useful DevTools panel

In the app you get after running pnpm app:dev, you will see DevTools panel in bottom right corner. It contains a list of useful actions you can run to aid you.

One of the actions is Seed TinyBase. This will seed your local TinyBase store/sqlite with one of the wikis in seed folder.

Read app/packages/preload/src/index.ts file for details. syncWikiFromSeed is the function.

Test

pnpm test

Will run tests found in test.

test/wiki.test.ts file tests markdown file parsing.

Running code via tests is very effective. You can open terminal on your right and edit code on the left and on each .ts file save it will rerun the test and check if behavior you are testing is correct. Reading through the test suite is great way to understand the backend part of the app.

Setup EdgeDB

First need to make Electron + TinyBase + Solid sync work smoothly. Check ## Tasks

Assumes you installed EdgeDB (run curl .. command).

pnpm db:init

Follow instructions, name EdgeDB instance learn-anything.

Run edgedb ui. This will open EdgeDB graphical interface where you can run queries or explore the schema.

Run below command to apply the schema defined in default.esdl on your local DB:

pnpm db:watch

Then, generate EdgeDB TS bindings with:

pnpm db:ts-generate

Run server

First need to make Electron + TinyBase + Solid sync work smoothly. Check ## Tasks

Before running server, create file at api/server/.env with this content:

EDGEDB_INSTANCE=learn-anything
EDGEDB_SECRET_KEY=edbt_ey

EDGEDB_SECRET_KEY can be gotten by running pnpm db:ui which will open the EdgeDB UI.

In terminal after running above command you will see url like http://localhost:10700/ui?authToken=edbt_ey. EDGEDB_SECRET_KEY is the authToken content.

Then run:

pnpm api

In future Grafbase will be used for all API requests. There is blocker there that you can't do both public and private resolvers.

pnpm api:grafbase

Will start Grafbase locally and give you GraphQL access.

Run web

First need to make Electron + TinyBase + Solid sync work smoothly. Check ## Tasks

Create .env file inside website with this content:

VITE_HANKO_API=https://e879ccc9-285e-49d3-b37e-b569f0db4035.hanko.io
API_OF_GRAFBASE=http://127.0.0.1:4000/graphql

Hanko is used as auth provider. You can swap Hanko API variable content with one from a project you create yourself.

Run:

pnpm web:dev

Open http://localhost:3000

Contribute

The tasks to do are outlined below.

If you are interested in helping out, please join Discord and let's make it happen.

The project is incredibly ambitious once it works.

Tasks

sorted by priority

  • make app work with Tauri
    • this app used electron before but it had issues when trying to deploy it, code for it here
  • add sqlite persistence
    • what tinybase did in electron version
  • move markdown parser from ts to rust
  • hardlink lib folder from app and website so lib functions can actually be used when deploying
  • load nikita's wiki into tinybase/sqlite and run queries, check in app, all data is there correctly
    • pnpm ts-run will run run.ts file that has code to load things into tinybase from seed/wiki/nikita
  • make test/wiki.test.ts test pass (partly done, trying to load nikita's wiki and see what breaks)
    • add tests for files that break into test suite with proper expect checks
  • electron app close to Obsidian/Reflect in UX
    • be able to edit markdown files, show sidebar of files/folders on the left
    • sync up with file system, using watcher package most likely
  • everything nicely persisted to tinybase with solid.js store syncing working well
    • test well
  • setup proper code sharing between monorepo packages
    • there is lib and components folders at root
      • should be usable across all the mono repo
    • the way packages are imported should be thought out well
      • which packages get installed at root? which go to specific package?
  • would be nice if app/packages did not exist potentially
    • just don't think app/packages is nice structure, maybe move everything into app/
    • afraid to modify it as it came from template and moving things will break
  • in dev tools panel when you click on Seed TinyBase (default), it seeds with default files
    • also add Seed TinyBase (custom), then provide an option of folders to choose what to seed so users can provide custom folders to seed quickly
  • is there need for app/packages/electron-web/package.json?
    • or app/package.json is enough
    • it's all the same bundle I would think
  • VSCode does not automatically suggest imports from lib folder (super annoying)
    • also imports use relative imports like ../../lib. should be ~/lib/ instead
    • use pnpm for this? tsconfig?
    • if you do global import from test, it will actually do non relative imports
      • however imports from app to say lib won't work, maybe due to tsconfig in app folder

Better DX

Notes

to be moved to docs/ and deployed with vitepress later

About

Organize world's knowledge, explore connections and curate learning paths

https://learn-anything.xyz


Languages

Language:TypeScript 97.8%Language:CSS 1.5%Language:JavaScript 0.4%Language:Rust 0.3%