Learn Anything
Explanation of vision and future here.
Ask questions on Discord if interested in developing the project or you get issues with setup.
File structure
- api
- db
- dbschema
- default.esdl - EdgeDB schema definining all the models and relations
- migrations - migration files get generated after running
pnpm db:migrate
- sync - code to sync database with .md files
- client.ts - exports client to connect with EdgeDB
- topic.ts / user.ts - CRUD functions on models
- dbschema
- grafbase - Grafbase provides GraphQL API layer for all server functions like talking with DB
- resolvers - edge resolvers are server functions exposed with GraphQL
- schema.graphql - Grafbase's config
- server - temporary hono server until grafbase supports public resolvers
- db
- app
- packages
- electron-web - electron's renderer web process
- main - electron main process (use node.js to do OS operations)
- preload - exported functions from app/packages/preload/src/index.ts are available in
electron-web
- website - website code
- components - solid components
- lib - generic utils
- routes - routes defined using file system
- packages
Setup
This project is a monorepo setup using pnpm workspaces.
pnpm i
Everything is driven using pnpm ..
commands.
Setup DB
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
Seed DB with content
pnpm i db:seed-clone
This will git clone
seed repo.
from this part, things are unstable
The goal is to seed EdgeDB with this content. Can be seen online here.
However you can try seed it with a wiki / folder of markdown of yourself.
Just add a folder in seed/wiki
like seed/wiki/my-wiki
and put some .md files inside.
Run Sync DB code
The goal of this command:
pnpm db:sync
Is to sync your local EdgeDB instance with the contents of the seed
folder you just cloned.
For this, you need to create a file here:api/db/sync/.env
. With content like this:
SEED_FOLDER_NAME=nikita
USERNAME=nikita
You can swap the names to your own. The SEED_FOLDER_NAME
is the folder that is found in seed/wiki
(from clone above).
Read api/db/sync/sync.ts and api/db/sync/wiki.ts for details how sync works.
Run server
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 Electron app
pnpm app:dev
This will start an Electron development app. Built using this app starter.
Thinking of trying to make Electron and Solid happy and use only one codebase for all web code with solid, using vite-plugin-ssr.
Electron expects index.html
file as entry but Solid Start does not provide a index.html
file.
Run web
Some issues here for now.
Contribute
Currently not all tasks are written in public. The big goals being worked on right now 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.
Big goals
Editor support
Electron app should be close to Obsidian/Reflect.
Be able to edit markdown files, show sidebar of files/folders on the left.
Text editor uses Solid CodeMirror. Similar to CodeImage project.
Local first
TinyBase used in Electron app to persist everything.
Code inspirations
Tech stack is very similar to Inlang.
Future DX wins
- Setup devenv to get one command dev env install. Currently we ask to install EdgeDB manually for example.