You can contribute to Srcbook in three primary ways:
- Using Srcbook! Usage leads to filing issues for bugs or feature requests.
- Contributing code for fixes or features.
- Being a Srcbook advocate.
Being an advocate is highly underrated. It helps the project grow and receive more investment. The best way to do this is use Srcbook, share your Srcbooks with others, write about or present using Srcbook, etc.
If you write interesting Srcbooks, share them with us and we will happily feature them on the hub!
Tip
Before spending time writing code, consider opening an issue and clarifying desired behavior with the maintainers to ensure a smooth process. We are quick to respond!
If you're ready to file a PR, remember to add a changeset.
- Node 18+
- pnpm 9.5+
Note
If you switch node versions during development, you may need to rebuild with pnpm rebuild -r
due to the better-sqlite3
native bindings.
First, make sure to install dependencies:
pnpm install
The app runs 2 separate servers:
- one vite server that hot-reloads and runs the web application
- one express server that runs the API and the websocket transport.
To run the app for local development, you can start both with a single command:
pnpm run dev
Then visit http://localhost:5173
Similar to NPM, check top-level package.json for scripts.
pnpm run check-types
To run a script defined in one of the packages:
pnpm run check-types --filter=@srcbook/api
When you create a PR, we ask that you also create a changeset. This is part of our release process automation.
pnpm changeset
This will prompt you about what has changed and whether it should be considered major/minor/patch.
Important
Given the project is young, we are keeping all changes as minor or patch. Using patch is the safest bet for now.
Please write good changeset messages because these will appear in our changelogs.
To add a dependency from npm registry:
# Add npm dependency to the API package
pnpm add <dep> --filter api
# Add npm dev dependency to the API package
pnpm add -D <dep> --filter api
To add a dependency from within the workspace:
# Add the shared package to the API package.
pnpm add @srcbook/shared --workspace --filter api
# Add the shared package as a dev dependency to the API package.
pnpm add -D @srcbook/shared --workspace --filter api
To remove a package, use remove
instead of add
in the commands above.
The application is powered by a local sqlite3 database, that lives at ~/.srcbook/srcbook.db
. We use drizzle as an orm and for migrations.
To create a new migration, first modify schema.ts, then run
# This will generate the migration
pnpm run generate --name <migration_name>
Migrations should be executed when the application starts. You can manually apply them using:
pnpm run migrate