stack88
Browse the documentation

Start

Project layout

Where each kind of code goes, and the rules that keep the layers apart.

Every workspace has a README describing its own layout. This page is the map; follow its links for the detail.

The workspace

apps/       one folder per deployable app: api, web, mobile, showcase
infra/      the Pulumi program
packages/   code more than one app uses, and the shared tool presets
tooling/    cli: the kit generators

Apps never import each other. Code moves into a package only when a second app needs it, and nothing specific to one app goes into a package.

Packages

schemas, i18n and utils depend on nothing else in the repository. contracts depends only on schemas, and table only on ui. The ui package is presentational: components take props and hold no state, data or URL logic, which belongs in a behaviour package such as table.

Apps consume each package’s built dist/, so a package change needs a rebuild. pnpm dev at the root watches them and rebuilds on save.

Inside an app

The API splits by responsibility:

src/api/<domain>/   one folder per domain: controller, service, module, specs
src/core/           framework concerns with no domain knowledge: auth, cache, mail, storage
src/lib/<vendor>/   one folder per third-party SDK
src/database/       the Drizzle schema, relations and migrator
src/config/         the validated environment and its config slices

A domain never imports another domain, a controller never touches the database, and only core/ talks to vendor SDKs.

The web and mobile apps are sliced by feature:

src/routes/                  URL structure only (web)
src/features/<domain>/       api, components, hooks, model, utils, queries
src/shared/                  UI and utilities more than one feature uses
src/lib/                     app-wide infrastructure: env, API client, i18n, query client

Features never import each other. lib/ never imports shared/ or features/, and shared/ never imports features/.

File names say what a file holds

Each file has one job, named by its suffix: user.schema.ts holds Zod schemas, user.constants.ts constants, user.types.ts types, user.utils.ts pure functions. React components and Astro pages take one file each, named in PascalCase.

user.constants.ts   UPPER_SNAKE_CASE values, `as const`
user.schema.ts      Zod schemas, with bounds from user.constants.ts
user.types.ts       types only, no runtime imports
user.utils.ts       pure, stateless helpers
users.service.ts    a Nest service
useSignIn.ts        one hook

Imports across folders go through an alias, $/* in web and the showcase and @/* in mobile, and never climb with ../.

Who enforces this

None of it relies on memory. oxlint checks the file roles and imports, and dependency-cruiser checks every boundary on this page, both as part of pnpm check. A file in the wrong place fails the gate with the rule it broke. The full rule set is in AGENTS.md, the guide written for contributors and coding agents.