In a typical TS monorepo, there are three ways of consuming the packages that you created:
Shipping out the TS source code directly in the exports field of the package.json file or using tsconfig paths.
Transpiling the TS code to JS using tsc and shipping the JS code in the exports field of the package alongside the .d.ts files.
Bundling the TS code using something like vite, tsup or rollup and shipping the bundled JS code in the exports field of the package alongside the .d.ts files.
Easy to maintain: You don’t have to worry about any build step, you just ship out the source code and let the consumer (like Next.js) handle the transpilation through transpilePackages option. Read docs here
Easy to use: You just edit the code. The types & code are immediately reflected on the consumer side, this is called “Live types”.
Slow TS LSP: Let’s imagine you have an api package that uses TS heavy libraries like tRPC, drizzle-orm add a bit of zod here and there. As your API grows more complex, the TS LSP (Language Server Protocol) will start taking hits. This is because TypeScript is so much faster at evaluating the .js and .d.ts combination than pure source .ts files.
It is not uncommon to see the TS LSP taking 1.5-3 seconds for every
autocompletion suggestion to come up, the same goes for error reporting. This
absolutely kills your productivity, and switching to building those packages
immediately fixes it.
In essence, if your consumer is referring to your package’s TS source files, there will be a ceiling to hit where the TS LSP will start slowing down.
Fast TS LSP: As mentioned above, TypeScript is so much faster at evaluating the .js and .d.ts combination than pure source .ts files.
Better for consumers: The consumer doesn’t have to worry about the transpilation step, it’s already done for them.
No loss of features: You are still able to get go to definition and other features in your editor through tsc outputting source & declaration map files.
Slower build step: Because bundling not only transpiles your code from TS to JS, but it also does many optimisations like tree-shaking, minification, etc. This makes the build step slower than just transpiling the code, even with tsup which is very fast we have seen pure tsc being much faster just because it avoids that bundling step.
Hard to get go to definition: It’s notoriously more difficult to get go to definition and other features in your editor with bundled code.
We intend to let the ui package be easily published to NPM, without putting any assumptions over the consumer and that it might be, this is why a bundling step was beneficial here.
The env package is only used internally to validate environment variables using t3-env, the TS LSP footprint is not a concern here and hence, we can ship out the source code directly.
All other packages are compiled with tsc because they are used internally and we want to keep the TS LSP footprint low, we can use a combination of the awesome turborepo filtering to minimise the dev watch processes running while development.
In short, tsc was the best of both worlds, we get the security of knowing that we will have a fast TS LSP even with a growing codebase, and we get all of the benefits of internal packages like go to definition, etc.To minimise the amount of processes running during dev we can do something like:
Evaluate the scope of the changes that we are making.
Filter to packages that we will be working on in the dev script, or reverse by ignoring the packages that we won’t be working on.
This looks something like this, if we were to be making api changes for example:
bun turbo dev --filter=@orbitkit/web... --filter=!./packages/config/* --filter=!@orbitkit/ui --only
It is true that this is a really long command, but we can make it shorter by adding it to the root package.json scripts like so:
This is why we have all the packages in the monorepo built in different ways. If you have any questions or feedback about this approach, feel free to open an issue on the repository or reach out to me on X/Twitter. Happy Monorepoing! 🚀
{"docsConfig":{"$schema":"https://mintlify.com/docs.json","theme":"mint","name":"OrbitKit","colors":{"primary":"#202020","light":"#EEEEEE","dark":"#202020"},"favicon":"/orbitkit-favicon.svg","logo":{"light":"https://mintcdn.com/orbitkit/Lo-LWErEeCv5ebB4/logo/orbitkit-light.svg?fit=max\u0026auto=format\u0026n=Lo-LWErEeCv5ebB4\u0026q=85\u0026s=24533bf11c417a7425e6e669430404b0","dark":"https://mintcdn.com/orbitkit/Lo-LWErEeCv5ebB4/logo/orbitkit-dark.svg?fit=max\u0026auto=format\u0026n=Lo-LWErEeCv5ebB4\u0026q=85\u0026s=4bbc78aa3e045f43f16b9e04e42560ea"},"background":{"decoration":null,"color":{"light":"#FCFCFC","dark":"#111111"}},"navbar":{"links":[],"primary":null},"footer":{"socials":{"twitter":"https://twitter.com/ixahmedxii","github":"https://github.com/ixahmedxi/orbitkit"}},"navigation":{"global":{"anchors":[{"anchor":"Github","href":"https://github.com/ixahmedxi/orbitkit","icon":"github"},{"anchor":"X / Twitter","href":"https://x.com/ixahmedxii","icon":"x-twitter"},{"anchor":"Become a sponsor","href":"https://github.com/sponsors/ixahmedxi","icon":"heart"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"orbitkit","hasAudioNarration":false,"actualSubdomain":"orbitkit","customDomains":["orbitkit.dev"],"gitSource":{"type":"github","owner":"ixahmedxi","repo":"orbitkit","deployBranch":"main","contentDirectory":"apps/docs","isPrivate":false,"mountPath":"","label":""},"entitlements":{},"buildId":"6ae91f9de285e7410aaeac72:success","clientVersion":"0.0.4076","searchFilterCounts":[{"language":"default","tag":"Documentation","count":5},{"language":"default","tag":"Get Started","count":3},{"language":"default","tag":"Decision Reasoning","count":1},{"language":"default","tag":"Technologies","count":1}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"comment-mode","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"decision-reasoning/why-all-built","slug":"/decision-reasoning/why-all-built","pageMetadata":{"title":"Built packages","icon":"toolbox","description":"If you noticed, all the packages in the monorepo (except the env one) are built using tsc or vite. Here is why.","href":"/decision-reasoning/why-all-built"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"If you noticed, all the packages in the monorepo (except the env one) are built using tsc or vite. Here is why.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`types-of-monorepo-packages`,children:`Types of Monorepo Packages`}),`\n`,_jsx(_components.p,{children:`In a typical TS monorepo, there are three ways of consuming the packages that you created:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Shipping out the TS source code directly in the `,_jsx(_components.code,{children:`exports`}),` field of the `,_jsx(_components.code,{children:`package.json`}),` file or using `,_jsx(_components.code,{children:`tsconfig`}),` paths.`]}),`\n`,_jsxs(_components.li,{children:[`Transpiling the TS code to JS using `,_jsx(_components.code,{children:`tsc`}),` and shipping the JS code in the `,_jsx(_components.code,{children:`exports`}),` field of the package alongside the `,_jsx(_components.code,{children:`.d.ts`}),` files.`]}),`\n`,_jsxs(_components.li,{children:[`Bundling the TS code using something like `,_jsx(_components.code,{children:`vite`}),`, `,_jsx(_components.code,{children:`tsup`}),` or `,_jsx(_components.code,{children:`rollup`}),` and shipping the bundled JS code in the `,_jsx(_components.code,{children:`exports`}),` field of the package alongside the `,_jsx(_components.code,{children:`.d.ts`}),` files.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`comparing-the-approaches`,children:`Comparing the approaches`}),`\n`,_jsx(_components.p,{children:`Let’s compare the three approaches to see which one is the best for our use case and why we chose the approach that we did.`}),`\n`,_jsx(Heading,{level:`3`,id:`shipping-out-the-ts-source-code-directly`,children:`Shipping out the TS source code directly`}),`\n`,_jsx(_components.p,{children:`Typically, a package using this approach would be called an “Internal package”.`}),`\n`,_jsx(Heading,{level:`4`,id:`advantages`,children:`Advantages`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Easy to maintain`}),`: You don’t have to worry about any build step, you just ship out the source code and let the consumer (like Next.js) handle the transpilation through `,_jsx(_components.code,{children:`transpilePackages`}),` option. `,_jsx(_components.a,{href:`https://nextjs.org/docs/app/api-reference/next-config-js/transpilePackages`,children:`Read docs here`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Easy to use`}),`: You just edit the code. The types \u0026 code are immediately reflected on the consumer side, this is called “Live types”.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`disadvantages`,children:`Disadvantages`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Slow TS LSP`}),`: Let’s imagine you have an `,_jsx(_components.code,{children:`api`}),` package that uses TS heavy libraries like `,_jsx(_components.code,{children:`tRPC`}),`, `,_jsx(_components.code,{children:`drizzle-orm`}),` add a bit of `,_jsx(_components.code,{children:`zod`}),` here and there. As your API grows more complex, the TS LSP (Language Server Protocol) will start taking hits. This is because TypeScript is so much faster at evaluating the `,_jsx(_components.code,{children:`.js`}),` and `,_jsx(_components.code,{children:`.d.ts`}),` combination than pure source `,_jsx(_components.code,{children:`.ts`}),` files.`]}),`\n`]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`It is not uncommon to see the TS LSP taking 1.5-3 seconds for every\nautocompletion suggestion to come up, the same goes for error reporting. This\nabsolutely kills your productivity, and switching to building those packages\nimmediately fixes it.`})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`In essence, if your consumer is referring to your package’s TS source files, there will be a ceiling to hit where the TS LSP will start slowing down.`})}),`\n`,_jsx(Heading,{level:`3`,id:`transpiling-the-ts-code-to-js`,children:`Transpiling the TS code to JS`}),`\n`,_jsx(_components.p,{children:`Typically, a package using this approach would be called a “Compiled Package”.`}),`\n`,_jsx(Heading,{level:`4`,id:`advantages-2`,children:`Advantages`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Fast TS LSP`}),`: As mentioned above, TypeScript is so much faster at evaluating the `,_jsx(_components.code,{children:`.js`}),` and `,_jsx(_components.code,{children:`.d.ts`}),` combination than pure source `,_jsx(_components.code,{children:`.ts`}),` files.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Better for consumers`}),`: The consumer doesn’t have to worry about the transpilation step, it’s already done for them.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`No loss of features`}),`: You are still able to get go to definition and other features in your editor through `,_jsx(_components.code,{children:`tsc`}),` outputting source \u0026 declaration map files.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`disadvantages-2`,children:`Disadvantages`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Build step`}),`: For the consumer to get any code updates that we did in the package, we have to run `,_jsx(_components.code,{children:`tsc`}),` on it.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`bundling-the-ts-code`,children:`Bundling the TS code`}),`\n`,_jsx(_components.p,{children:`Typically, a package using this approach would be called a “Publishable Package”.`}),`\n`,_jsx(Heading,{level:`4`,id:`advantages-3`,children:`Advantages`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Fast TS LSP`}),`: As mentioned above, TypeScript is so much faster at evaluating the `,_jsx(_components.code,{children:`.js`}),` and `,_jsx(_components.code,{children:`.d.ts`}),` combination than pure source `,_jsx(_components.code,{children:`.ts`}),` files.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Smaller bundle size`}),`: You can use tree-shaking and other optimizations to make the bundle size smaller.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Output to multiple formats`}),`: You can output to multiple formats like ESM and CJS, making it easily used in different environments.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`disadvantages-3`,children:`Disadvantages`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Slower build step`}),`: Because bundling not only transpiles your code from TS to JS, but it also does many optimisations like tree-shaking, minification, etc. This makes the build step slower than just transpiling the code, even with `,_jsx(_components.code,{children:`tsup`}),` which is very fast we have seen pure `,_jsx(_components.code,{children:`tsc`}),` being much faster just because it avoids that bundling step.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Hard to get go to definition`}),`: It’s notoriously more difficult to get go to definition and other features in your editor with bundled code.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`the-orbitkit-approach`,children:`The OrbitKit Approach`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ui package`}),` is bundled with `,_jsx(_components.code,{children:`vite`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`env package`}),` is shipped out as source code.`]}),`\n`,_jsxs(_components.li,{children:[`All other packages are compiled with `,_jsx(_components.code,{children:`tsc`}),`.`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`This is because:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`We intend to let the `,_jsx(_components.code,{children:`ui`}),` package be easily published to NPM, without putting any assumptions over the consumer and that it might be, this is why a bundling step was beneficial here.`]}),`\n`,_jsxs(_components.li,{children:[`The `,_jsx(_components.code,{children:`env`}),` package is only used internally to validate environment variables using `,_jsx(_components.code,{children:`t3-env`}),`, the TS LSP footprint is not a concern here and hence, we can ship out the source code directly.`]}),`\n`,_jsxs(_components.li,{children:[`All other packages are compiled with `,_jsx(_components.code,{children:`tsc`}),` because they are used internally and we want to keep the TS LSP footprint low, we can use a combination of the awesome turborepo filtering to minimise the `,_jsx(_components.code,{children:`dev`}),` watch processes running while development.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`In short, `,_jsx(_components.code,{children:`tsc`}),` was the best of both worlds, we get the security of knowing that we will have a fast TS LSP even with a growing codebase, and we get all of the benefits of internal packages like go to definition, etc.`]}),`\n`,_jsx(_components.p,{children:`To minimise the amount of processes running during dev we can do something like:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Evaluate the scope of the changes that we are making.`}),`\n`,_jsxs(_components.li,{children:[`Filter to packages that we will be working on in the `,_jsx(_components.code,{children:`dev`}),` script, or reverse by ignoring the packages that we won’t be working on.`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`This looks something like this, if we were to be making api changes for example:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`bun`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` turbo`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` dev`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --filter=@orbitkit/web...`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --filter=!./packages/config/`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --filter=!@orbitkit/ui`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --only`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`It is true that this is a really long command, but we can make it shorter by adding it to the root `,_jsx(_components.code,{children:`package.json`}),` scripts like so:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"scripts\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"dev:web:api\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"bun turbo dev --filter=@orbitkit/web... --filter=!./packages/config/* --filter=!@orbitkit/ui --only\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Or something along those lines, these are just examples, and it’s preferred for you to make these scripts according to your needs.`}),`\n`,_jsx(Heading,{level:`2`,id:`conclusion`,children:`Conclusion`}),`\n`,_jsx(_components.p,{children:`This is why we have all the packages in the monorepo built in different ways. If you have any questions or feedback about this approach, feel free to open an issue on the repository or reach out to me on X/Twitter. Happy Monorepoing! 🚀`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Built packages","icon":"toolbox","description":"If you noticed, all the packages in the monorepo (except the env one) are built using tsc or vite. Here is why.","href":"/decision-reasoning/why-all-built"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Types of Monorepo Packages","slug":"types-of-monorepo-packages","depth":2,"children":[]},{"title":"Comparing the approaches","slug":"comparing-the-approaches","depth":2,"children":[{"title":"Shipping out the TS source code directly","slug":"shipping-out-the-ts-source-code-directly","depth":3,"children":[]},{"title":"Advantages","slug":"advantages","depth":4,"children":[]},{"title":"Disadvantages","slug":"disadvantages","depth":4,"children":[]},{"title":"Transpiling the TS code to JS","slug":"transpiling-the-ts-code-to-js","depth":3,"children":[]},{"title":"Advantages","slug":"advantages-2","depth":4,"children":[]},{"title":"Disadvantages","slug":"disadvantages-2","depth":4,"children":[]},{"title":"Bundling the TS code","slug":"bundling-the-ts-code","depth":3,"children":[]},{"title":"Advantages","slug":"advantages-3","depth":4,"children":[]},{"title":"Disadvantages","slug":"disadvantages-3","depth":4,"children":[]}]},{"title":"The OrbitKit Approach","slug":"the-orbitkit-approach","depth":2,"children":[]},{"title":"Conclusion","slug":"conclusion","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"orbitkit","siteName":"OrbitKit","title":"Built packages - OrbitKit","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-01-07T01:47:18.360Z","originalFileLocation":"decision-reasoning/why-all-built.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"If you noticed, all the packages in the monorepo (except the env one) are built using tsc or vite. Here is why.\">\u003cmeta data-mint-head name=\"application-name\" content=\"OrbitKit\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/orbitkit/dJdz1BJe-O982YSa/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/orbitkit/dJdz1BJe-O982YSa/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/orbitkit/dJdz1BJe-O982YSa/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/orbitkit/dJdz1BJe-O982YSa/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/orbitkit/dJdz1BJe-O982YSa/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/orbitkit/dJdz1BJe-O982YSa/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/orbitkit/dJdz1BJe-O982YSa/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/orbitkit/dJdz1BJe-O982YSa/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/orbitkit/dJdz1BJe-O982YSa/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Built packages - OrbitKit\">\u003cmeta data-mint-head property=\"og:description\" content=\"If you noticed, all the packages in the monorepo (except the env one) are built using tsc or vite. Here is why.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"OrbitKit\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://orbitkit.dev/decision-reasoning/why-all-built\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://orbitkit.mintlify.site/_mintlify/api/og/v2?division=Decision+Reasoning\u0026amp;title=Built+packages\u0026amp;description=If+you+noticed%2C+all+the+packages+in+the+monorepo+%28except+the+env+one%29+are+built+using+tsc+or+vite.+Here+is+why.\u0026amp;theme=7e48647f1b278bc1f56411b7\u0026amp;signature=6befcd72919085b373d87d3538febe5f3e3c9a1f04ec0b535f931a789e24fb8f\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Built packages - OrbitKit\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"If you noticed, all the packages in the monorepo (except the env one) are built using tsc or vite. Here is why.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://orbitkit.mintlify.site/_mintlify/api/og/v2?division=Decision+Reasoning\u0026amp;title=Built+packages\u0026amp;description=If+you+noticed%2C+all+the+packages+in+the+monorepo+%28except+the+env+one%29+are+built+using+tsc+or+vite.+Here+is+why.\u0026amp;theme=7e48647f1b278bc1f56411b7\u0026amp;signature=6befcd72919085b373d87d3538febe5f3e3c9a1f04ec0b535f931a789e24fb8f\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/orbitkit/dJdz1BJe-O982YSa/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"OrbitKit\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#202020\">\u003clink data-mint-head rel=\"canonical\" href=\"https://orbitkit.dev/decision-reasoning/why-all-built\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/decision-reasoning/why-all-built.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://orbitkit.dev/#organization\",\"name\":\"OrbitKit\",\"url\":\"https://orbitkit.dev\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/orbitkit/Lo-LWErEeCv5ebB4/logo/orbitkit-light.svg?fit=max\u0026auto=format\u0026n=Lo-LWErEeCv5ebB4\u0026q=85\u0026s=24533bf11c417a7425e6e669430404b0\"}},{\"@type\":\"WebSite\",\"@id\":\"https://orbitkit.dev#website\",\"name\":\"OrbitKit\",\"url\":\"https://orbitkit.dev\",\"publisher\":{\"@id\":\"https://orbitkit.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://orbitkit.dev/decision-reasoning/why-all-built#webpage\",\"url\":\"https://orbitkit.dev/decision-reasoning/why-all-built\",\"name\":\"Built packages\",\"description\":\"If you noticed, all the packages in the monorepo (except the env one) are built using tsc or vite. Here is why.\",\"dateModified\":\"2026-01-07T01:47:18.360Z\",\"isPartOf\":{\"@id\":\"https://orbitkit.dev#website\"},\"breadcrumb\":{\"@id\":\"https://orbitkit.dev/decision-reasoning/why-all-built#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://orbitkit.dev/decision-reasoning/why-all-built#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"OrbitKit\",\"item\":\"https://orbitkit.dev\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Built packages\",\"item\":\"https://orbitkit.dev/decision-reasoning/why-all-built\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://orbitkit.dev/decision-reasoning/why-all-built#article\",\"headline\":\"Built packages\",\"name\":\"Built packages\",\"description\":\"If you noticed, all the packages in the monorepo (except the env one) are built using tsc or vite. Here is why.\",\"url\":\"https://orbitkit.dev/decision-reasoning/why-all-built\",\"mainEntityOfPage\":{\"@id\":\"https://orbitkit.dev/decision-reasoning/why-all-built#webpage\"},\"dateModified\":\"2026-01-07T01:47:18.360Z\",\"publisher\":{\"@id\":\"https://orbitkit.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://orbitkit.dev#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"OrbitKit\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"OrbitKit","nav":{"global":{"anchors":[{"anchor":"Github","href":"https://github.com/ixahmedxi/orbitkit","icon":"github"},{"anchor":"X / Twitter","href":"https://x.com/ixahmedxii","icon":"x-twitter"},{"anchor":"Become a sponsor","href":"https://github.com/sponsors/ixahmedxi","icon":"heart"}]},"anchors":[{"anchor":"Documentation","icon":"book-open","groups":[{"group":"Get Started","pages":[{"title":"Introduction","icon":"door-open","href":"/introduction"},{"title":"Installation","icon":"bars-progress","href":"/installation"},{"title":"Commands","icon":"code","description":"A guide on the available commands in the project, what they do and how to use them.","href":"/commands"}]},{"group":"Decision Reasoning","pages":[{"title":"Built packages","icon":"toolbox","href":"/decision-reasoning/why-all-built"}]},{"group":"Technologies","pages":[{"title":"Playwright","icon":"vials","description":"A guide on how playwright is setup and used in the monorepo.","href":"/technologies/playwright"}]}]}]},"basePath":"","title":"Built packages - OrbitKit","buildId":"dpl_8LJbrAiZvr1K98WQNZXCyY5AvT34","deploymentId":"dpl_8LJbrAiZvr1K98WQNZXCyY5AvT34","dynamics":[],"chunks":[]}