dnalob / learn-anything.xyz

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.xyz

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

End goal of Learn Anything is to become best place and tool for keeping track of what you know. What ideas you have. What you want to learn next. What you don't know yet. And how you can learn that in most optimal way possible given what you know already.

Try website yourself first to get feel for it.

It is fully open source project with active community on Discord. There is great focus on both DX of developing everything LA and even more, end user UX.

Contents

File structure

Tech stack is described in docs/tech-stack.md.

Setup

Bun is used to run things as part of monorepo. However pnpm & pnpm workspaces are used to manage dependencies (bun gave issues with installing deps and breaking builds)

First run:

pnpm i
bun setup

bun setup runs bun cmd.ts init (can see cmd.ts code for what it does). It will create .env files for you so you can start coding the project fast. It will also git clone tasks and data repos.

Monorepo tooling should get better soon. If you're intested in making it better by integrating Nx or similar tools, please reach out on Discord.

Setup EdgeDB

Warning Instructions might break, if you get an unexpected error or anything, reach out on Discord, we will resolve it

Install EdgeDB by running curl .. command from EdgeDB website. It is used as main server database. Should be below command for Linux/Mac:

curl --proto '=https' --tlsv1.2 -sSf https://sh.edgedb.com | sh

Then run:

bun db:init

Follow instructions, name EdgeDB instance learn-anything.

Then run bun cmd.ts seedEdgeDb.

Then do:

cd grafbase/edgedb
edgedb database wipe -I learn-anything
edgedb restore seed.db

Now you can run bun db:ui. This will open EdgeDB graphical interface where you can run queries or explore the schema. The EdgeDB database you got, has all the content of existing Learn Anything, you can explore the data inside and run various queries.

If you ran bun setup, you should have already a grafbase/.env file with this content:

LOCAL=true
EDGEDB_DSN=
PUBLIC_HANKO_API_URL=https://e879ccc9-285e-49d3-b37e-b569f0db4035.hanko.io
INTERNAL_SECRET=secret

Fill EDGEDB_DSN value with value you get from running bun db:get-dsn. It's needed to connect to EdgeDB locally.

Generate edgedb-js bindings

bun db:migrate

This gives you type safe access to EdgeDB and lets you use the query builder nicely.

Seed EdgeDB with content

Warning Below command is incomplete and needs testing, please reach out on Discord and we do it together with you

bun db:seed

Above command is incomplete but will be soon. It should take the files you got in data folder (after running bun dev-setup) and fill EdgeDB db with content necessary to develop LA very fast.

Reach out on Discord to get a semi working version of the command. ♥️

Run GraphQL server (Grafbase)

Warning If you reach any problems with setup, reach out on Discord

Assumes you followed instructions for Setup EdgeDB and have grafbase/.env file with:

LOCAL=true
EDGEDB_DSN=edgedb://
PUBLIC_HANKO_API_URL=https://e879ccc9-285e-49d3-b37e-b569f0db4035.hanko.io
INTERNAL_SECRET=secret

Then run:

npx grafbase@latest dev

This starts Grafbase locally and give you GraphQL access.

Download Pathfinder app and open http://localhost:4000 inside. Can also open http://localhost:4000 in browser but Pathfinder is nice app. In there, you can run various queries calling resolvers defined in grafbase/resolvers. Grafbase picks up any changes you make to the files in the folder.

Grafbase config is set in grafbase/grafbase.config.ts. You specify what resolvers are defined, what inputs/outputs they have. Then you create or edit files in grafbase/resolvers. Read existing resolvers to make sense of how it works.

When you make changes to grafbase.config.ts as we are using Mobius as our GraphQL client and it is fully typed. You can run bun mobius-update, it will update the schema in shared/lib/mobius.ts with new schema.

Run website (Solid)

Warning If you reach any problems with setup, reach out on Discord

If you ran bun setup before, you should have website/.env file with this content:

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

Hanko is used as auth provider. You can swap Hanko API variable content with one from a project you create yourself. Above is project we made for local dev you can use.

Run:

bun web

Open http://localhost:3000

Warning You need to make sure you have data in the database to actually develop. So do section Seed EdgeDB with content. Reach out on Discord for help as things are unstable still.

