Skip to content
Empire Builder KitDocumentation
v1 Documentation

Find your next step.

Search the complete documentation, including code examples.

    Full-text search↑ ↓ navigate Enter open
    Browse documentation
    DocsCore concepts

    Product Slices

    A Product Slice is the ownership and deployment boundary for one product. It is a single package of 32 files that holds the web app, the API handlers, the data layer and the infrastructure for that product.

    On this page
    1. Anatomy
    2. Shared code lives in packages
    3. Targets
    4. Choosing the boundary

    Anatomy

    DirectoryContents
    web/A Next.js App Router app: layout, home page, sign-in page, a page test and thin API routes.
    api/Lambda handlers: health.ts and protected.ts.
    data/DynamoDB-first persistence: key-value.ts, records.ts and persistence.json.
    contracts/The one entry point other projects may import.
    infra/The Slice’s infrastructure, written against shared builders.
    Root filespackage.json, project.json, sst.config.ts, TypeScript and Vitest configuration, the ownership record and a README.md.

    Slice files lists every file and says which ones are yours to edit.

    Shared code lives in packages

    A Slice stays small because it does not carry copies of platform code. The web auth routes delegate to @empire-builder-kit/runtime/auth-web. The infrastructure file calls the Slice builders in @empire-builder-kit/nx. When the framework fixes a bug in sign-in or in the infrastructure builders, you get the fix by updating a package version, not by merging generated files.

    Targets

    Every Slice has the same 12 targets: build, lint, typecheck, test, verify, dev, dev-cleanup, deploy, refresh, remove, unlock, foundation-preflight. The first five check your code. dev runs the Slice locally, and dev-cleanup removes the development task stack it used. The rest operate its deployment. See Targets.

    Choosing the boundary

    Create a Slice when a capability has its own data, its own interface and its own release rhythm. Keep closely related features in one Slice when splitting them would only add remote calls. The framework gives you the mechanism for a boundary; where the boundary goes is a product decision.

    A Slice can grow without becoming a second Slice. Add a Function, a Service or a Job inside it when a feature needs a different way of running. See Add a Function, Service or Job.