Skip to content

dimitrisnl/horion

Repository files navigation

Horion

This is a Bun monorepo, using Turborepo, with the following two apps:

And a few helper packages:

  • Emails, a dedicated directory for react email as I don't want the bundled Next.js server anywhere near my apps.
  • UI, a component library using RadixUI 1
  • Icons, re-exporting some icons from Lucide Icons

Motivation

I want to try some technologies, form opinions, and maybe blog about them. It's a fun playground.

Testing

I'm using bun:test as test runner, with in-memory PGlite from @electric-sql/pglite. I've only written tests for the API package so far.

Communication and type-safety

To bridge the gap between them and share types, I'm using ORPC2. I particularly like its integration with TanStack Query. Here's an example:

I can pass the query I want to use using queryOptions, without the need to set up query keys:

const {
  data: {memberships},
} = useSuspenseQuery(
  orpc.membership.getAll.queryOptions({
    staleTime: minutes(5),
  }),
);

And invalidate it, again without passing query keys:

queryClient.invalidateQueries(orpc.membership.getAll.queryOptions());

There are many benefits to using any RPC library, and I'm probably under-selling it, but it works well, and I'm happy. Even when I move the TanStack Start, which has its own RPC-like functionality, I'll keep using it.

Authentication

I'm using a simple magic-link flow. Yes, I hand roll my own authentication.

  1. Creating a session
  2. Saving the session token in a secure cookie
  3. Passing the cookie around

Previously I was using BetterAuth but it was too opinionated for my taste.

Styling

I love Catalyst UI, and I think it's the prettiest and most well-crafted component library.Unfortunately, it has a limited license, and since this is an open-source project that can act as a template, I can't use it here. For this reason, I just picked ShadcnUI, which doesn't excites me.

I will update the styles for a less monochrome look and feel and move on to BaseUI soonish.

Linting and Formatting

I tried Biome for its excellent monorepo support, but I found it lacking. I have a very detailed typescript eslint config that I really enjoy, so I removed Biome and used Eslint & Prettier. I'll revisit it in the future.

Deployment

I'm using Bun. This means that some serverless providers who run their own JavaScript runtimes have failed me spectacularly, and I can't be bothered to debug the issues. A long-lived server from Fly.io works wonders for the Hono backend.

The dashboard is now under Netlify, but as I move on to the TanStack Start, I'll move it to Fly.io as well for better performance.

Next-up

I'm considering the following:

Footnotes

  1. I'm also planning to migrate this to BaseUI

  2. I'm planning to test Hono RPC

About

A Bun monorepo with TanStack Start and Hono

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages