📮 Self hosted bookmarking app
See the code[!NOTE] This is Briefkasten v2, a complete rewrite in SvelteKit. The previous version (v1) is available on the
v1branch.If you were using the cloud instance, all of your data has been migrated to the new instance available at the same URL as before.
This is setup as a monorepo with (1) apps/web being a SvelteKit web application and (2) apps/backend being a Hono-based API. There are npm scripts in the root package.json to control most things.
$ git clone [email protected]:ndom91/briefkasten.git && cd briefkasten
$ pnpm install
This will install the dependencies for both apps.
web and backend need separate .env files. Copy both /apps/{web,backend}/.env.example files to .env, and open them with your favorite text editor to fill in your environment variables.$ cd apps/web && cp .env.example .env
$ cd apps/backend && cp .env.example .env
In these environment variable files, make sure to at least fill in the DATABASE_URL, BETTER_AUTH_SECRET, BETTER_AUTH_URL, PUBLIC_WORKER_URL and one Better Auth authentication provider, so for example GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET. The rest of the environment variables depend on the services / features you want to use.
// First time only; create the schema by applying the migrations
$ pnpm db:deploy
// dev
$ pnpm dev
// prod
$ pnpm build
$ pnpm start
[!NOTE]
pnpm db:deployrunsprisma migrate deployagainst a fresh database. If you are upgrading an existing database whose schema already matches (e.g. a previous v2 instance), baseline it instead withpnpm --filter sveltekasten-web exec prisma migrate resolve --applied 0_initso the migration is recorded without re-running the DDL. For quick local iteration you can still usepnpm db:pushto syncschema.prismadirectly.
You can run the entire stack yourself via Docker, there are multiple variants depending on if you want to self-host everything or want to rely on some cloud services.
docker-compose.yml - Containers for the frontend and backend components of the applicationdocker-compose.storage.yml - Additional postgres and rustfs containers for a database and S3-compatible object storage. You can skip these if you want to use a hosted database provider and an object storage provider, for example.docker compose up -d
docker compose -f docker-compose.yml -f docker-compose.storage.yml up -d
docker compose -f docker-compose.local-dev.yml up -d
On first run you need to create the schema. The web container ships without the Prisma CLI, so apply the baseline migration directly to Postgres. If you started the bundled database container from docker-compose.storage.yml:
docker compose exec -T database \
psql -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-briefkasten} \
< apps/web/prisma/migrations/0_init/migration.sql
If you use an external / managed database instead, apply the same baseline from a checkout of this repo:
psql "$DATABASE_URL" -f apps/web/prisma/migrations/0_init/migration.sql
# or, with the repo's dependencies installed: pnpm db:deploy
This project is open to all contributions. Please stick to the repo settings and I'll be happy to take a look at your issue / PR!
MIT
1,583 followers · starred Oct 2023
119 followers · starred Feb 2024
1,785 followers · starred Jun 2022
20 followers · starred Jul 2022
📮 Self hosted bookmarking app
See the code[!NOTE] This is Briefkasten v2, a complete rewrite in SvelteKit. The previous version (v1) is available on the
v1branch.If you were using the cloud instance, all of your data has been migrated to the new instance available at the same URL as before.
This is setup as a monorepo with (1) apps/web being a SvelteKit web application and (2) apps/backend being a Hono-based API. There are npm scripts in the root package.json to control most things.
$ git clone [email protected]:ndom91/briefkasten.git && cd briefkasten
$ pnpm install
This will install the dependencies for both apps.
web and backend need separate .env files. Copy both /apps/{web,backend}/.env.example files to .env, and open them with your favorite text editor to fill in your environment variables.$ cd apps/web && cp .env.example .env
$ cd apps/backend && cp .env.example .env
In these environment variable files, make sure to at least fill in the DATABASE_URL, BETTER_AUTH_SECRET, BETTER_AUTH_URL, PUBLIC_WORKER_URL and one Better Auth authentication provider, so for example GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET. The rest of the environment variables depend on the services / features you want to use.
// First time only; create the schema by applying the migrations
$ pnpm db:deploy
// dev
$ pnpm dev
// prod
$ pnpm build
$ pnpm start
[!NOTE]
pnpm db:deployrunsprisma migrate deployagainst a fresh database. If you are upgrading an existing database whose schema already matches (e.g. a previous v2 instance), baseline it instead withpnpm --filter sveltekasten-web exec prisma migrate resolve --applied 0_initso the migration is recorded without re-running the DDL. For quick local iteration you can still usepnpm db:pushto syncschema.prismadirectly.
You can run the entire stack yourself via Docker, there are multiple variants depending on if you want to self-host everything or want to rely on some cloud services.
docker-compose.yml - Containers for the frontend and backend components of the applicationdocker-compose.storage.yml - Additional postgres and rustfs containers for a database and S3-compatible object storage. You can skip these if you want to use a hosted database provider and an object storage provider, for example.docker compose up -d
docker compose -f docker-compose.yml -f docker-compose.storage.yml up -d
docker compose -f docker-compose.local-dev.yml up -d
On first run you need to create the schema. The web container ships without the Prisma CLI, so apply the baseline migration directly to Postgres. If you started the bundled database container from docker-compose.storage.yml:
docker compose exec -T database \
psql -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-briefkasten} \
< apps/web/prisma/migrations/0_init/migration.sql
If you use an external / managed database instead, apply the same baseline from a checkout of this repo:
psql "$DATABASE_URL" -f apps/web/prisma/migrations/0_init/migration.sql
# or, with the repo's dependencies installed: pnpm db:deploy
This project is open to all contributions. Please stick to the repo settings and I'll be happy to take a look at your issue / PR!
MIT
1,583 followers · starred Oct 2023
119 followers · starred Feb 2024
1,785 followers · starred Jun 2022
20 followers · starred Jul 2022