Run desktop app (Tauri/Rust)

Warning WIP, massive effort is put here after website is released and is working without issues

Goal of desktop app is to be essentially a clone of Obsidian/Reflect (working with local markdown files). And with ability to publish the markdown content to LA. All private data and files will be end to end encrypted and synced with mobile app.

It will be the best note taking experience you can get. All open source.

bun app

Warning WIP, Above command will give you issues most likely, reach out on Discord and we will help resolve them

Contribute

Always open to useful ideas or fixes in form of issues or PRs.

Current issues are organised with labels. Issues currently in focus are labeled with Current Month label.

If issue is not already present (do search first), open new issue, start discussion or ask about it on Discord.

It's okay to submit draft PR as you can get help along the way to make it merge ready.

Any issues with setup or making your first feature or trying to fix a bug will be resolved asap. Same goes for discussing ideas on how to make the tool even better than it is now.

Docs

All docs can be seen in docs.

It is advisable you read them, before you start developing anything as they provide a lot of context and general knowledge.

There is big focus on documentation and clarity in the project. All code should be clear and understandable and well documented.

Check Dev Tips for some advice on development.

Design

All design is done in Figma. There is also a FigJam going over the software architecture such as the EdgeDB schema.

If you're designer and want to help out or have ideas, mention it on Discord.

Tasks / Explore

There is separate repo of tasks with goal to take the tasks used in LA and generalise it for use by community.

Together with explore for prototyping of various kind.

Commands

bun setup

bun cmd.ts setup

Fully sets up LA for development (website, desktop, mobile, api, ..).

bun app

cd app && bun tauri:dev

Run desktop app built with Tauri.

bun app:build

cd app && bun run tauri build --debug

Create debug build with Tauri.

bun web

cd website && bun dev

Run website.

bun db

cd grafbase/edgedb && bun --watch cli/cli.ts

Run CLI to quickly execute TS code (run queries and more..).

bun db:ui

cd grafbase/edgedb && edgedb ui

Open EdgeDB UI to run queries and more.

bun db:watch

cd grafbase/edgedb && edgedb watch

Watch for changes in EdgeDB schema and apply them making migrations.

bun db:migrate

cd grafbase/edgedb && edgedb migration create && edgedb migrate && bunx @edgedb/generate edgeql-js --target ts && bunx @edgedb/generate queries --target ts

Create new migration, apply migrations and generate EdgeDB-JS types

bun db:queries-generate

cd grafbase/edgedb && bunx @edgedb/generate edgeql-js --target ts && bunx @edgedb/generate queries --target ts

Generate EdgeDB-JS types from custom queries.

bun db:get-dsn

cd grafbase/edgedb && edgedb instance credentials --insecure-dsn

Get insecure DSN for EdgeDB instance.

bun db:dump

cd private && edgedb dump prod.db

Dump production database.

bun db:load-connections

cd grafbase/edgedb && tput reset && bun cli/loadConnectionsIntoGrafbase.ts

Load topic connections into Grafbase cache.

bun api

bunx grafbase@latest dev

Run Grafbase API in development mode.

bun ts

bun --watch cmd.ts run

Execute run() function in cmd.ts for quick experiments

bun rust-crate-wiki-test

cd app/src-tauri/crates/wiki/ && cargo watch -q -- sh -c "tput reset && cargo test -q --lib"

Run tests for Rust wiki crate in watch mode.

bun grafbase

npx grafbase@latest dev

Run Grafbase in development mode.

bun mobius-update

bun cmd.ts updateMobiusSchema

Update Mobius schema.

bun format

prettier -w .

Format codebase with Prettier.

bun lint:code

eslint --ignore-path .gitignore --max-warnings 0 --ext .ts,.tsx,.js,.jsx .

Lint code with ESLint.

bun lint:types

tsc --noEmit

Check for TypeScript type errors.

bun lint

bun lint:code && bun lint:types

Run both code and type linting.

🖤

Discord X

About

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

https://learn-anything.xyz

License:MIT License


Languages

Language:TypeScript 97.4%Language:EdgeQL 2.5%Language:CSS 0.0%Language:Rust 0.0%Language:HTML 0.0%Language:JavaScript 0.0%