how to1 min readv1
Add a Product Slice
Add a Slice when you start a new product, or when a capability needs its own data and its own deployment.
On this page
Generate the Slice
bash
pnpm nx g @empire-builder-kit/nx:slice billingThe name becomes the package directory (packages/billing), the Nx project name and the path the Router serves the Slice at.
Make it yours
- Replace the home page in
web/src/app/page.tsxand update its test inpage.spec.tsx. - Replace the example records in
data/records.tswith your product’s data. - Add handlers beside
api/health.tsandapi/protected.ts. Useprotected.tsas the pattern for anything that needs a signed-in user. - Export the types other projects may rely on from
contracts/index.ts.
All four are seeded files, so they are yours to edit. Slice files shows which files are managed.
Verify
bash
pnpm nx run billing:verify
pnpm verifyThe first command checks the new Slice. The second checks the whole workspace before you commit.
Continue building