Fullstack dev server - BunDocumentation Index Search...⌘KInstall Bun Search...Navigation Development Server Fullstack dev serverRuntimePackage ManagerBundlerTest RunnerGuidesReferenceBlogFeedback:first-child]:!hidden peer-[.is-custom]:[&>:first-child]:sm:!hidden peer-[.is-custom]:[&>:first-child]:md:!hidden peer-[.is-custom]:[&>:first-child]:lg:!hidden peer-[.is-custom]:[&>:first-child]:xl:!hidden">CoreBundlerDevelopment ServerFullstack dev serverHot reloadingAsset ProcessingHTML & static sitesStandalone HTMLCSSLoadersSingle File ExecutableSingle-file executableExtensionsPluginsMacrosOptimizationBytecode CachingMinifierMigrationesbuild On this pageHTML RoutesHTML Imports as RoutesHTML Processing ExampleReact IntegrationDevelopment ModeDevelopment Mode FeaturesAdvanced Development ConfigurationDevelopment vs ProductionProduction ModeAhead of Time Bundling (Recommended)Runtime BundlingAPI RoutesHTTP Method HandlersDynamic RoutesRequest HandlingPluginsTailwindCSS PluginCustom PluginsInline Environment VariablesHow It WorksProcessing PipelineComplete ExampleBest PracticesProject StructureEnvironment-Based ConfigurationError HandlingAPI Response HelpersType SafetyDeploymentProduction BuildDocker DeploymentEnvironment VariablesMigration from Other FrameworksFrom Express + WebpackFrom Next.js API RoutesLimitations and Future PlansCurrent LimitationsPlanned FeaturesDevelopment ServerFullstack dev server Copy pagespan]:line-clamp-1 overflow-hidden group flex items-center py-0.5 gap-1 text-sm text-gray-950/50 dark:text-white/50 group-hover:text-gray-950/70 dark:group-hover:text-white/70 rounded-none rounded-r-xl border px-3 border-gray-200 aspect-square dark:border-white/[0.07] bg-background-light dark:bg-background-dark hover:bg-gray-600/5 dark:hover:bg-gray-200/5" aria-label="More actions" type="button" id="radix-_R_n4ctdbsnlht5lebsnpfdb_" aria-haspopup="menu" aria-expanded="false" data-state="closed"> *]:[overflow-wrap:anywhere]"> Copy pagespan]:line-clamp-1 overflow-hidden group flex items-center py-0.5 gap-1 text-sm text-gray-950/50 dark:text-white/50 group-hover:text-gray-950/70 dark:group-hover:text-white/70 rounded-none rounded-r-xl border px-3 border-gray-200 aspect-square dark:border-white/[0.07] bg-background-light dark:bg-background-dark hover:bg-gray-600/5 dark:hover:bg-gray-200/5" aria-label="More actions" type="button" id="radix-_R_1cctdbsnlht5lebsnpfdb_" aria-haspopup="menu" aria-expanded="false" data-state="closed"> To get started, import HTML files and pass them to the routes option in Bun.serve().
app.ts
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
Skip to main contentBun home pageBuild fullstack applications with Bun’s integrated dev server that bundles frontend assets and handles API routes
import { serve } from "bun";
import dashboard from "./dashboard.html";
import homepage from "./index.html";
const server = serve({
routes: {
// ** HTML imports **
// Bundle & route index.html to "/". This uses HTMLRewriter to scan
// the HTML for ` Fullstack dev server - Bun,AI智能索引,全网链接索引,智能导航,网页索引
- Build fullstack applications with Bun