No description
  • TypeScript 76.3%
  • Svelte 19.5%
  • JavaScript 2.9%
  • Shell 0.5%
  • Dockerfile 0.4%
  • Other 0.4%
Find a file
Bradley Shellnut 0faaea36fe
Some checks failed
CI / End-to-end tests (Chromium) (push) Has been cancelled
CI / API rate-limit tests (Redis) (push) Has been cancelled
CI / Unit tests (web + API) (push) Has been cancelled
CI / Type check (web + API + shared boundaries) (push) Has been cancelled
CI / Dependency audit (production) (push) Has been cancelled
CI / Lint (Biome) (push) Has been cancelled
CodeQL / CodeQL (javascript-typescript) (push) Has been cancelled
CodeQL / CodeQL (actions) (push) Has been cancelled
Merge pull request #314 from BradNut/development
Release: Preferred Language for mail and site, Password Account wording
2026-11-17 09:28:47 -08:00
.claude chore: install the official Svelte plugin for Claude Code (#42) 2026-10-10 13:46:30 -07:00
.devcontainer fix: secondary security hardening from the audit (#235) (#289) 2026-11-13 18:16:00 -08:00
.githooks fix: secondary security hardening from the audit (#235) (#289) 2026-11-13 18:16:00 -08:00
.github ci: dependency audit, CodeQL and required-check runbook (#234) 2026-11-15 03:24:26 -08:00
.knowledge-base Merge remote-tracking branch 'origin/development' into docs/202-preferred-language 2026-11-17 04:03:15 -08:00
.opencode style: format opencode config 2026-10-10 09:29:27 -07:00
.run Fixing the settings change email flow. 2025-01-05 22:27:41 -08:00
.storybook API guardrails: CI, lint and test checks from the #133 retro (#154) 2026-10-23 15:48:50 -07:00
.vscode API guardrails: CI, lint and test checks from the #133 retro (#154) 2026-10-23 15:48:50 -07:00
apps Merge remote-tracking branch 'origin/development' into docs/202-preferred-language 2026-11-17 04:03:15 -08:00
bruno-collection fix(api): stop reporting provider health on public healthz (#189) (#247) 2026-11-09 15:03:42 -08:00
docker/seaweedfs fix: use non-colliding local storage credentials so the leak scanner ignores ordinary responses (#37) 2026-10-10 08:26:14 -07:00
docs ci: dependency audit, CodeQL and required-check runbook (#234) 2026-11-15 03:24:26 -08:00
packages refactor(web): language picker on superforms with a shared DTO and named props (#202) 2026-11-17 04:01:04 -08:00
scripts chore: provide ENVIRONMENT=development to initialize and CI (#192) 2026-11-14 06:35:36 -08:00
.dockerignore chore: remove the .agents rules layer and its enforcement (#43) 2026-10-10 09:28:01 -07:00
.editorconfig Updating to TofuStack formatting of APIs with old version for starting the hono service. Getting scaffolding for signup with username/email set up. 2025-01-01 18:27:43 -08:00
.gitignore API guardrails: CI, lint and test checks from the #133 retro (#154) 2026-10-23 15:48:50 -07:00
.npmrc Initial commit 2024-12-31 22:43:09 +00:00
.nvmrc Web: re-authenticate when the session is not fresh (#113), bump better-auth, Node 24 (#117) 2026-10-17 21:32:08 -07:00
.worktreeinclude chore: make e2e self-checking and pnpm test unit-only (#135 retro) (#166) 2026-10-25 08:50:05 -07:00
AGENTS.md chore: #157 review follow-ups and root AGENTS.md token trim (#161) 2026-10-24 15:31:05 -07:00
biome.json API guardrails: CI, lint and test checks from the #133 retro (#154) 2026-10-23 15:48:50 -07:00
CLAUDE.md docs: prune AGENTS.md to progressive disclosure and symlink CLAUDE.md (#41) 2026-10-10 09:27:50 -07:00
docker-compose.yaml fix: secondary security hardening from the audit (#235) (#289) 2026-11-13 18:16:00 -08:00
ENV_SETUP.md docs: document the one Environment switch and the ENV migration (#192) 2026-11-14 06:36:50 -08:00
LICENSE Moving routes into public and protected pseudo-folders, adding initialization drizzle, fixing login controller and login page. 2025-01-02 17:51:39 -08:00
opencode.json style: format opencode config 2026-10-10 09:29:27 -07:00
package.json chore: provide ENVIRONMENT=development to initialize and CI (#192) 2026-11-14 06:35:36 -08:00
pnpm-lock.yaml ci: dependency audit, CodeQL and required-check runbook (#234) 2026-11-15 03:24:26 -08:00
pnpm-workspace.yaml ci: dependency audit, CodeQL and required-check runbook (#234) 2026-11-15 03:24:26 -08:00
README.md fix(api): keep the normal pool and gate only the db scripts on their flags (#193) (#248) 2026-11-09 14:55:02 -08:00
turbo.json fix(api): keep the normal pool and gate only the db scripts on their flags (#193) (#248) 2026-11-09 14:55:02 -08:00

AdelieStack

A scalable, testable, extensible starter template: a Hono API and a SvelteKit web app in a pnpm + Turbo monorepo, sharing typed contracts.

AdelieStack began as a fork of Rykuno's TofuStack and has since diverged: the backend is its own app, auth runs on Better Auth, and the generic (non-domain) layer was re-ported from a production app. Credit to the original for the architecture it grew from.

❔ What

SvelteKit is awesome, but sometimes you need more capability in the backend than SvelteKit's own server routes deliver.

To remedy this, the backend is a standalone Hono API (apps/api, port 3001 locally) with its own DI container, jobs, storage, and mail. The web app (apps/web, port 5173) forwards everything under /api/* to it through a catch-all proxy route, so the browser only ever talks to one origin and cookies stay first-party:

apps/web/src/routes/api/[...slug]/+server.ts -> API_PROXY_BASE_URL (default http://127.0.0.1:3001)

The web app calls the API through a typed Hono RPC client, whose types come from packages/api-contract.

Intention

AdelieStack is the generic layer that nearly every application needs, with the domain left out: auth, sessions, roles and permissions, MFA, email, file storage, observability, a UI kit, i18n, and tests. Clone it, delete the example pieces, and build your product on top.

It is deliberately not an "all batteries included" boilerplate. See How to Use.

Repo Layout

  • apps/api - Hono API (controllers, services, repositories, Drizzle schema, jobs).
  • apps/web - SvelteKit 3 app (Svelte 5 runes, Tailwind v4, Shadcn/UI).
  • packages/shared - client-safe constants, domain values, DTOs, validations.
  • packages/api-contract - Hono RPC types shared by both apps.
  • packages/test-utils - shared test helpers.
  • docs/adr - architecture decision records. .knowledge-base - API and web docs for contributors and agents.

Implementation Notes

  • Auth: Better Auth owns the core (email and password, cookie sessions, two-factor, passkeys, roles admin / support / user), mounted at /api/auth/*. Routes declare the permission they need, never a role name (ADR).
  • Sign-up is closed by default; set SIGN_UP_ENABLED=true to open it (ADR).
  • Captcha is optional and provider-agnostic, via Better Auth's captcha plugin (ADR).
  • Data: PostgreSQL via Drizzle, Redis for cache and rate limiting. Migrations are generated with Drizzle tooling, never hand-edited.
  • Storage: S3-compatible SeaweedFS buckets, with uploads scanned by ClamAV.
  • Mail: MAILER_TRANSPORT=mailpit posts to the local Mailpit inbox in development; unsend sends for real.
  • Observability: OpenTelemetry, Sentry, and Spotlight/Jaeger in development.
  • Env: each app declares its variables in .env.schema (ENV_SETUP.md).
  • Lazy infra: nothing connects to external services at import time.

Local Setup

  1. Make sure Docker is running
  2. Set up your env files — see ENV_SETUP.md (each app declares its own variables in apps/<app>/.env.schema with local defaults; you only need to generate the API secrets into apps/api/.env.local)
  3. pnpm install
  4. The database extension citext is being used to allow for case-insensitive string matching. To install the extension run CREATE EXTENSION IF NOT EXISTS citext; or add inside an additional drizzle SQL file for startup to use.
  5. pnpm initialize (this will start the docker-compose, provision the SeaweedFS storage buckets, and run the initial database migration and seed, setting DB_MIGRATING and DB_SEEDING for those two scripts only.) Re-run pnpm storage:setup any time to (idempotently) recreate the buckets, e.g. after wiping the seaweedfs_data volume.
  6. pnpm dev

No additional setup is required, zero api keys, zero services to signup for, zero cost.

How to Use

This is not supposed to serve as an all batteries included "production boilerplate" with 200 useless sponsored features that get in your way. Templates that do this are ANYTHING but "production" and "quick start".

This is stack is designed to be library agnostic. The philosophy here is to boostrap the concrete, repetitive, and time-consuming tasks that every application will need regardless of what you're building.

So - fork this repo, add your favorite libraries, and build out your own "more opinionated" personal template tailored to you!

Git Hooks

Plain git hooks in .githooks/ (no Husky). pnpm install runs prepare, which sets core.hooksPath.

  • pre-commit: Biome format + lint on staged files, plus the check:* guard scripts.
  • commit-msg: Conventional Commits subject (feat(web): ...).
  • pre-push: turbo check (type checks) for web and api.

Skip once with --no-verify. CI stays the source of truth.

Features

  • 🟢 Full E2E typesafety
  • 🟢 RPC Client for API Requests
  • 🟢 Custom Fetch Wrapper
  • 🟢 Deployment Template
  • 🟢 Authentication (Better Auth)
    • 🟢 Email and Password
    • 🟢 Passkeys
    • 🟢 Two-factor and recovery codes
    • 🟢 Roles and permissions
    • 🟢 Email Update / Verification
    • 🟢 Rate limiter
    • 🔴 OAuth
  • 🟢 File storage with virus scanning
  • 🟢 Audit log
  • 🟢 i18n (Paraglide)
  • 🟢 Observability (OpenTelemetry, Sentry)

Technologies

I'm mostly un-opinionated of what technology or libraries someone uses. Wanna uwu'ify your entire app? Go for it.

That being said, there are some libraries that embody my philosophies of building software more than others,

  • Better Auth: Owns the auth core: email and password, cookie sessions, roles (admin, support, user), two-factor, and passkeys. Its handler is mounted at /api/auth/*.
  • Drizzle - Drizzle advertises itself as an ORM, but I think its deceptive. It's a query builder with a migration client. Everytime I've used an ORM, I find myself fighting it for sometimes the simplest of use cases. Drizzle just gives you type-safety while querying SQL in a native fashion. Learn SQL, not ORMs.
  • Hono: Fast, lightweight, and built on web standards; meaning it can run anywhere you're SvelteKit app can. It's essentially a better, newer, and ironically more stable Express.JS. This provides us a perfect foundation to cleanly build on top of without having to teardown first. It has a zod adapter for validating DTO's which can be shared with the frontend too.
  • SvelteKit: After trying Vue, React, Next, and pretty much every frontend framework in the JS ecosystem, it's safe to say I vastly prefer Svelte and its priority of building on web standards.

Architecture

There are a few popular architectures for structuring backends. Technical, Onion, DDD, VSA, and the list goes on. I almost always choose to start with Technical and let the project naturally evolve into one of the others as complexity grows.

Backend Folder Structure

The API lives in apps/api/src/lib/server/api/, grouped by feature (auth, users, admin, audit, mail, storage, jobs, config) with shared pieces in common. Inside a feature, files are named by architectural role:

  • controllers - Responsible for routing requests.
  • services - Responsible for handling business logic.
  • repositories - Responsible for retrieving and storing data.
  • tables - Drizzle schema definitions.
  • middleware - Request middleware (session, permissions, rate limiting, logging, locale).
  • dtos - Shapes of data passed across boundaries, shared with the frontend via packages/shared.
  • common - Anything shared throughout the backend (configs, factories, i18n, utils).

File Naming

You might notice how each file in the backend is postfixed with its architectural type(e.g. iam.service.ts). This allows us to easily reorganize the folder structure to suite a different architecture pattern if the domain becomes more complex.

For example, if you want to group folders by domain(DDD), you simply drag and drop all related files to that folder.

└── events/
    ├── events.controller.ts
    ├── events.service.ts
    └── events.repository.ts

Testing

Testing probably isn't first and foremost when creating an app. That's fine. You should not be spending time writing tests if your app is mutable.

BUT, a good stack should be testable when the time to solidify a codebase arrives. Each feature keeps its tests in a sibling tests/ folder (see auth/tests/auth.service.test.ts for a service example).

  • pnpm test runs API and web unit tests (Vitest).
  • pnpm test:e2e runs Playwright.
  • pnpm check type-checks and enforces shared-code boundaries; pnpm lint / pnpm format run Biome.