Framework uses Uvicorn and serves the app in the root path i.e. /. If you need to use another ASGI-compatible server or fine-tune Uvicorn, you can easily do so.
You can tune your server by adding a server_setup.py file to the root
of your application, next to the main.py files.This file is executed before starting writer. It allows you to configure authentication,
add your own routes and middlewares on FastAPI.
# server_setup.pyimport typingimport writer.serveif typing.TYPE_CHECKING: from fastapi import FastAPI# Returns the FastAPI application associated with the writer server.asgi_app: FastAPI = writer.serve.app@asgi_app.get("/probes/healthcheck")def hello(): return "1"
server_setup.py is disabled by default on edit mode. If you want to use in edit mode, you can launch writer edit --enable-server-setup <app>.
You can import writer.serve and use the function get_asgi_app. This returns an ASGI app created by FastAPI, which you can choose how to serve.The following code can serve as a starting point. You can save this code as serve.py and run it with python serve.py.
import uvicornimport writer.serveapp_path = "." # . for current working directorymode = "run" # run or editasgi_app = writer.serve.get_asgi_app(app_path, mode)uvicorn.run(asgi_app, host="0.0.0.0", port=5328, log_level="warning", ws_max_size=writer.serve.MAX_WEBSOCKET_MESSAGE_SIZE)
Note the inclusion of the imported ws_max_size setting. This is important for normal functioning of the framework when dealing with bigger files.Fine-tuning Uvicorn allows you to set up SSL, configure proxy headers, etc, which can prove vital in complex deployments.If you want to disable server setup hook, you should use enable_server_setup:
Framework is built using relative paths, so it can be served from any path. This allows multiple apps to be simultaneously served on different paths.The example below uses the get_asgi_app function to obtain two separate Framework apps, which are then mounted on different paths, /app1 and /app2, of a FastAPI app.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Writer AI Studio","colors":{"primary":"#BFCBFF","light":"#6985FF","dark":"#5551ff"},"logo":{"light":"https://mintcdn.com/writer/YZ72OUP7BQyK8p2G/logo/writer_logo_light.svg?fit=max\u0026auto=format\u0026n=YZ72OUP7BQyK8p2G\u0026q=85\u0026s=c9a784871f9b98724bb1eae947e745ed","dark":"https://mintcdn.com/writer/YZ72OUP7BQyK8p2G/logo/writer_logo_dark.svg?fit=max\u0026auto=format\u0026n=YZ72OUP7BQyK8p2G\u0026q=85\u0026s=9e22a34b91e20df881d68634a0042c1d"},"favicon":"https://mintcdn.com/writer/z-qGRP1BKyHYhEJN/images/icons/favicon.svg?fit=max\u0026auto=format\u0026n=z-qGRP1BKyHYhEJN\u0026q=85\u0026s=33356fdc372b2640b92c5546da07c9e0","api":{"playground":{"display":"interactive"},"examples":{"languages":["curl","python","javascript"]}},"navbar":{"primary":{"type":"button","label":"Sign in","href":"https://app.writer.com/login"}},"footer":{"socials":{"x":"https://x.com/Get_Writer","github":"https://github.com/writer","linkedin":"https://www.linkedin.com/company/getwriter"}},"seo":{"metatags":{"description":"Writer AI Studio developer documentation - Build AI agents with APIs, SDKs, Agent Builder, and no-code tools. Integrate generative AI into your applications.","og:site_name":"Writer AI Studio Documentation","og:type":"website","twitter:card":"summary_large_image","twitter:site":"@Get_Writer"},"indexing":"all"},"integrations":{"gtm":{"tagId":"GTM-NXVXDK"},"segment":{"key":"o2ZzfP0pJxH4cihXBPrF4IlbGqmG34BA"}},"contextual":{"options":["copy","view","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"writer","hasAudioNarration":false,"actualSubdomain":"writer","customDomains":["dev.writer.com"],"gitSource":{"type":"github","owner":"writercolab","repo":"writer-monorepo","deployBranch":"main","contentDirectory":"docs-official","isPrivate":true,"mountPath":"","label":"","_id":"6aebb4e79904d1b9b86455b1"},"feedback":{"thumbs":true,"issues":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6af20b5e5d60f235810c339a","clientVersion":"0.0.4094","searchFilterCounts":[{"language":"default","tag":"Home","count":98},{"language":"default","tag":"Writer Framework","count":71},{"language":"default","tag":"Component reference","count":45},{"language":"default","tag":"API Reference","count":32},{"language":"default","tag":"Connect to your data","count":31},{"language":"default","tag":"Available prebuilt connectors","count":27},{"language":"default","tag":"Content","count":17},{"language":"default","tag":"Legacy API Reference","count":16},{"language":"default","tag":"Getting started","count":14},{"language":"default","tag":"Input","count":13}]},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"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":[{"filePath":"styles.css","content":"/* devanagari */\n@font-face {\n font-family: 'Poppins';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/poppins/v24/pxiByp8kv8JHgFVrLGT9Z11lFc-K.woff2) format('woff2');\n unicode-range: U+0900-097F, U+1CD0-1CF4, U+1CF7-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF, U+11B00-11B0A;\n}\n/* latin-ext */\n@font-face {\n font-family: 'Poppins';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/poppins/v24/pxiByp8kv8JHgFVrLGT9Z1JlFc-K.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'Poppins';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/poppins/v24/pxiByp8kv8JHgFVrLGT9Z1xlFQ.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n/* devanagari */\n@font-face {\n font-family: 'Poppins';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/poppins/v24/pxiByp8kv8JHgFVrLEj6Z11lFc-K.woff2) format('woff2');\n unicode-range: U+0900-097F, U+1CD0-1CF4, U+1CF7-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF, U+11B00-11B0A;\n}\n/* latin-ext */\n@font-face {\n font-family: 'Poppins';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/poppins/v24/pxiByp8kv8JHgFVrLEj6Z1JlFc-K.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'Poppins';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/poppins/v24/pxiByp8kv8JHgFVrLEj6Z1xlFQ.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n:root{--purple-1: #5551FF;--purple-2: #4A46DA;--black: #000;--gray-1: #333}body{font-family:\"Graphik\", sans-serif;font-weight:400}body.bold{font-weight:600}h1{font-family:\"Poppins\", sans-serif;font-weight:600!important}h2,h3{font-family:\"Poppins\", sans-serif;font-weight:500}img[src$=\"quickstart\"]{border:1px solid #e4e7ed}img[src$=\"no-code\"]{border:1px solid #e4e7ed}img[src$=\"auth\"]{min-width:25%;width:35%;margin:auto}img[src$=\"auth-table\"]{min-width:25px;width:25px}img[src$=\"framework\"]{border:1px solid #e4e7ed}.imageBorder{border:1px solid #e4e7ed}.flex-none.min-w-full.text-sm.overflow-x-auto{background-color:#171b1a}.no-bullet li{list-style-type:none;font-size:small}.large-icon{width:60px;height:100%}.bg-primary\\/10{background-color:#bfcbff}.text-primary{color:black}.dark .prompts{color:#828282;font-family:'Roboto Mono', monospace}.prompts{color:black;font-family:'Roboto Mono', monospace}.papers{font-family:'Roboto Mono', monospace;font-size:small;padding-left:20px;padding-right:20px;text-align:justify}th,td{padding:10px 10px 10px 10px;text-align:left}.update table th,.update table td{word-break:break-word}.expandedImageContainer{padding:16px;border-radius:16px;background:#E9EEF1;overflow:hidden;display:flex;justify-content:center}.expandedImageContainerInner{display:flex;align-items:flex-start;max-width:300px;max-height:210px}.expandedImageContainer img{max-height:210px}.card{> div {\n > div {\n width: unset;\n height: unset;\n }\n }}.components__table{table-layout:fixed;width:300px}.button-wrapper{margin-top:30px}.button{border:none;cursor:pointer;font-size:14px;font-weight:600;padding:8px 20px;position:relative;outline:none;transition:background-color 0.1s ease-in}.primary-button{background-color:var(--purple-1);border-radius:40px;color:white;display:inline-flex;align-items:center;\u0026:hover{background-color:var(--purple-2)}}.secondary-button{background-color:var(--black);border-radius:30px;color:white;\u0026:hover{background-color:var(--gray-1)}}.button--arrow{padding-right:40px;\u0026::after{content:'';display:inline-block;width:12px;height:12px;background-image:url('data:image/svg+xml;utf8,\u003csvg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\">\u003cpath id=\"Vector\" d=\"M9.47019 6.56246H0.375V5.4375H9.47019L5.19808 1.16537L5.99998 0.375L11.625 5.99998L5.99998 11.625L5.19808 10.8346L9.47019 6.56246Z\" fill=\"white\"/>\u003c/svg>');background-size:contain;background-repeat:no-repeat;position:absolute;right:16px;top:50%;transform:translateY(-50%)}}.componentFields td,.componentFields th{padding:8px;border:1px solid rgb(var(--gray-200))}.componentFields .desc{width:50ch}:is(.dark .componentFields td,.dark .componentFields th,.dark .blueprintFields td,.dark .blueprintFields th){border:1px solid rgb(var(--gray-800))}.blueprintFields td,.blueprintFields th{padding:8px;border:1px solid rgb(var(--gray-200));vertical-align:top}#topbar-cta-button{margin:0}#topbar-cta-button a{display:inline-flex;align-items:center;background-color:var(--purple-1)!important;border-radius:9999px;padding:4px 14px;font-weight:600;font-size:14px;text-decoration:none;transition:background-color 0.2s ease;line-height:24px}#topbar-cta-button a span{color:white!important}#topbar-cta-button a:hover{background-color:var(--purple-2)!important}#topbar-cta-button svg{margin-left:4px;height:16px;width:16px}#topbar-cta-button svg path{stroke:white!important;fill:none!important;stroke-width:1.5!important;stroke-linecap:round!important}li[id=\"https://app.writer.com/login\"]{margin:0;max-width:100%;box-sizing:border-box}li[id=\"https://app.writer.com/login\"] a{display:inline-flex!important;align-items:center!important;background-color:var(--purple-1)!important;border-radius:9999px!important;padding:4px 8px 4px 14px!important;font-weight:600!important;font-size:14px!important;text-decoration:none!important;transition:background-color 0.2s ease!important;line-height:24px!important;max-width:100%!important;box-sizing:border-box!important;white-space:nowrap!important;overflow:hidden!important}li[id=\"https://app.writer.com/login\"] a div,li[id=\"https://app.writer.com/login\"] a span{color:white!important}li[id=\"https://app.writer.com/login\"] a:hover{background-color:var(--purple-2)!important}li[id=\"https://app.writer.com/login\"] svg{margin-left:0px!important;height:16px!important;width:16px!important}li[id=\"https://app.writer.com/login\"] svg path{stroke:white!important;stroke-width:1.5!important;stroke-linecap:round!important;fill:none!important}div[id=\"sidebar\"]{overflow-x:hidden;box-sizing:border-box}div[id=\"sidebar-content\"]{overflow-x:hidden;box-sizing:border-box}ul[class*=\"bg-zinc-950/5\"]{max-width:100%;box-sizing:border-box;overflow-x:hidden}#content-area.max-w-5xl{max-width:80rem}#content-area.max-w-xl{max-width:60rem!important}img.max-height-800{max-height:800px!important}img.max-width-80{max-width:80%!important}#navbar .nav-tabs{flex:1 1 auto!important;width:100%!important;justify-content:center!important}"}],"page":{"pagePath":"framework/custom-server","slug":"/framework/custom-server","pageMetadata":{"title":"Custom server","description":null,"href":"/framework/custom-server","hidden":true},"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`,p:`p`,pre:`pre`,span:`span`,..._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:[_jsxs(_components.p,{children:[`Framework uses Uvicorn and serves the app in the root path i.e. `,_jsx(_components.code,{children:`/`}),`. If you need to use another ASGI-compatible server or fine-tune Uvicorn, you can easily do so.`]}),`\n`,_jsx(Heading,{level:`2`,id:`configure-webserver`,children:`Configure webserver`}),`\n`,_jsxs(_components.p,{children:[`You can tune your server by adding a `,_jsx(_components.code,{children:`server_setup.py`}),` file to the root\nof your application, next to the `,_jsx(_components.code,{children:`main.py`}),` files.`]}),`\n`,_jsxs(_components.p,{children:[`This file is executed before starting writer. It allows you to configure `,_jsx(_components.a,{href:`/framework/authentication`,children:`authentication`}),`,\nadd your own routes and middlewares on FastAPI.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`14`,language:`python`,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:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`14`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# server_setup.py`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` typing`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` writer.serve`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` typing.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`TYPE_CHECKING`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` fastapi `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` FastAPI`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Returns the FastAPI application associated with the writer server.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`asgi_app: FastAPI `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` writer.serve.app`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`@asgi_app.get`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"/probes/healthcheck\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` hello`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`():`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"1\"`})]}),`\n`]})})}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`server_setup.py`}),` is disabled by default on edit mode. If you want to use in `,_jsx(_components.code,{children:`edit`}),` mode, you can launch `,_jsx(_components.code,{children:`writer edit --enable-server-setup \u003capp>`}),`.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`implement-custom-server`,children:`Implement custom server`}),`\n`,_jsxs(_components.p,{children:[`You can import `,_jsx(_components.code,{children:`writer.serve`}),` and use the function `,_jsx(_components.code,{children:`get_asgi_app`}),`. This returns an ASGI app created by FastAPI, which you can choose how to serve.`]}),`\n`,_jsxs(_components.p,{children:[`The following code can serve as a starting point. You can save this code as `,_jsx(_components.code,{children:`serve.py`}),` and run it with `,_jsx(_components.code,{children:`python serve.py`}),`.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`13`,language:`python`,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:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`13`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` uvicorn`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` writer.serve`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`app_path `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \".\"`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # . for current working directory`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`mode `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"run\"`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # run or edit`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`asgi_app `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` writer.serve.get_asgi_app(app_path, mode)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`uvicorn.run(asgi_app,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` host`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0.0.0.0\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` port`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5328`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` log_level`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"warning\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` ws_max_size`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`writer.serve.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`MAX_WEBSOCKET_MESSAGE_SIZE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Note the inclusion of the imported `,_jsx(_components.code,{children:`ws_max_size`}),` setting. This is important for normal functioning of the framework when dealing with bigger files.`]}),`\n`,_jsx(_components.p,{children:`Fine-tuning Uvicorn allows you to set up SSL, configure proxy headers, etc, which can prove vital in complex deployments.`}),`\n`,_jsxs(_components.p,{children:[`If you want to disable server setup hook, you should use `,_jsx(_components.code,{children:`enable_server_setup`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`python`,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:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`asgi_app `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` writer.serve.get_asgi_app(app_path, mode, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`enable_server_setup`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`False`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`multiple-apps-at-once`,children:`Multiple apps at once`}),`\n`,_jsx(_components.p,{children:`Framework is built using relative paths, so it can be served from any path. This allows multiple apps to be simultaneously served on different paths.`}),`\n`,_jsxs(_components.p,{children:[`The example below uses the `,_jsx(_components.code,{children:`get_asgi_app`}),` function to obtain two separate Framework apps, which are then mounted on different paths, `,_jsx(_components.code,{children:`/app1`}),` and `,_jsx(_components.code,{children:`/app2`}),`, of a FastAPI app.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`22`,language:`python`,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:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`22`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` uvicorn`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` writer.serve`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` fastapi `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` FastAPI, Response`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`root_asgi_app `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` FastAPI(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`lifespan`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`writer.serve.lifespan)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`sub_asgi_app_1 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` writer.serve.get_asgi_app(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"../app1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"run\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`sub_asgi_app_2 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` writer.serve.get_asgi_app(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"../app2\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"run\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`root_asgi_app.mount(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"/app1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, sub_asgi_app_1)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`root_asgi_app.mount(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"/app2\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, sub_asgi_app_2)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`@root_asgi_app.get`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"/\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` init`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`():`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Response(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"\"\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \u003ch1>Welcome to the App Hub\u003c/h1>`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`uvicorn.run(root_asgi_app,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` host`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0.0.0.0\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` port`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5328`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` log_level`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"warning\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` ws_max_size`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`writer.serve.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`MAX_WEBSOCKET_MESSAGE_SIZE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})})]})}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":"Custom server","description":null,"href":"/framework/custom-server","hidden":true}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Configure webserver","slug":"configure-webserver","depth":2,"children":[]},{"title":"Implement custom server","slug":"implement-custom-server","depth":2,"children":[]},{"title":"Multiple apps at once","slug":"multiple-apps-at-once","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"writer","siteName":"Writer AI Studio","title":"Custom server - Writer AI Studio","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-04T22:43:07.029Z","originalFileLocation":"framework/custom-server.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=\"Writer AI Studio developer documentation - Build AI agents with APIs, SDKs, Agent Builder, and no-code tools. Integrate generative AI into your applications.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Writer AI Studio\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_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/writer/rBMYB50U__7D_mBT/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_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/writer/rBMYB50U__7D_mBT/_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/writer/rBMYB50U__7D_mBT/_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/writer/rBMYB50U__7D_mBT/_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/writer/rBMYB50U__7D_mBT/_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/writer/rBMYB50U__7D_mBT/_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/writer/rBMYB50U__7D_mBT/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Custom server - Writer AI Studio\">\u003cmeta data-mint-head property=\"og:description\" content=\"Writer AI Studio developer documentation - Build AI agents with APIs, SDKs, Agent Builder, and no-code tools. Integrate generative AI into your applications.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Writer AI Studio Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://dev.writer.com/framework/custom-server\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://writer.mintlify.site/_mintlify/api/og/v2?division=Advanced\u0026amp;title=Custom+server\u0026amp;theme=42614b5f169f207d5a1f89aa\u0026amp;signature=73573796cdaa521a703947039cc399cdc363b8c8d3740a8ee79444e57d348bcc\">\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=\"Custom server - Writer AI Studio\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Writer AI Studio developer documentation - Build AI agents with APIs, SDKs, Agent Builder, and no-code tools. Integrate generative AI into your applications.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://writer.mintlify.site/_mintlify/api/og/v2?division=Advanced\u0026amp;title=Custom+server\u0026amp;theme=42614b5f169f207d5a1f89aa\u0026amp;signature=73573796cdaa521a703947039cc399cdc363b8c8d3740a8ee79444e57d348bcc\">\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/writer/rBMYB50U__7D_mBT/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Writer AI Studio\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#BFCBFF\">\u003clink data-mint-head rel=\"canonical\" href=\"https://dev.writer.com/framework/custom-server\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/framework/custom-server.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://dev.writer.com/#organization\",\"name\":\"Writer AI Studio\",\"url\":\"https://dev.writer.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/writer/YZ72OUP7BQyK8p2G/logo/writer_logo_light.svg?fit=max\u0026auto=format\u0026n=YZ72OUP7BQyK8p2G\u0026q=85\u0026s=c9a784871f9b98724bb1eae947e745ed\"}},{\"@type\":\"WebSite\",\"@id\":\"https://dev.writer.com#website\",\"name\":\"Writer AI Studio\",\"url\":\"https://dev.writer.com\",\"publisher\":{\"@id\":\"https://dev.writer.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://dev.writer.com/framework/custom-server#webpage\",\"url\":\"https://dev.writer.com/framework/custom-server\",\"name\":\"Custom server\",\"dateModified\":\"2026-11-04T22:43:07.029Z\",\"isPartOf\":{\"@id\":\"https://dev.writer.com#website\"},\"breadcrumb\":{\"@id\":\"https://dev.writer.com/framework/custom-server#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://dev.writer.com/framework/custom-server#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Advanced\",\"item\":\"https://dev.writer.com/framework/authentication\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Custom server\",\"item\":\"https://dev.writer.com/framework/custom-server\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://dev.writer.com/framework/custom-server#article\",\"headline\":\"Custom server\",\"name\":\"Custom server\",\"url\":\"https://dev.writer.com/framework/custom-server\",\"mainEntityOfPage\":{\"@id\":\"https://dev.writer.com/framework/custom-server#webpage\"},\"dateModified\":\"2026-11-04T22:43:07.029Z\",\"publisher\":{\"@id\":\"https://dev.writer.com/#organization\"},\"isPartOf\":{\"@id\":\"https://dev.writer.com#website\"}}]}\u003c/script>","siteName":"Writer AI Studio","nav":{"global":null,"tabs":[{"tab":"Home","icon":"house","pages":[{"title":"Home","href":"/home/introduction"}]},{"tab":"Writer Framework","icon":"shapes","hidden":true,"groups":[{"group":"Getting started","pages":[{"title":"Writer Framework","sidebarTitle":"Introduction","description":null,"href":"/framework/introduction"},{"title":"Quickstart","description":null,"href":"/framework/quickstart"},{"title":"Writer AI module","description":null,"href":"/framework/ai-module"},{"title":"Sample app library","mode":"wide","description":null,"href":"/framework/sample-apps"}]},{"group":"Guides","pages":[{"title":"Application state","description":null,"href":"/framework/application-state"},{"title":"Backend-initiated actions","description":null,"href":"/framework/backend-initiated-actions"},{"title":"Builder basics","description":null,"href":"/framework/builder-basics"},{"title":"Dataframe","description":null,"href":"/framework/dataframe"},{"title":"Event handlers","description":null,"href":"/framework/event-handlers"},{"title":"Handling inputs","description":null,"href":"/framework/handling-inputs"},{"title":"Repeater","description":null,"href":"/framework/repeater"}]},{"group":"Tutorials","pages":[{"title":"Social post generator","description":null,"href":"/framework/social-post-generator"},{"title":"Chat assistant","description":null,"href":"/framework/chat-assistant"},{"title":"Product description generator","description":null,"href":"/framework/product-description-generator"},{"title":"Release notes generator","description":null,"href":"/framework/release-notes-generator"}]},{"group":"Advanced","pages":[{"title":"Authentication","description":null,"href":"/framework/authentication"},{"title":"SEO and social sharing","mode":"wide","description":null,"href":"/framework/seo"},{"title":"Backend-driven UI","description":null,"href":"/framework/backend-driven-ui"},{"title":"Custom components","description":null,"href":"/framework/custom-components"},{"title":"Custom server","href":"/framework/custom-server"},{"title":"Frontend scripts","description":null,"href":"/framework/frontend-scripts"},{"title":"Page routes","description":null,"href":"/framework/page-routes"},{"title":"Sessions","description":null,"href":"/framework/sessions"},{"title":"State schema","description":null,"href":"/framework/state-schema"},{"title":"Stylesheets","description":null,"href":"/framework/stylesheets"},{"title":"Testing","description":null,"href":"/framework/testing"}]},{"group":"Component reference","pages":[{"group":"Layout","pages":[{"title":"Column","description":null,"href":"/components/column"},{"title":"Column Container","description":null,"href":"/components/columns"},{"title":"Horizontal Stack","description":null,"href":"/components/horizontalstack"},{"title":"Section","description":null,"href":"/components/section"},{"title":"Separator","description":null,"href":"/components/separator"},{"title":"Sidebar","description":null,"href":"/components/sidebar"},{"title":"Step","description":null,"href":"/components/step"},{"title":"Step Container","description":null,"href":"/components/steps"},{"title":"Tab","description":null,"href":"/components/tab"},{"title":"Tab Container","description":null,"href":"/components/tabs"}]},{"group":"Content","pages":[{"title":"Annotated Text","description":null,"href":"/components/annotatedtext"},{"title":"Chatbot","description":null,"href":"/components/chatbot"},{"title":"DataFrame","description":null,"href":"/components/dataframe"},{"title":"Heading","description":null,"href":"/components/heading"},{"title":"Image","description":null,"href":"/components/image"},{"title":"JSON Viewer","description":null,"href":"/components/jsonviewer"},{"title":"Link","description":null,"href":"/components/link"},{"title":"Message","description":null,"href":"/components/message"},{"title":"Metric","description":null,"href":"/components/metric"},{"title":"Plotly Graph","description":null,"href":"/components/plotlygraph"},{"title":"Progress Bar","description":null,"href":"/components/progressbar"},{"title":"Tags","description":null,"href":"/components/tags"},{"title":"Text","description":null,"href":"/components/text"},{"title":"Video Player","description":null,"href":"/components/videoplayer"}]},{"group":"Input","pages":[{"title":"Checkbox Input","description":null,"href":"/components/checkboxinput"},{"title":"Date Input","description":null,"href":"/components/dateinput"},{"title":"File Input","description":null,"href":"/components/fileinput"},{"title":"Number Input","description":null,"href":"/components/numberinput"},{"title":"Radio Input","description":null,"href":"/components/radioinput"},{"title":"Slider Range Input","description":null,"href":"/components/rangeinput"},{"title":"Rating Input","description":null,"href":"/components/ratinginput"},{"title":"Select Input","description":null,"href":"/components/selectinput"},{"title":"Slider Input","description":null,"href":"/components/sliderinput"},{"title":"Switch Input","description":null,"href":"/components/switchinput"},{"title":"Text area Input","description":null,"href":"/components/textareainput"},{"title":"Text Input","description":null,"href":"/components/textinput"},{"title":"Time Input","description":null,"href":"/components/timeinput"}]},{"group":"Other","pages":[{"title":"Button","description":null,"href":"/components/button"},{"title":"HTML Element","description":null,"href":"/components/html"},{"title":"Pagination","description":null,"href":"/components/pagination"},{"title":"Repeater","description":null,"href":"/components/repeater"},{"title":"Reuse Component","description":null,"href":"/components/reuse"},{"title":"Timer","description":null,"href":"/components/timer"}]},{"group":"Embed","pages":[{"title":"PDF","description":null,"href":"/components/pdf"},{"title":"IFrame","description":null,"href":"/components/iframe"}]}]}]},{"tab":"API Reference","icon":"key","pages":[{"title":"API Reference","href":"/api-reference/api-keys"}]},{"tab":"Legacy API Reference","hidden":true,"pages":[{"title":"Legacy API Reference","href":"/api-reference-legacy/billing/get-your-organization-subscription-details"}]}]},"basePath":"","title":"Custom server - Writer AI Studio","buildId":"dpl_42LwxxU1kGN114H4XzwGYXa9ZDah","deploymentId":"dpl_42LwxxU1kGN114H4XzwGYXa9ZDah","dynamics":[],"chunks":[]}