Merge branch 'main' of https://gitlab.com/jottocraft/yggdrasil
diff --git a/demo/src/DemoAPI.ts b/demo/src/DemoAPI.ts
index 3c7c567..9ba1d70 100644
--- a/demo/src/DemoAPI.ts
+++ b/demo/src/DemoAPI.ts
@@ -1,20 +1,25 @@
 // Yggdrasil
 // Copyright (c) jottocraft 2024
 
-import { YggdrasilConduitAPI } from "@jottocraft/yggdrasil";
-
 // This file contains the Typescript definition for the Demo
-// Conduit API. This file could be shared to allow other projects
-// to call this API with type safety.
+// Conduit API.
 
-export type DemoAPI = {
+type DemoApiCtx = {
+    /** The second argument defines common context parameters passed to all Conduit API calls. */
+    name: string;
+};
+
+/** Defines the API used between the conduit client and server. Export this object from a package for cross-project type safety! */
+export type DemoApi = {
     client: {
         /** The first argument to YggdrasilConduitAPI defines your API functions available to the client. */
         hello: (time: "morning" | "evening" | "afternoon" | "night") => Promise<string>;
         goodbye: () => Promise<string>;
     };
-    context: {
-        /** The second argument defines common context parameters passed to all Conduit API calls. */
-        name: string;
-    };
+    apiCtx: DemoApiCtx;
+};
+
+/** Extends DemoApi with a server-side context. Useful for including extra common processing, or non-serializable utilities that depend on apiCtx. */
+export type DemoApiServerTypes = DemoApi & {
+    conduitCtx: DemoApiCtx;
 };
\ No newline at end of file
diff --git a/demo/src/api/goodbye.ts b/demo/src/api/goodbye.ts
index 3b3cb6f..fc19d92 100644
--- a/demo/src/api/goodbye.ts
+++ b/demo/src/api/goodbye.ts
@@ -1,10 +1,10 @@
 // Yggdrasil
 // Copyright (c) jottocraft 2024. All rights reserved.
 
-import { DemoServer } from "../server";
+import { defineDemoApi } from "../server";
 
-export const goodbye = DemoServer.defineAPI().goodbye(async (ygg) => {
+export const goodbye = defineDemoApi().goodbye(async (ygg) => {
     ygg.upstreamHeaders.set["X-Test-Header"] = "X-Test-Value";
-    if (!ygg.apiCtx.name) throw ygg.status(400, "BAD_REQUEST", "Missing required name parameter!");
-    return "Goodbye " + ygg.apiCtx.name + "!";
+    if (!ygg.conduitCtx.name) throw ygg.status(400, "BAD_REQUEST", "Missing required name parameter!");
+    return "Goodbye " + ygg.conduitCtx.name + "!";
 });
\ No newline at end of file
diff --git a/demo/src/api/hello.ts b/demo/src/api/hello.ts
index 1969727..34f0a7a 100644
--- a/demo/src/api/hello.ts
+++ b/demo/src/api/hello.ts
@@ -1,8 +1,8 @@
 // Yggdrasil
 // Copyright (c) jottocraft 2024. All rights reserved.
 
-import { DemoServer } from "../server";
+import { defineDemoApi } from "../server";
 
-export const hello = DemoServer.defineAPI().hello(async (ygg, time) => {
-    return "Good " + time + " " + ygg.apiCtx.name + "!";
+export const hello = defineDemoApi().hello(async (ygg, time) => {
+    return "Good " + time + " " + ygg.conduitCtx.name + "!";
 });
\ No newline at end of file
diff --git a/demo/src/index.ts b/demo/src/index.ts
index 0d3935b..567790c 100644
--- a/demo/src/index.ts
+++ b/demo/src/index.ts
@@ -1,15 +1,18 @@
 // Yggdrasil
 // Copyright (c) jottocraft 2024
 
-import { YggdrasilConduitServer, YggdrasilServerContext, YggdrasilRouter, YggdrasilStatus, createConduitServerSideClient } from "@jottocraft/yggdrasil";
+import { YggdrasilConduitServer, YggdrasilServerContext, YggdrasilRouter, YggdrasilServerStatus, createConduitServerSideClient } from "@jottocraft/yggdrasil";
 
-import { DemoServer } from "./server";
+import { DemoAppTypes, DemoServer } from "./server";
 import * as routes from "./routes";
 import * as api from "./api";
-import { DemoAPI } from "./DemoAPI";
+import { DemoApi, DemoApiServerTypes } from "./DemoApi";
 
-const DemoRouter = new YggdrasilRouter(DemoServer, routes);
-const DemoConduitServer = new YggdrasilConduitServer(DemoServer, api);
+const DemoRouter = new YggdrasilRouter<DemoAppTypes>(DemoServer, routes);
+const DemoConduitServer = new YggdrasilConduitServer<DemoAppTypes, DemoApiServerTypes>(DemoServer, api, {
+    conduitBasePath: "/demo/conduit/",
+    prepareConduitCtx: async (ygg, apiCtx) => apiCtx
+});
 
 export default {
     async fetch(request: Request, env: DemoEnv, ctx: ExecutionContext): Promise<Response> {
@@ -19,13 +22,13 @@
             try {
                 return await DemoConduitServer.handleRequest(ygg);
             } catch (e) {
-                if (!(e instanceof YggdrasilStatus) || (e.status !== 404)) throw e;
+                if (!(e instanceof YggdrasilServerStatus) || (e.status !== 404)) throw e;
             }
 
             try {
                 return await DemoRouter.handleRequest(ygg);
             } catch (e) {
-                if (!(e instanceof YggdrasilStatus) || (e.status !== 404)) throw e;
+                if (!(e instanceof YggdrasilServerStatus) || (e.status !== 404)) throw e;
             }
 
             throw ygg.status(404, "INVALID_PATH", "Nobody was able to handle your request :(");
@@ -33,12 +36,11 @@
             ctx: {
                 env,
                 ctx,
-                conduit: createConduitServerSideClient<DemoAPI>({ name: "jottocraft" }, { baseURL: "https://yggdrasil.ns.jottocraft.com/demo/conduit/", fetcher: (input: RequestInfo | URL, init?: RequestInit) => this.fetch(new Request(input, init), env, ctx), allowHeaderManipulation: true })
+                conduit: createConduitServerSideClient<DemoApi>({ name: "jottocraft" }, { baseURL: "https://yggdrasil.ns.jottocraft.com/demo/conduit/", fetcher: (input: RequestInfo | URL, init?: RequestInit) => this.fetch(new Request(input, init), env, ctx), allowHeaderManipulation: true })
             }
         }, {
             debug: true,
             baseURL: "https://yggdrasil.ns.jottocraft.com/demo",
-            conduitBasePath: "/demo/conduit/",
             normalization: {
                 trailingSlash: false,
                 lowercase: true,
diff --git a/demo/src/routes/abc.ts b/demo/src/routes/abc.ts
index a7e9bd1..4bd8eb8 100644
--- a/demo/src/routes/abc.ts
+++ b/demo/src/routes/abc.ts
@@ -1,8 +1,8 @@
 // Yggdrasil
 // Copyright (c) jottocraft 2024
 
-import { DemoServer } from "../server";
+import { defineDemoRoute } from "../server";
 
-export const abc = DemoServer.defineRoute("GET", "/abc", async (ygg) => {
+export const abc = defineDemoRoute("GET", "/abc", async (ygg) => {
     return new Response("aardvark", { status: 200 });
 });
\ No newline at end of file
diff --git a/demo/src/routes/def.ts b/demo/src/routes/def.ts
index c8417cc..a93655c 100644
--- a/demo/src/routes/def.ts
+++ b/demo/src/routes/def.ts
@@ -1,10 +1,8 @@
 // Yggdrasil
 // Copyright (c) jottocraft 2024
 
-import { YggdrasilStatus } from "@jottocraft/yggdrasil";
+import { defineDemoRoute } from "../server";
 
-import { DemoServer } from "../server";
-
-export const def = DemoServer.defineRoute("GET", "/def", async (ygg) => {
+export const def = defineDemoRoute("GET", "/def", async (ygg) => {
     throw ygg.status(400, "INVALID_REQUEST", "Invalid request.");
 });
\ No newline at end of file
diff --git a/demo/src/routes/goodbye.ts b/demo/src/routes/goodbye.ts
index 1faa1e9..99a9c25 100644
--- a/demo/src/routes/goodbye.ts
+++ b/demo/src/routes/goodbye.ts
@@ -1,9 +1,9 @@
 // Yggdrasil
 // Copyright (c) jottocraft 2024
 
-import { DemoServer } from "../server";
+import { defineDemoRoute } from "../server";
 
-export const goodbye = DemoServer.defineRoute("GET", "/goodbye", async (ygg) => {
+export const goodbye = defineDemoRoute("GET", "/goodbye", async (ygg) => {
     const goodbyeMessage = await ygg.ctx.conduit().goodbye();
     return new Response(goodbyeMessage, { status: 200 });
 });
\ No newline at end of file
diff --git a/demo/src/routes/hij.ts b/demo/src/routes/hij.ts
index 900cdb6..0498150 100644
--- a/demo/src/routes/hij.ts
+++ b/demo/src/routes/hij.ts
@@ -1,8 +1,8 @@
 // Yggdrasil
 // Copyright (c) jottocraft 2024
 
-import { DemoServer } from "../server";
+import { defineDemoRoute } from "../server";
 
-export const hij = DemoServer.defineRoute("GET", "/hij/$message", async (ygg) => {
+export const hij = defineDemoRoute("GET", "/hij/$message", async (ygg) => {
     return new Response("Message: " + ygg.params.message, { status: 200 });
 });
\ No newline at end of file
diff --git a/demo/src/routes/memo.ts b/demo/src/routes/memo.ts
index d15dbce..ee9e7c5 100644
--- a/demo/src/routes/memo.ts
+++ b/demo/src/routes/memo.ts
@@ -1,14 +1,14 @@
 // Yggdrasil
 // Copyright (c) jottocraft 2024
 
-import { DemoServer } from "../server";
+import { defineDemoRoute } from "../server";
 
 async function multiplyNumbers() {
     console.log("Multiplying numbers...");
     return 34 * 45;
 }
 
-export const memo = DemoServer.defineRoute("GET", "/memo", async (ygg) => {
+export const memo = defineDemoRoute("GET", "/memo", async (ygg) => {
     // Do the same thing a bunch of times to test memoization.
     const data = await Promise.all([
         ygg.memoize("multiplyNumbers", multiplyNumbers),
diff --git a/demo/src/routes/spacer.ts b/demo/src/routes/spacer.ts
index b6aab06..a750240 100644
--- a/demo/src/routes/spacer.ts
+++ b/demo/src/routes/spacer.ts
@@ -2,9 +2,9 @@
 // Copyright (c) jottocraft 2024
 
 import { YggdrasilSpacer } from "@jottocraft/yggdrasil";
-import { DemoServer } from "../server";
+import { defineDemoRoute } from "../server";
 
-export const spacer = DemoServer.defineRoute("GET", "/spacer", async (ygg) => {
+export const spacer = defineDemoRoute("GET", "/spacer", async (ygg) => {
     const spacer = new YggdrasilSpacer(1000);
 
     const tasks = [];
diff --git a/demo/src/server.ts b/demo/src/server.ts
index 4d174f9..88cf937 100644
--- a/demo/src/server.ts
+++ b/demo/src/server.ts
@@ -4,14 +4,26 @@
 // This file contains the key Server and Blueprint objects
 // that other files use to configure and run Yggdrasil Server.
 
-import { YggdrasilConduitAPIClient, YggdrasilServer } from "@jottocraft/yggdrasil";
+// IMPORTANT: To properly setup consistent type safety in your project, you should
+// define your YggdrasilAppTypes, YggdrasilConduitApi, and YggdrasilConduitServerApiTypes
+// type definitions somewhere they can be shared between files, and explicitly include them when using
+// defineApi(), defineRoute(), new YggdrasilServer(), new YggdrasilConduitServer(), and new YggdrasilRouter().
+// TypeScript can infer some of these relationships, but not all, and the errors you'll see will be extremely
+// confusing if you don't do this.
 
-import { DemoAPI } from "./DemoAPI";
+import { defineApi, defineRoute, YggdrasilConduitApiClient, YggdrasilServer } from "@jottocraft/yggdrasil";
 
-export const DemoServer = new YggdrasilServer<{
+import { DemoApi, DemoApiServerTypes } from "./DemoApi";
+
+export type DemoAppTypes = {
     ctx: {
         env: DemoEnv;
         ctx: ExecutionContext;
-        conduit: YggdrasilConduitAPIClient<DemoAPI>;    
+        conduit: YggdrasilConduitApiClient<DemoApi>;
     }
-}, DemoAPI>();
\ No newline at end of file
+};
+
+export const DemoServer = new YggdrasilServer<DemoAppTypes>();
+
+export const defineDemoApi = defineApi<DemoAppTypes, DemoApiServerTypes>;
+export const defineDemoRoute = defineRoute<DemoAppTypes>;
\ No newline at end of file
diff --git a/docs/docs/features/conduit.md b/docs/docs/features/conduit.md
index ba0a76c..d6c169c 100644
--- a/docs/docs/features/conduit.md
+++ b/docs/docs/features/conduit.md
@@ -49,9 +49,10 @@
   At runtime, the client constructs functions dynamically, so nothing stops it from making invalid requests.
   For example, TypeScript would stop you from calling `client.this.path.does.not.exist()`,
   but this would work at runtime for any arbitrary path (this example makes a request to `/this/path/does/not/exist`).
-- The Conduit server client must be called from a Yggdrasil context. This means that you must include it as
-  a top-level function in your ctx, and call it via ygg.ctx.\<the name of your conduit client\>().
-  Please refer to the "Context" documentation for more information.
+- The Yggdrasil Conduit server-side client must be bound to a Yggdrasil context. The intention is for Conduit clients to
+  be top-level functions in your `ctx` or `conduitCtx`, and called via ygg.ctx.\<the name of your conduit client\>(). If 
+  you need to create and use a Yggdrasil Conduit server-side client outside of `ygg.ctx`, please use `.bind(ygg)`, being
+  careful to follow the rules described in the "Context" documentation.
 
 ## Implementation
 
@@ -62,15 +63,15 @@
 involve putting it in an NPM package, git submodule, etc.
 
 ```ts title="my-shared-library/conduit.ts"
-// This defines the type of your Conduit API.
-export type MyAPI = {
+// This defines the public types of your Conduit API.
+export type MyApi = {
   /** The client object defines your API functions available to the client. */
   client: {
     hello: (time: "morning" | "evening" | "afternoon" | "night") => Promise<string>;
     goodbye: () => Promise<string>;
   };
-  /** The context object defines common context parameters passed to all Conduit API calls. */
-  context: {
+  /** The apiCtx object defines common context parameters clients include in all Conduit API calls. */
+  apiCtx: {
     name: string;
   };
 };
@@ -82,12 +83,22 @@
 };
 ```
 
-### Add your API type to YggdrasilServer
+### Create your typed defineApi function
 
 ```ts title="src/server.ts"
-// Adding MyAPI here lets YggdrasilServer know what to expect so it
-// can throw an error if you forget to implement a function.
-export const DemoServer = new YggdrasilServer<AppType, MyAPI>();
+import { defineApi } from "@jottocraft/yggdrasil";
+
+// You should create your YggdrasilServer somewhere here.
+
+// This extends your API definition to include private server types.
+export type MyApiServer = MyApi & {
+  /** The conduitCtx object defines common context parameters passed to all of your server's Conduit API implementations. **/
+  conduitCtx: {
+    name: string;
+  };
+};
+
+export const defineMyApi = defineApi<AppTypes, MyApiServer>;
 ```
 
 ### Implement your API
@@ -100,9 +111,9 @@
 the ability to add headers to the upstream request.
 
 ```ts title="src/api/hello.ts"
-import { DemoServer } from "../server";
+import { defineMyApi } from "../server";
 
-export const hello = DemoServer.defineAPI().hello(async (ygg, time) => {
+export const hello = defineMyApi().hello(async (ygg, time) => {
   // Adds a sample header to the upstream request. If a web server is calling
   // this API, this header will be sent not on the API response, but on the final
   // web server's response given to the user.
@@ -122,15 +133,23 @@
 
 ### Handle requests
 
-Once you have your API handlers defined, simply call YggdrasilConduitServer.handleRequest
-to serve your API:
+Once you have your API handlers defined, simply call YggdrasilConduitServer.handleRequest to serve your API:
 
 ```ts title="src/index.ts"
+import { MyApiServer } from "./server";
 import * as api from "./api";
 
 // This should ideally be defined outside your request handler
-const DemoConduitServer = new YggdrasilConduitServer(DemoServer, api);
-
+const DemoConduitServer = new YggdrasilConduitServer<AppTypes, MyApiServer>(DemoServer, api, {
+    // The base path tells the conduit server where to listen for incoming API calls.
+    conduitBasePath: "/conduit/",
+    // You must have a function that maps between apiCtx and conduitCtx.
+    // This can perform input sanitization, or do some other lookups/transformations
+    // to flesh out your server-side context. Please note that this runs before
+    // your YggdrasilConduitContext is created, so you can't set upstream headers
+    // from within this function.
+    prepareConduitCtx: async (ygg, apiCtx) => apiCtx
+});
 // Additional required setup omitted for brevity
 
 // Inside DemoServer.handleRequest:
@@ -144,12 +163,12 @@
 To call a Conduit API from another Yggdrasil Server instance,
 call `createConduitClientSideClient()` to create a client.
 
-The client **must** be stored and called as a top-level method in
-your app's context so that the request's context can be bound to it.
+The client **must** be bound to your `ygg` context, ideally
+included in your YggdrasilServer `ctx` for automatic binding.
 See the "Context" documentation for more details.
 
 ```ts title="src/index.ts"
-import { MyAPI } from "my-shared-library/conduit.ts";
+import { MyApi } from "my-shared-library/conduit.ts";
 import { createConduitServerSideClient } from "@jottocraft/yggdrasil";
 
 AnotherDemoServer.handleRequest(request, async (ygg) => {
@@ -160,8 +179,8 @@
 }, {
   // All Conduit clients MUST be defined here (as top-level methods).
   // They can be named whatever you want.
-  conduit: createConduitServerSideClient<MyAPI>({
-    // Common context about this request to send to MyAPI
+  conduit: createConduitServerSideClient<MyApi>({
+    // Common context about this request to send to MyApi
     name: "jottocraft" 
   }, { 
     // Options (baseURL is required)
@@ -181,18 +200,13 @@
 Conduit API from this client, `upstreamHeaders` from the API will
 be discarded, and you'll need to handle errors yourself.
 
-When an error occurs, a `YggdrasilClientStatus` object will
-be thrown. `YggdrasilClientStatus` is nearly identical to
-its server counterpart (`YggdrasilStatus`), but without an
-associated server context.
-
 ```ts title="src/index.ts"
-import { MyAPI } from "my-shared-library/conduit.ts";
+import { MyApi } from "my-shared-library/conduit.ts";
 import { createConduitClientSideClient } from "@jottocraft/yggdrasil";
 
 async function fetchConduitData() {
-  const conduit = createConduitClientSideClient<MyAPI>({
-    // Common context about this request to send to MyAPI
+  const conduit = createConduitClientSideClient<MyApi>({
+    // Common context about this request to send to MyApi
     name: "jottocraft" 
   }, { 
     // Options (baseURL is required)
diff --git a/docs/docs/features/context.md b/docs/docs/features/context.md
index 245695e..ddfc9a5 100644
--- a/docs/docs/features/context.md
+++ b/docs/docs/features/context.md
@@ -14,37 +14,71 @@
 This extended version uses prototype-based inheritance so that methods implemented in
 the original object continue to run there.
 
-To make it so that you don't have to pass `ygg` into every function you call, and to
-ensure the correct context (base/extended) is being referenced, built-in functions
-that live in the `ygg` context object uses the `this` keyword to access the context.
-Additionally, functions that you add as top-level members to your app's context object
-will be appropriately bound so that they can access the context through `this` (the
-Conduit server client requires this).
+## Context-bound functions
 
-Please observe the following practices to avoid inadvertently breaking Yggdrasil Server's context:
+For your convenience, built-in functions that live in the `ygg` context object
+are bound to the `ygg` object so they can access the context with the `this` keyword
+instead of requiring an explicit parameter. Since accessing the active `ygg` context
+is a common need, Yggdrasil Server automatically binds all top-level functions in
+your app's `ctx` and `conduitCtx` (for Yggdrasil Server Conduit) to `ygg`.
+
+Here's a brief example showing how this can help simplify your app:
+
+```ts title="Setting headers with a global function"
+export function setDarkTheme(ygg: YggdrasilServerContext<AppTypes>) {
+    ygg.additionalHeaders.append.push(["Set-Cookie", "use-dark-theme=1"]);
+}
+```
+
+```ts title="Setting headers with a function defined in ctx"
+// This only works when accessing the method through ygg.ctx.setDarkTheme()
+const ctx = {
+    setDarkTheme(this: YggdrasilServerContext<AppTypes>) {
+        this.additionalHeaders.append.push(["Set-Cookie", "use-dark-theme=1"]);
+    }
+}
+```
+
+### Important side effects of binding
+
+The important side effects of this convention are:
+
+- Anything you access through the `ygg` context should not be stored or accessed
+through a separate variable. Always access members (including nested members) of
+the `ygg` context from `ygg` (you might be able to do this for your own `ctx` or
+`conduitCtx` through, depending on your implementation).
+- Never call `ygg` member functions with `.bind()`, `.apply()`, or anything else
+that would re-bind the member functions you're calling.
+- If you include a function bound to something else in your app's `ctx` or
+`conduitCtx` contexts, they will be re-bound to `ygg` on access, so you must either
+re-bind them every time you access them, or include those functions inside an object
+in your app's `ctx` or `conduitCtx` to avoid re-binding.
 
 ## Accessing context
 
-Always use the `ygg` variable passed to you, if provided to you by Yggdrasil Server.
-While you can and should pass the `ygg` variable to your own helper functions, you
-should not use the base context object from a Conduit handler, for example (the Conduit
-context provided by Yggdrasil Server should be used instead). Additionally, do not
-store the `ygg` variable outside or beyond the scope of a request.
+The `ygg` context is only provided to you through functions you implement (e.g. the
+callback of `handleRequest`). Only use the `ygg` context within the function it was
+passed to or any other functions invoked as part of its execution. Do not store or
+use the `ygg` context outside of that scope. Because the `ygg` context is
+request-specific, you should never store or pass the `ygg` context through
+global variables, or you will risk leaking data between requests.
 
-## Calling context-based functions
+In some cases, you may be able to access multiple `ygg` contexts simultaneously:
 
-Always access context functions and members directly through the context object.
-Do not store them in another variable, or the `this` context will be broken.
-For example, do `throw ygg.status(400, "NOT_FOUND")` instead of 
-`const status = ygg.status; throw status(400, "NOT_FOUND");`. Furthermore,
-do not use `.bind`, `.apply`, or anything else that changes the `this` context.
+```ts title="Dealing with multiple ygg objects"
+DemoServer.handleRequest(request, async (ygg) => {
+    const RequestSpecificConduitServer = new YggdrasilConduitServer<AppTypes, ApiTypes>(FlowServer, {
+        async greeter(ygg: YggdrasilConduitContext<AppTypes, ApiTypes>, name: string) {
+            return new Response("Hello " + name + "!", { status: 200 });
+        }
+    });
 
-## Using your own context-based functions
+    return RequestSpecificConduitServer.handleRequest(ygg);
+} /* ... */ );
+```
 
-Any top-level member functions present in your app context will be automatically
-bound to the appropriate context, so you can use `this` inside them to access
-the context without requiring a separate `ygg` parameter.
-Please note that this strategy is intended only
-for accessing whatever context is available. If you specifically need a Conduit
-context, for example, it is recommended to use an explicit `ygg` parameter to
-enforce that.
\ No newline at end of file
+You should always use the `ygg` context nearest to your implementation. In this
+example, it would be incorrect to use the `ygg` context from `DemoServer.handleRequest`
+in the `greeter` function, which should use the `ygg` context passed directly to it.
+Any functions invoked as part of the `greeter` functions's execution must also use
+the `ygg` context passed to `greeter`. Otherwise, data loss may occur.
\ No newline at end of file
diff --git a/docs/docs/features/errors.md b/docs/docs/features/errors.md
index cc0a519..793bb45 100644
--- a/docs/docs/features/errors.md
+++ b/docs/docs/features/errors.md
@@ -4,32 +4,64 @@
 
 # Error handling
 
-Yggdrasil Server has a built-in error handling mechanism. To use it, simply throw
-a `YggdrasilStatus` object from inside a request handler:
+Yggdrasil Server has a built-in error handling mechanism to generate status
+pages when something goes wrong. To use it, throw a `YggdrasilServerStatus`
+object anywhere in your request handler:
 
 ```ts
-throw new YggdrasilStatus(404, "INVALID_ROUTE", "The page you're trying to load doesn't exist.");
+if (route === undefined) throw new YggdrasilServerStatus(ygg, 404, "INVALID_ROUTE", "The page you're trying to load doesn't exist.");
 ```
 
-For your convenience, Yggdrasil Server also provides an assert function that throws
-a `YggdrasilStatus` for you upon failure:
+For your convenience, Yggdrasil Server also provides a `ygg.status` function that
+creates a `YggdrasilServerStatus` with the context pre-set, and an assert function
+that throws a `YggdrasilServerStatus` for you upon failure:
 
 ```ts
-ygg.assert(user.isAuthenticated, 401, "AUTH_REQUIRED", "You need to be signed in to load this page.");
+if (route === undefined) throw ygg.status(404, "INVALID_ROUTE", "The page you're trying to load doesn't exist.");
+// or
+ygg.assert(route !== undefined, 404, "INVALID_ROUTE", "The page you're trying to load doesn't exist.");
 ```
 
-## YggdrasilStatus parameters
+## YggdrasilStatus and server context
 
-The `YggdrasilStatus` constructor and `ygg.assert` function share a common set of parameters.
-Those parameters are:
+Yggdrasil Server also provides a `YggdrasilStatus` object that is functionally
+the same as `YggdrasilServerStatus`. However, `YggdrasilServerStatus` keeps
+a reference to the `ygg` context at the time of the error, while `YggdrasilStatus`
+does not have an associated `ygg` context. `YggdrasilStatus` is therefore
+primarily designed for handling `YggdrasilServerStatus` exceptions outside
+of Yggdrasil Server, like exceptions from a client-side Yggdrasil Server Conduit
+client.
 
-1. [The HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) to return.
-   The name of the status code should match the nature of the error.    
-2. A custom status code (something like "AUTH_REQUIRED"). This should be a brief error ID
-   that should allow you to identify where the error was thrown from in your code, and also
+The `ygg` context included with `YggdrasilServerStatus` is useful for getting
+helpful values for debugging out from the context when the error is caught.
+For example, if an `YggdrasilServerStatus` is thrown in a Yggdrasil Server Conduit
+handler, the `ygg` context in the thrown `YggdrasilServerStatus` will have
+extended Yggdrasil Server Conduit attributes.
+
+## Catching errors
+
+You should always check if a caught Error is an instance of `YggdrasilStatus` when
+catching Yggdrasil Server errors. You should only check for `YggdrasilServerStatus`
+to get the associated `ygg` context, keeping in mind that it is only available on
+a best-effort basis.
+
+## YggdrasilStatus attributes
+
+The `YggdrasilStatus` object contains the following attributes:
+
+- `status`: [The HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) to return.
+   The name of the status code should match the nature of the exception.    
+- `statusCode`: A custom status code (something like "AUTH_REQUIRED"). This should be a brief exception ID
+   that should allow you to identify where the exception was thrown from in your code, and also
    allow users to identify the error through bug reports, web searches, etc.
-3. (optional) A custom status message to show to the user to help them understand the nature 
-   of the error, how they might resolve it, additional details, etc.
+- `statusMessage`: A custom status message to show to the user to help them understand the nature of 
+   the error, how they might resolve it, additional details, etc.
+- `statusCtx`: Any custom properties you may want to associate with the thrown status. The type of
+   this attribute is set by your YggdrasilServer app types for construction, but when you catch a
+   `YggdrasilStatus` object, the `statusCtx` may be different if it was thrown internally by
+   Yggdrasil Server or by some other part of code.
+- `ygg`: The `ygg` context active when the exception was thrown. (Only on `YggdrasilServerStatus`
+   objects)
 
 ## Built-in errors
 
@@ -53,6 +85,7 @@
 | 405 | `YGG_ROUTE_METHOD_MISMATCH` | Thrown when YggdrasilRouter finds route(s) that matches the request's path, but none of them match the request's method. |
 | 404 | `YGG_API_NOT_FOUND` | Thrown when YggdrasilConduitServer can't find a Conduit API implementation that matches the request. |
 | 400 | `YGG_BAD_API_REQUEST` | Thrown when YggdrasilConduitServer detects an invalid Conduit API request. |
+| 500 | `YGG_BAD_API_RESPONSE` | Thrown when the Yggdrasil Conduit client cannot parse the response received from a Yggdrasil Conduit server.
 | 500 | `YGG_BADLY_CONFIGURED` | Thrown when Yggdrasil Server is unable to proceed due to a misconfiguration, such as missing a required option, contradictory settings, etc. The error message describes the nature of the misconfiguration.  |
 
 ## Status pages
@@ -62,8 +95,7 @@
 
 | Request Accept | Response type | Description |
 | - | - | - |
-| `application/json+jottocraft-ygg-res` | `application/json+jottocraft-ygg-res` | Returns all the information necessary to pass along the status to the callee's instance of Yggdrasil Server. Please see the Conduit feature documentation for more information. |
-| `application/json` | `application/json` | This currently does the same thing as requests accepting `application/json+jottocraft-ygg-res`. |
+| `application/json` | `application/json` | Returns a JSON object with the following keys: `success`: `false`, `status`: the HTTP status code, `error`: the `YggdrasilStatus` status code, `message`: the status message. |
 | `text/html` | `text/html` | Calls `ygg.options.generateHtmlStatusPage()` if this is something you've implemented. |
 | Anything else | `text/plain` | Returns a presentable plaintext status page detailing the error. |
 
diff --git a/docs/docs/features/memo.md b/docs/docs/features/memo.md
index ac35d5f..4a3cea6 100644
--- a/docs/docs/features/memo.md
+++ b/docs/docs/features/memo.md
@@ -96,4 +96,8 @@
 It is important to emphasize that this should only be done in the
 same short-lived context (e.g. one request/operation). Sharing results in a 
 larger scope can lead to data leaks (a security issue) or stale
-results (a correctness issue).
\ No newline at end of file
+results (a correctness issue).
+
+The format of memoized results returned by `ygg.getMemoizedResults()`
+is opaque and subject to change. It is also not covered by SemVer; you should
+only store and restore memoized results on the same server.
\ No newline at end of file
diff --git a/docs/docs/features/router.md b/docs/docs/features/router.md
index 653def8..4cb6883 100644
--- a/docs/docs/features/router.md
+++ b/docs/docs/features/router.md
@@ -13,8 +13,8 @@
 
 ### Setup routes
 
-To define routes, simply use YggdrasilServer.defineRoute to create a
-route object. Then, pass all of your route objects into YggdrasilRouter's
+To define routes, simply use `defineRoute` to create a type-safe route
+definition function. Then, pass all of your route objects into YggdrasilRouter's
 constructor to register them.
 
 Please note that route handlers are passed a YggdrasilRouterContext,
@@ -23,12 +23,19 @@
 The following sample shows how to define and register routes using
 the recommended convention that keeps each route defined in its own file:
 
+```ts title="src/server.ts"
+import { YggdrasilServer, defineRoute } from "@jottocraft/yggdrasil";
+
+export const DemoServer = new YggdrasilServer<DemoAppTypes>();
+export const defineDemoRoute = defineRoute<DemoAppTypes>;
+```
+
 ```ts title="src/routes/hello.ts"
-import { DemoServer } from "../server";
+import { defineDemoRoute } from "../server";
 
 // The first parameter is the HTTP method, or * to match all methods.
 // The second parameter is the route to match (see the Routing section below)
-export const hello = DemoServer.defineRoute("GET", "/hello", async (ygg) => {
+export const hello = defineDemoRoute("GET", "/hello", async (ygg) => {
     return new Response("Hello world!", { status: 200 });
 });
 ```
@@ -49,7 +56,7 @@
 import * as routes from "./routes";
 
 // This should ideally be defined outside your request handler
-const DemoRouter = new YggdrasilRouter(DemoServer, routes);
+const DemoRouter = new YggdrasilRouter<DemoAppTypes>(DemoServer, routes);
 
 // Additional required setup omitted for brevity
 
@@ -124,8 +131,8 @@
 YggdrasilRouter only checks each path segment once. If it sees that a
 segment can be matched with either a variable segment or a literal match,
 it will prefer the literal match. This can lead to some potentially unexpected
-behavior, however. It's best to avoid allowing a route to be matched with different
-paths for this reason.
+behavior, however. It's best to avoid allowing a path to be matched with different
+routes for this reason.
 
 For example, assume you have routes `/posts/$postId` and `/posts/$postId/likes`.
 Then, you create a new route to render a special post, e.g. `/posts/specialPost`.
diff --git a/docs/docs/index.md b/docs/docs/index.md
index 89d30d5..648b444 100644
--- a/docs/docs/index.md
+++ b/docs/docs/index.md
@@ -22,17 +22,27 @@
 ```ts title="src/server.ts"
 import { YggdrasilServer } from "@jottocraft/yggdrasil";
 
-export type AppType = {
-    // The ctx object defines any arbitrary custom data 
-    // to pass to your request handlers.
+export type AppTypes = {
+    // The ctx object defines any arbitrary custom data to pass to
+    // your request handlers.
+    //
     // Examples include environment variables, database bindings, etc.
     ctx: {
         env: DemoEnv;
         ctx: ExecutionContext;
     };
+    // The statusCtx object defines any arbitrary custom data you
+    // want to include with YggdrasilStatus objects thrown by your
+    // application.
+    //
+    // One example is including the names of fields responsible that
+    // caused the error to be generated.
+    statusCtx: {
+        fields: string[];
+    };
 };
 
-export const DemoServer = new YggdrasilServer<AppType>();
+export const DemoServer = new YggdrasilServer<AppTypes>();
 ```
 
 ### Step 3: Handle requests
@@ -61,7 +71,7 @@
             }
         }, 
         // Yggdrasil Server options. These are specified here rather than in
-        // the YggdrasilServer object to support multi-tenancy.
+        // the YggdrasilServer constructor to allow changing options per-request.
         {
             debug: true
         });
diff --git a/docs/static/favicon.png b/docs/static/favicon.png
index 5974ba1..68264c3 100644
--- a/docs/static/favicon.png
+++ b/docs/static/favicon.png
Binary files differ
diff --git a/yggdrasil/package.json b/yggdrasil/package.json
index 8a5b00c..38b3959 100644
--- a/yggdrasil/package.json
+++ b/yggdrasil/package.json
@@ -1,7 +1,7 @@
 {
     "name": "@jottocraft/yggdrasil",
     "description": "A simple and flexible TypeScript library for streamlining web request handling.",
-    "version": "0.0.1-alpha.10",
+    "version": "0.0.1-alpha.17",
     "license": "LGPL-2.1-only",
     "author": "jottocraft <[email protected]>",
     "main": "lib/index.js",
diff --git a/yggdrasil/src/YggdrasilConduitServer.ts b/yggdrasil/src/YggdrasilConduitServer.ts
index 5855744..d7bb18a 100644
--- a/yggdrasil/src/YggdrasilConduitServer.ts
+++ b/yggdrasil/src/YggdrasilConduitServer.ts
@@ -1,107 +1,212 @@
 // Yggdrasil
 // Copyright (c) jottocraft 2024
 
-import { YggdrasilConduitAPI, YggdrasilConduitRequest, YggdrasilConduitResponse } from "~/conduitClient";
-import { YggdrasilConduitContext, YggdrasilServerContext } from "~/context";
-import { YggdrasilAppTypes, YggdrasilServer } from "~/YggdrasilServer";
+import type { YggdrasilConduitApi, YggdrasilConduitRequest, YggdrasilConduitResponse, YggdrasilConduitResponseError } from "~/conduit";
+import type { YggdrasilAdditionalHeaders, YggdrasilAppTypes, YggdrasilServer, YggdrasilServerContext } from "~/YggdrasilServer";
+import { YggdrasilStatus, yggdrasilStatusToJson } from "~/YggdrasilStatus";
+
+/**
+ * Types defining your Conduit API, extended with an additional server-side attributes.
+ */
+export type YggdrasilConduitServerApiTypes = YggdrasilConduitApi & {
+    /** A custom application-defined context object used to add custom attributes to YggdrasilConduitContext objects processed through your server. */
+    conduitCtx?: any;
+};
+
+/**
+ * Options to configure YggdrasilConduitServer.
+ */
+export type YggdrasilConduitServerOptions<AppTypes extends YggdrasilAppTypes, ApiTypes extends YggdrasilConduitServerApiTypes> = {
+    /**
+     * The base path used for Conduit API requests.
+     * This path IS case sensitive and will not be normalized.
+     * It must start and end with a slash.
+     * e.g. /, /conduit/, etc.
+     */
+    conduitBasePath: string;
+    /**
+     * Receives the apiCtx context passed by the Conduit client and applies any custom pre-processing you want to do
+     * before your Conduit API handlers are called. Takes a client-side apiCtx context and returns a server-side conduitCtx context.
+     */
+    prepareConduitCtx: (ygg: YggdrasilServerContext<AppTypes>, apiCtx: ApiTypes["apiCtx"]) => Promise<ApiTypes["conduitCtx"]>;
+};
+
+/**
+ * Context associated with the current Conduit API request being processed.
+ */
+export type YggdrasilConduitContext<AppTypes extends YggdrasilAppTypes, ApiTypes extends YggdrasilConduitServerApiTypes> = YggdrasilServerContext<AppTypes> & {
+    /** Headers that will be set/appended to the highest-level upstream request. */
+    upstreamHeaders: YggdrasilAdditionalHeaders;
+    /** Context from the Conduit request. */
+    conduitCtx: ApiTypes["conduitCtx"];
+};
 
 type AnyFn = (...args: any[]) => any;
 
 /**
  * A function that executes the server's implementation of its Conduit function.
  */
-export type YggdrasilConduitAPIHandler<AppTypes extends YggdrasilAppTypes, ApiSpec extends YggdrasilConduitAPI, API extends AnyFn> = (ygg: YggdrasilConduitContext<AppTypes, ApiSpec>, ...parameters: Parameters<API>) => ReturnType<API>;
+export type YggdrasilConduitApiHandler<AppTypes extends YggdrasilAppTypes, ApiTypes extends YggdrasilConduitServerApiTypes, Api extends AnyFn> = (ygg: YggdrasilConduitContext<AppTypes, ApiTypes>, ...parameters: Parameters<Api>) => ReturnType<Api>;
 
 /**
  * An object that stores the server's Conduit function implementations.
  */
-export type YggdrasilConduitApiClientImpl<AppTypes extends YggdrasilAppTypes, ApiSpec extends YggdrasilConduitAPI> = {
-    [Property in keyof ApiSpec["client"]]: ApiSpec["client"][Property] extends AnyFn ? YggdrasilConduitAPIHandler<AppTypes, ApiSpec, ApiSpec["client"][Property]> : YggdrasilConduitApiClientImpl<AppTypes, Omit<ApiSpec, "client"> & { client: ApiSpec["client"][Property] }>;
+export type YggdrasilConduitApiClientImpl<AppTypes extends YggdrasilAppTypes, ApiTypes extends YggdrasilConduitServerApiTypes> = {
+    [Property in keyof ApiTypes["client"]]: ApiTypes["client"][Property] extends AnyFn ? YggdrasilConduitApiHandler<AppTypes, ApiTypes, ApiTypes["client"][Property]> : YggdrasilConduitApiClientImpl<AppTypes, Omit<ApiTypes, "client"> & { client: ApiTypes["client"][Property] }>;
 };
 
 /**
  * A helper object for defining Conduit function implementations with automatic type safety.
  */
-export type YggdrasilConduitApiClientBlueprint<AppTypes extends YggdrasilAppTypes, ApiSpec extends YggdrasilConduitAPI> = {
-    [Property in keyof ApiSpec["client"]]: ApiSpec["client"][Property] extends AnyFn ? (impl: YggdrasilConduitAPIHandler<AppTypes, ApiSpec, ApiSpec["client"][Property]>) => YggdrasilConduitAPIHandler<AppTypes, ApiSpec, ApiSpec["client"][Property]> : YggdrasilConduitApiClientBlueprint<AppTypes, Omit<ApiSpec, "client"> & { client: ApiSpec["client"][Property] }>;
+export type YggdrasilConduitApiClientBlueprint<AppTypes extends YggdrasilAppTypes, ApiTypes extends YggdrasilConduitServerApiTypes> = {
+    [Property in keyof ApiTypes["client"]]: ApiTypes["client"][Property] extends AnyFn ? (impl: YggdrasilConduitApiHandler<AppTypes, ApiTypes, ApiTypes["client"][Property]>) => YggdrasilConduitApiHandler<AppTypes, ApiTypes, ApiTypes["client"][Property]> : YggdrasilConduitApiClientBlueprint<AppTypes, Omit<ApiTypes, "client"> & { client: ApiTypes["client"][Property] }>;
 };
 
 /**
  * Internal type for recursing through arbitrary segments in the API object.
  */
-type APISegment<AppTypes extends YggdrasilAppTypes, ApiSpec extends YggdrasilConduitAPI> = {
-    [segment: string]: APISegment<AppTypes, ApiSpec> | YggdrasilConduitAPIHandler<AppTypes, ApiSpec, AnyFn>;
+type ApiSegment<AppTypes extends YggdrasilAppTypes, ApiTypes extends YggdrasilConduitServerApiTypes> = {
+    [segment: string]: ApiSegment<AppTypes, ApiTypes> | YggdrasilConduitApiHandler<AppTypes, ApiTypes, AnyFn>;
 };
 
 /**
+ * A helper for defining API routes with type safety.
+ */
+export function defineApi<AppTypes extends YggdrasilAppTypes, ApiTypes extends YggdrasilConduitServerApiTypes = { client: unknown; }>(): YggdrasilConduitApiClientBlueprint<AppTypes, ApiTypes> {
+    const implProxy = new Proxy((impl: unknown) => impl, {
+        get: (target, name) => {
+            return implProxy;
+        }
+    }) as any;
+
+    return implProxy;
+}
+
+/**
+ * Formats an uncaught YggdrasilStatus exception to be passed to a Conduit client.
+ */
+async function generateConduitErrorResponse<AppTypes extends YggdrasilAppTypes, ApiTypes extends YggdrasilConduitServerApiTypes>(ygg: YggdrasilServerContext<AppTypes> | YggdrasilConduitContext<AppTypes, ApiTypes>, e: YggdrasilStatus<unknown>): Promise<Response> {
+    const result: YggdrasilConduitResponseError<AppTypes["statusCtx"]> = {
+        success: false,
+        status: yggdrasilStatusToJson(e),
+        headers: ("upstreamHeaders" in ygg) ? ygg.upstreamHeaders : { set: {}, append: [] }
+    };
+
+    if (ygg.options.debug) {
+        result.debug = {
+            stack: e.stack
+        };
+    }
+
+    return new Response(JSON.stringify(result), {
+        status: e.status,
+        headers: {
+            "Content-Type": "application/json+jottocraft-ygg-res"
+        }
+    });
+}
+
+/**
  * A server for handling Conduit requests made to Yggdrasil Server.
  */
-export class YggdrasilConduitServer<AppTypes extends YggdrasilAppTypes, ApiSpec extends YggdrasilConduitAPI> {
-    constructor(server: YggdrasilServer<AppTypes, ApiSpec>, api: YggdrasilConduitApiClientImpl<AppTypes, ApiSpec>) {
+export class YggdrasilConduitServer<AppTypes extends YggdrasilAppTypes, ApiTypes extends YggdrasilConduitServerApiTypes> {
+    constructor(server: YggdrasilServer<AppTypes>, api: YggdrasilConduitApiClientImpl<AppTypes, ApiTypes>, options: YggdrasilConduitServerOptions<AppTypes, ApiTypes>) {
         this.#server = server;
         this.#api = api;
+        this.#options = options;
     }
 
     async handleRequest(ygg: YggdrasilServerContext<AppTypes>): Promise<Response> {
-        if (!ygg.options.conduitBasePath) throw ygg.status(500, "YGG_BADLY_CONFIGURED", "conduitBasePath must be configured to use Yggdrasil Server Conduit.");
+        try {
+            if (!this.#options.conduitBasePath) throw ygg.status(500, "YGG_BADLY_CONFIGURED", "conduitBasePath must be configured to use Yggdrasil Server Conduit.");
 
-        let requestedPath = ygg.pathname.requested.replace(ygg.options.conduitBasePath, "");
-        if (!ygg.pathname.requested.startsWith(ygg.options.conduitBasePath) || (requestedPath === "/") || requestedPath.endsWith("/")) throw ygg.status(404, "YGG_API_NOT_FOUND", "The requested API can't be located.");
+            let requestedPath = ygg.pathname.requested.replace(this.#options.conduitBasePath, "");
+            if (!ygg.pathname.requested.startsWith(this.#options.conduitBasePath) || (requestedPath === "/") || requestedPath.endsWith("/")) throw ygg.status(404, "YGG_API_NOT_FOUND", "The requested API can't be located.");
 
-        let requestedApiSegment = this.#api as APISegment<AppTypes, ApiSpec>;
-        let requestedApi: YggdrasilConduitAPIHandler<AppTypes, ApiSpec, AnyFn> | undefined;
+            let requestedApiSegment = this.#api as ApiSegment<AppTypes, ApiTypes>;
+            let requestedApi: YggdrasilConduitApiHandler<AppTypes, ApiTypes, AnyFn> | undefined;
 
-        const segments = requestedPath.split("/");
-        for (const segment of segments) {
-            if (!requestedApi && (typeof requestedApiSegment[segment] === "function")) {
-                requestedApi = requestedApiSegment[segment];
-            } else if (!requestedApi && (typeof requestedApiSegment[segment] === "object")) {
-                requestedApiSegment = requestedApiSegment[segment];
+            const segments = requestedPath.split("/");
+            for (const segment of segments) {
+                if (!requestedApi && (typeof requestedApiSegment[segment] === "function")) {
+                    requestedApi = requestedApiSegment[segment];
+                } else if (!requestedApi && (typeof requestedApiSegment[segment] === "object")) {
+                    requestedApiSegment = requestedApiSegment[segment];
+                } else {
+                    throw ygg.status(404, "YGG_API_NOT_FOUND", "The requested API can't be located.");
+                }
+            }
+
+            if (requestedApi) {
+                if (ygg.request.headers.get("Content-Type") !== "application/json+jottocraft-ygg-req") throw ygg.status(400, "YGG_BAD_API_REQUEST", "Badly formatted Conduit request.");
+
+                let request: YggdrasilConduitRequest<ApiTypes["apiCtx"], unknown[]>;
+                try {
+                    request = await ygg.request.json();
+                } catch (e) {
+                    throw ygg.status(400, "YGG_BAD_API_REQUEST", "Failed to parse Conduit request body.");
+                }
+
+                if (!request.parameters || !(request.parameters instanceof Array)) throw ygg.status(400, "YGG_BAD_API_REQUEST", "Badly formatted Conduit request.");
+
+                const conduitCtx = await this.#options.prepareConduitCtx(ygg, request.context);
+
+                const yggConduitCtx = {
+                    upstreamHeaders: {
+                        set: {},
+                        append: []
+                    },
+                    get conduitCtx() {
+                        const boundCtx: ApiTypes["conduitCtx"] = {} as ApiTypes["conduitCtx"];
+
+                        for (const key in conduitCtx) {
+                            if (typeof conduitCtx[key] === "function") {
+                                boundCtx[key] = conduitCtx[key].bind(this);
+                            } else {
+                                boundCtx[key] = conduitCtx[key];
+                            }
+                        }
+
+                        return boundCtx;
+                    }
+                } satisfies Omit<YggdrasilConduitContext<AppTypes, ApiTypes>, keyof YggdrasilServerContext<AppTypes>> as unknown as YggdrasilConduitContext<AppTypes, ApiTypes>;
+                Object.setPrototypeOf(yggConduitCtx, ygg);
+
+                try {
+                    const data = await requestedApi(yggConduitCtx, ...request.parameters.map(param => (param === "__jtc_ygg_undefined" ? undefined : param)));
+
+                    const result: YggdrasilConduitResponse<AppTypes["statusCtx"], unknown> = {
+                        success: true,
+                        data,
+                        headers: yggConduitCtx.upstreamHeaders
+                    };
+
+                    return new Response(JSON.stringify(result), {
+                        status: 200,
+                        headers: {
+                            "Content-Type": "application/json+jottocraft-ygg-res"
+                        }
+                    });
+                } catch (e) {
+                    if ((e instanceof YggdrasilStatus) && yggConduitCtx.request.headers.get("Accept")?.includes("application/json+jottocraft-ygg-res")) {
+                        return generateConduitErrorResponse(yggConduitCtx, e);
+                    } else {
+                        throw e;
+                    }
+                }
             } else {
                 throw ygg.status(404, "YGG_API_NOT_FOUND", "The requested API can't be located.");
             }
-        }
-
-        if (requestedApi) {
-            if (ygg.request.headers.get("Content-Type") !== "application/json+jottocraft-ygg-req") throw ygg.status(400, "YGG_BAD_API_REQUEST", "Badly formatted Conduit request.");
-
-            let request: YggdrasilConduitRequest<ApiSpec["context"], unknown[]>;
-            try {
-                request = await ygg.request.json();
-            } catch (e) {
-                throw ygg.status(400, "YGG_BAD_API_REQUEST", "Failed to parse Conduit request body.");
+        } catch (e) {
+            if ((e instanceof YggdrasilStatus) && ygg.request.headers.get("Accept")?.includes("application/json+jottocraft-ygg-res")) {
+                return generateConduitErrorResponse(ygg, e);
+            } else {
+                throw e;
             }
-
-            if (!request.parameters || !(request.parameters instanceof Array)) throw ygg.status(400, "YGG_BAD_API_REQUEST", "Badly formatted Conduit request.");
-
-            const yggConduitCtx = {
-                upstreamHeaders: {
-                    set: {},
-                    append: []
-                },
-                apiCtx: request.context
-            } satisfies Omit<YggdrasilConduitContext<AppTypes, ApiSpec>, keyof YggdrasilServerContext<AppTypes>> as unknown as YggdrasilConduitContext<AppTypes, ApiSpec>;
-            Object.setPrototypeOf(yggConduitCtx, ygg);
-
-            const data = await requestedApi(yggConduitCtx, ...request.parameters);
-
-            const result: YggdrasilConduitResponse<unknown> = {
-                success: true,
-                data,
-                headers: yggConduitCtx.upstreamHeaders
-            };
-
-            return new Response(JSON.stringify(result), {
-                status: 200,
-                headers: {
-                    "Content-Type": "application/json+jottocraft-ygg-res"
-                }
-            });
-        } else {
-            throw ygg.status(404, "YGG_API_NOT_FOUND", "The requested API can't be located.");
         }
     }
 
     #server: YggdrasilServer<AppTypes>;
-    #api: YggdrasilConduitApiClientImpl<AppTypes, ApiSpec>;
-};
\ No newline at end of file
+    #api: YggdrasilConduitApiClientImpl<AppTypes, ApiTypes>;
+    #options: YggdrasilConduitServerOptions<AppTypes, ApiTypes>;
+}
\ No newline at end of file
diff --git a/yggdrasil/src/YggdrasilRouter.ts b/yggdrasil/src/YggdrasilRouter.ts
index 2a77ef0..316d2be 100644
--- a/yggdrasil/src/YggdrasilRouter.ts
+++ b/yggdrasil/src/YggdrasilRouter.ts
@@ -1,8 +1,15 @@
 // Yggdrasil
 // Copyright (c) jottocraft 2024
 
-import { YggdrasilRouterContext, YggdrasilServerContext } from "~/context";
-import { YggdrasilAppTypes, YggdrasilServer } from "~/YggdrasilServer";
+import type { YggdrasilAppTypes, YggdrasilServer, YggdrasilServerContext } from "~/YggdrasilServer";
+
+/**
+ * Context associated with the current route being processed.
+ */
+export type YggdrasilRouterContext<AppTypes extends YggdrasilAppTypes> = YggdrasilServerContext<AppTypes> & {
+    /** The parameters set by variable segments in the router's path. */
+    params: YggdrasilRouterRequestParams;
+};
 
 /**
  * An object that represents the route configuration made by YggdrasilServer.defineRoute().
@@ -37,6 +44,13 @@
 export type YggdrasilRouterHandler<AppTypes extends YggdrasilAppTypes> = (ygg: YggdrasilRouterContext<AppTypes>) => Promise<Response>;
 
 /**
+ * Defines a route to use with YggdrasilRouter.
+ */
+export function defineRoute<AppTypes extends YggdrasilAppTypes>(method: string, route: string, handler: YggdrasilRouterHandler<AppTypes>): YggdrasilRouteConfig<AppTypes> {
+    return { method, route, handler };
+}
+
+/**
  * A server for routing requests made to YggdrasilServer.
  */
 export class YggdrasilRouter<AppTypes extends YggdrasilAppTypes> {
@@ -56,9 +70,9 @@
                     registeredPath = registeredPath.children[segment];
                 }
             }
-    
+
             registeredPath.handlers ??= {};
-            registeredPath.handlers[route.method] = route.handler;    
+            registeredPath.handlers[route.method] = route.handler;
         }
     }
 
@@ -81,14 +95,14 @@
         if (requestedPath.handlers) {
             const yggRouterCtx = { params } as YggdrasilRouterContext<AppTypes>;
             Object.setPrototypeOf(yggRouterCtx, ygg);
-            
+
             if (requestedPath.handlers[ygg.request.method]) {
                 return requestedPath.handlers[ygg.request.method](yggRouterCtx);
             } else if (requestedPath.handlers["*"]) {
                 return requestedPath.handlers["*"](yggRouterCtx);
             } else {
                 throw ygg.status(405, "YGG_ROUTE_METHOD_MISMATCH", "The requested page can't be loaded with the requested method.");
-            }    
+            }
         } else {
             throw ygg.status(404, "YGG_ROUTE_NOT_FOUND", "The requested page can't be located.");
         }
diff --git a/yggdrasil/src/YggdrasilServer.ts b/yggdrasil/src/YggdrasilServer.ts
index 1bb2a49..093608f 100644
--- a/yggdrasil/src/YggdrasilServer.ts
+++ b/yggdrasil/src/YggdrasilServer.ts
@@ -1,20 +1,85 @@
 // Yggdrasil
 // Copyright (c) jottocraft 2024
 
-import { applyHeaders } from "~/util/applyHeaders";
 import { generateStatusPage } from "~/util/generateStatusPage";
-
-import { YggdrasilServerContext, YggdrasilServerContextOptions } from "~/context";
-import { YggdrasilRouteConfig, YggdrasilRouterHandler } from "~/YggdrasilRouter";
-import { YggdrasilStatus } from "~/YggdrasilStatus";
-import { YggdrasilConduitApiClientBlueprint } from "~/YggdrasilConduitServer";
-import { YggdrasilConduitAPI } from "~/conduitClient";
+import { YggdrasilServerStatus, YggdrasilStatus, type YggdrasilStatusOptions } from "~/YggdrasilStatus";
 
 /**
- * Defines the app's types. Currently, this only defines the app's context, but it may be extended.
+ * Defines the app's types.
  */
 export type YggdrasilAppTypes = {
-    ctx: any;
+    /** A custom application-defined context object used to add custom attributes to YggdrasilContext objects processed through your server. */
+    ctx?: any;
+    /** A custom application-defined context object used to add custom attributes to YggdrasilStatus objects thrown in your server. */
+    statusCtx?: any;
+};
+
+/**
+ * Options to configure YggdrasilServer.
+ */
+export type YggdrasilServerOptions<AppTypes extends YggdrasilAppTypes> = {
+    /** True if debug information should be returned on the status pages. */
+    debug?: boolean;
+    /** 
+     * The base external URL handled by this server, without a trailing slash, e.g. https://jottocraft.com, https://jottocraft.com/app.
+     * All requests must have a pathname that's prefixed with the pathname of this base URL, or an error will be thrown.
+     * The host and scheme do not have to match, however, e.g. if using a reverse proxy.
+     * The case should match your normalization.lowercase setting.
+     */
+    baseURL?: string;
+    /** Configures URL path normalization. */
+    normalization?: {
+        /** True if paths should have trailing slashes, e.g. /page/ instead of /page. False if they should not. Undefined if normalization should not be performed. */
+        trailingSlash?: boolean;
+        /** True if paths should be all lowercase, e.g. /page instead of /Page or /PaGe. */
+        lowercase?: boolean;
+        /** True if a redirect should be performed if the normalized path does not match the actual requested path. */
+        redirect?: boolean;
+    };
+    /** A function you can implement to generate HTML status pages for a given YggdrasilStatus object. By default, a plaintext status page will be shown. */
+    generateHtmlStatusPage?: (ygg: YggdrasilServerContext<AppTypes>, e: YggdrasilStatus<unknown>) => Promise<Response>;
+};
+
+/**
+ * Context associated with the current request being processed.
+ */
+export type YggdrasilServerContext<AppTypes extends YggdrasilAppTypes> = {
+    /** Constructs a YggdrasilStatus object based on the current context. */
+    status: (status: number, statusCode: string, messageOrOptions?: string | YggdrasilStatusOptions<AppTypes["statusCtx"]>) => YggdrasilServerStatus<AppTypes>;
+    /** Throws a YggdrasilStatus if the condition isn't met. */
+    assert: (condition: any, status: number, statusCode: string, messageOrOptions?: string | YggdrasilStatusOptions<AppTypes["statusCtx"]>) => asserts condition;
+    /** The Yggdrasil Server instance associated with this request. */
+    server: YggdrasilServer<AppTypes>;
+    /** The original request. */
+    request: Request;
+    /** The requested and normalized URLs. */
+    url: {
+        requested: URL;
+        normalized: URL;
+    };
+    /** The requested, normalized, and normalized relative (to the base URL) pathnames. */
+    pathname: {
+        requested: string;
+        normalized: string;
+        relative: string;
+    };
+    /** This server's base URL. */
+    baseURL?: URL;
+    /** Custom app context associated with this request. */
+    ctx: AppTypes["ctx"];
+    /** Yggdrasil Server options. */
+    options: YggdrasilServerOptions<AppTypes>;
+    /** Headers that will be set or appended to the final response. */
+    additionalHeaders: YggdrasilAdditionalHeaders;
+    /** Memoizes the result. */
+    memoize: <T>(key: string, task: () => Promise<T>) => Promise<T>;
+    /** Returns true if the requested task has been completed and its result is immediately available. */
+    hasMemoizedResult: (key: string) => boolean;
+    /** 
+     * Returns stored memoized results. Useful if you need to save/restore state without redoing memoized work. 
+     * Restore only via handleRequest's memoizedResults app option. The format of the returned value is opaque and subject to change.
+     */
+    getMemoizedResults: () => unknown;
 };
 
 /**
@@ -28,6 +93,14 @@
 };
 
 /**
+ * Additional headers to set/append to the final response after processing the request.
+ */
+export type YggdrasilAdditionalHeaders = {
+    set: { [headerName: string]: string; };
+    append: string[][];
+};
+
+/**
  * Memoized functions.
  */
 export type YggdrasilMemoizedFunctions = {
@@ -45,35 +118,28 @@
 type MemoizedResultsInternal = { [key: string]: { resolved: false; dispatcher: EventTarget; } | { resolved: true; outcome: unknown; }; }
 
 /**
+ * Applies header modifications to a Response.
+ */
+export function applyHeaders(response: Response, additionalHeaders: YggdrasilAdditionalHeaders) {
+    for (const name in additionalHeaders.set) {
+        response.headers.set(name, additionalHeaders.set[name]);
+    }
+
+    for (const [name, value] of additionalHeaders.append) {
+        response.headers.append(name, value);
+    }
+}
+
+/**
  * The main class for processing requests.
  */
-export class YggdrasilServer<AppTypes extends YggdrasilAppTypes, ApiSpec extends YggdrasilConduitAPI = { client: unknown; context: unknown; }> {
+export class YggdrasilServer<AppTypes extends YggdrasilAppTypes> {
     constructor() { }
 
     /**
-     * Defines a route to use with YggdrasilRouter.
-     */
-    defineRoute(method: string, route: string, handler: YggdrasilRouterHandler<AppTypes>): YggdrasilRouteConfig<AppTypes> {
-        return { method, route, handler };
-    }
-
-    /**
-     * Defines an API to use with YggdrasilConduitServer.
-     */
-    defineAPI(): YggdrasilConduitApiClientBlueprint<AppTypes, ApiSpec> {
-        const implProxy = new Proxy((impl: unknown) => impl, {
-            get: (target, name) => {
-                return implProxy;
-            }
-        }) as any;
-
-        return implProxy;
-    }
-
-    /**
      * Handles a request.
      */
-    async handleRequest(request: Request, handler: YggdrasilHandler<AppTypes>, app: YggdrasilAppData<AppTypes>, options: YggdrasilServerContextOptions<AppTypes> = {}): Promise<Response> {
+    async handleRequest(request: Request, handler: YggdrasilHandler<AppTypes>, app: YggdrasilAppData<AppTypes>, options: YggdrasilServerOptions<AppTypes> = {}): Promise<Response> {
         const url = new URL(request.url);
         const baseURL = options.baseURL ? new URL(options.baseURL) : undefined;
 
@@ -111,7 +177,7 @@
 
         const ygg: YggdrasilServerContext<AppTypes> = {
             status(...args) {
-                return new YggdrasilStatus(this, ...args);
+                return new YggdrasilServerStatus(this, ...args);
             },
             assert(condition, ...args) {
                 if (!condition) {
@@ -156,13 +222,13 @@
                     if (result.resolved) {
                         return result.outcome as T;
                     } else {
-                        return await new Promise((resolve, reject) => {
+                        return await new Promise<T>((resolve, reject) => {
                             result.dispatcher.addEventListener("resolved", () => {
                                 const resolvedOutcome = memoizedResults[key];
                                 if (!resolvedOutcome.resolved) {
                                     reject(new Error("A resolved event was illegally fired before the memoized outcome was set."));
                                 } else {
-                                    resolve(resolvedOutcome.outcome as any); // I have no idea why "as T" doesn't work here.
+                                    resolve(resolvedOutcome.outcome as T);
                                 }
                             });
                         });
@@ -204,7 +270,7 @@
         let response: Response;
 
         if (!ygg.pathname.relative) {
-            response = await generateStatusPage(new YggdrasilStatus(ygg, 404, "YGG_BASE_URL_MISMATCH"));
+            response = await generateStatusPage(ygg, new YggdrasilServerStatus(ygg, 404, "YGG_BASE_URL_MISMATCH"));
         } else if (options.normalization?.redirect && (ygg.pathname.normalized !== ygg.pathname.requested)) {
             response = new Response(null, {
                 status: 301,
@@ -217,7 +283,7 @@
                 response = await handler(ygg);
             } catch (e) {
                 if (e instanceof YggdrasilStatus) {
-                    response = await generateStatusPage(e);
+                    response = await generateStatusPage(ygg, e);
                 } else {
                     throw e;
                 }
diff --git a/yggdrasil/src/YggdrasilStatus.ts b/yggdrasil/src/YggdrasilStatus.ts
index 8aa7eb0..f970c87 100644
--- a/yggdrasil/src/YggdrasilStatus.ts
+++ b/yggdrasil/src/YggdrasilStatus.ts
@@ -1,19 +1,53 @@
 // Yggdrasil
 // Copyright (c) jottocraft 2024
 
-import { YggdrasilContext } from "~/context";
-import { YggdrasilAppTypes } from "~/YggdrasilServer";
+import type { YggdrasilAppTypes, YggdrasilServerContext } from "~/YggdrasilServer";
+
+export type YggdrasilStatusOptions<StatusCtxType> = ErrorOptions & {
+    ctx?: StatusCtxType;
+    message?: string;
+};
+
+export type YggdrasilStatusJSON<StatusCtxType> = {
+    status: number;
+    code: string;
+    message?: string;
+    ctx?: StatusCtxType;
+};
 
 /**
- * YggdrasilStatus for clients without a server-side YggdrasilContext
+ * Stringifies a YggdrasilStatus object to JSON.
  */
-export class YggdrasilClientStatus extends Error {    
-    constructor(status: number, statusCode: string, statusMessage?: string) {
-        super(statusCode);
+export function yggdrasilStatusToJson<StatusCtxType>(status: YggdrasilStatus<StatusCtxType>): YggdrasilStatusJSON<StatusCtxType> {
+    return {
+        status: status.status,
+        code: status.statusCode,
+        message: status.statusMessage,
+        ctx: status.statusCtx
+    };
+}
+
+/**
+ * Parses a YggdrasilStatus object from JSON.
+ */
+export function jsonToYggdrasilStatus<StatusCtxType>(json: YggdrasilStatusJSON<StatusCtxType>): YggdrasilStatus<StatusCtxType> {
+    return new YggdrasilStatus<StatusCtxType>(json.status, json.code, {
+        message: json.message,
+        ctx: json.ctx
+    });
+}
+
+/**
+ * YggdrasilStatus for clients without a server-side YggdrasilContext.
+ */
+export class YggdrasilStatus<StatusCtxType> extends Error {
+    constructor(status: number, statusCode: string, messageOrOptions?: string | YggdrasilStatusOptions<StatusCtxType>) {
+        super(statusCode, typeof messageOrOptions !== "string" ? messageOrOptions : undefined);
 
         this.#status = status;
         this.#statusCode = statusCode;
-        this.#statusMessage = statusMessage;
+        this.#statusMessage = typeof messageOrOptions === "string" ? messageOrOptions : messageOrOptions?.message;
+        if (typeof messageOrOptions !== "string") this.#statusCtx = messageOrOptions?.ctx;
     }
 
     #status: number;
@@ -30,19 +64,24 @@
     get statusMessage() {
         return this.#statusMessage;
     }
+
+    #statusCtx?: StatusCtxType;
+    get statusCtx() {
+        return this.#statusCtx;
+    }
 };
 
 /**
  * An Error that will cause an HTTP status page to show.
  */
-export class YggdrasilStatus<AppTypes extends YggdrasilAppTypes> extends YggdrasilClientStatus {    
-    constructor(ygg: YggdrasilContext<AppTypes>, status: number, statusCode: string, statusMessage?: string) {
-        super(status, statusCode, statusMessage);
+export class YggdrasilServerStatus<AppTypes extends YggdrasilAppTypes> extends YggdrasilStatus<AppTypes["statusCtx"]> {
+    constructor(ygg: YggdrasilServerContext<AppTypes>, status: number, statusCode: string, messageOrOptions?: string | YggdrasilStatusOptions<AppTypes["statusCtx"]>) {
+        super(status, statusCode, messageOrOptions);
 
         this.#ygg = ygg;
     }
 
-    #ygg: YggdrasilContext<AppTypes>;
+    #ygg: YggdrasilServerContext<AppTypes>;
     get ygg() {
         return this.#ygg;
     }
diff --git a/yggdrasil/src/conduit.ts b/yggdrasil/src/conduit.ts
new file mode 100644
index 0000000..49de1fc
--- /dev/null
+++ b/yggdrasil/src/conduit.ts
@@ -0,0 +1,34 @@
+// Yggdrasil
+// Copyright (c) jottocraft 2025
+
+import type { YggdrasilAdditionalHeaders } from "~/YggdrasilServer";
+import { YggdrasilStatusJSON } from "~/YggdrasilStatus";
+
+export type YggdrasilConduitApi = {
+    client: any;
+    apiCtx?: any;
+};
+
+export type YggdrasilConduitRequest<ApiCtx, T extends unknown[]> = {
+    parameters: T;
+    context: ApiCtx;
+};
+
+export type YggdrasilConduitResponse<StatusCtx, T> = YggdrasilConduitResponseSuccess<T> | YggdrasilConduitResponseError<StatusCtx>;
+
+export type YggdrasilConduitResponseCommon = {
+    headers: YggdrasilAdditionalHeaders;
+};
+
+export type YggdrasilConduitResponseSuccess<T> = YggdrasilConduitResponseCommon & {
+    success: true;
+    data: T;
+};
+
+export type YggdrasilConduitResponseError<StatusCtx> = YggdrasilConduitResponseCommon & {
+    success: false;
+    status: YggdrasilStatusJSON<StatusCtx>;
+    debug?: {
+        stack?: string;
+    };
+};
\ No newline at end of file
diff --git a/yggdrasil/src/conduitClient.ts b/yggdrasil/src/conduitClient.ts
index 0fba96b..db7234a 100644
--- a/yggdrasil/src/conduitClient.ts
+++ b/yggdrasil/src/conduitClient.ts
@@ -1,52 +1,10 @@
 // Yggdrasil
 // Copyright (c) jottocraft 2024
 
-import { YggdrasilContext } from "~/context";
-import { YggdrasilClientStatus } from "~/YggdrasilStatus";
-import { YggdrasilAppTypes } from "~/YggdrasilServer";
-
-export type YggdrasilConduitAPI = {
-    client: any;
-    context: any;
-};
-
-// TODO: For now, the fact that YggdrasilConduitAPIClient requires the "this" context to be
-// of type YggdrasilContext is hidden. This is because it is difficult to redefine with
-// "this" set since YggdrasilContext and YggdrasilConduitAPIClient would both depend on each other.
-
-export type YggdrasilConduitAPIClient<ApiSpec extends YggdrasilConduitAPI> = () => ApiSpec["client"];
-export type YggdrasilConduitAPIContext<ApiSpec extends YggdrasilConduitAPI> = ApiSpec["context"];
-
-export type YggdrasilConduitRequest<ApiCtx, T extends unknown[]> = {
-    parameters: T;
-    context: ApiCtx;
-};
-
-export type YggdrasilConduitResponse<T> = YggdrasilConduitResponseSuccess<T> | YggdrasilConduitResponseError;
-
-export type YggdrasilConduitResponseCommon = {
-    headers: YggdrasilAdditionalHeaders;
-};
-
-export type YggdrasilAdditionalHeaders = {
-    set: { [headerName: string]: string; };
-    append: string[][];
-};
-
-export type YggdrasilConduitResponseSuccess<T> = YggdrasilConduitResponseCommon & {
-    success: true;
-    data: T;
-};
-
-export type YggdrasilConduitResponseError = YggdrasilConduitResponseCommon & {
-    success: false;
-    error: string;
-    message?: string;
-    debug?: {
-        stack?: string;
-        ygg?: Pick<YggdrasilContext<YggdrasilAppTypes>, "url" | "pathname" | "baseURL" | "additionalHeaders">;
-    };
-};
+import type { YggdrasilConduitApi, YggdrasilConduitRequest, YggdrasilConduitResponse } from "~/conduit";
+import { YggdrasilConduitContext } from "~/YggdrasilConduitServer";
+import type { YggdrasilAdditionalHeaders, YggdrasilAppTypes, YggdrasilServerContext } from "~/YggdrasilServer";
+import { jsonToYggdrasilStatus } from "~/YggdrasilStatus";
 
 export type YggdrasilConduitClientOptions = {
     /**
@@ -59,6 +17,8 @@
     baseURL: string;
 };
 
+export type YggdrasilConduitApiClient<ApiSpec extends YggdrasilConduitApi> = () => ApiSpec["client"];
+
 export type YggdrasilConduitServerSideClientOptions = YggdrasilConduitClientOptions & {
     /**
      * Set to true to allow the connected Conduit server to manipulate headers on the highest-level response.
@@ -66,31 +26,32 @@
     allowHeaderManipulation?: boolean;
 };
 
-async function doConduitRequest<ApiSpec extends YggdrasilConduitAPI>(path: string[], args: unknown[], apiCtx: ApiSpec["context"], options: YggdrasilConduitClientOptions): Promise<{
+async function doConduitRequest<ApiSpec extends YggdrasilConduitApi>(path: string[], params: unknown[], apiCtx: ApiSpec["apiCtx"], options: YggdrasilConduitClientOptions): Promise<{
     response: Response;
-    outcome: YggdrasilConduitResponse<unknown>;
+    outcome: YggdrasilConduitResponse<unknown, unknown>;
 }> {
     const fetcher = options.fetcher ?? fetch;
 
     const callURL = new URL(options.baseURL);
     callURL.pathname = callURL.pathname + path.join("/");
 
-    const request: YggdrasilConduitRequest<ApiSpec["context"], unknown[]> = {
-        parameters: args,
+    const request: YggdrasilConduitRequest<ApiSpec["apiCtx"], unknown[]> = {
+        parameters: params.map(param => (param === undefined ? "__jtc_ygg_undefined" : param)),
         context: apiCtx
     };
 
     const response = await fetcher(callURL.href, {
         method: "POST",
         headers: {
+            "Accept": "application/json+jottocraft-ygg-res",
             "Content-Type": "application/json+jottocraft-ygg-req"
         },
         body: JSON.stringify(request)
     });
 
-    let outcome: YggdrasilConduitResponse<unknown>;
+    let outcome: YggdrasilConduitResponse<unknown, unknown>;
     if (response.headers.get("Content-Type") !== "application/json+jottocraft-ygg-res") {
-        outcome = { success: false, error: "YGG_CONDUIT_BAD_RESPONSE", message: "An unexpected response was received from the backend server.", headers: { set: {}, append: [] } };
+        outcome = { success: false, status: { status: 500, code: "YGG_BAD_API_RESPONSE", message: "An unexpected response was received from the backend server." }, headers: { set: {}, append: [] } };
     } else {
         outcome = await response.json();
     }
@@ -101,8 +62,8 @@
 /**
  * Creates a client for calling Yggdrasil Server Conduit-powered APIs from another Yggdrasil Server-powered web or API server.
  */
-export function createConduitServerSideClient<ApiSpec extends YggdrasilConduitAPI>(apiCtx: ApiSpec["context"], options: YggdrasilConduitServerSideClientOptions): YggdrasilConduitAPIClient<ApiSpec> {
-    return function conduitServerSideClient(this: YggdrasilContext<YggdrasilAppTypes>): ApiSpec["client"] {
+export function createConduitServerSideClient<ApiSpec extends YggdrasilConduitApi>(apiCtx: ApiSpec["apiCtx"], options: YggdrasilConduitServerSideClientOptions): YggdrasilConduitApiClient<ApiSpec> {
+    return function conduitServerSideClient(this: YggdrasilServerContext<YggdrasilAppTypes> | YggdrasilConduitContext<YggdrasilAppTypes, ApiSpec>): ApiSpec["client"] {
         const createAppFn = (path: string[]) => {
             return new Proxy(async (...args: unknown[]) => {
                 const { response, outcome } = await doConduitRequest(path, args, apiCtx, options);
@@ -123,7 +84,7 @@
                 if (outcome.success) {
                     return outcome.data;
                 } else {
-                    throw this.status(response.status, outcome.error, outcome.message);
+                    throw jsonToYggdrasilStatus(outcome.status);
                 }
             }, {
                 get(target, name: string) {
@@ -139,22 +100,25 @@
 /**
  * Creates a client for calling Yggdrasil Server Conduit-powered APIs from a client application.
  */
-export function createConduitClientSideClient<ApiSpec extends YggdrasilConduitAPI>(apiCtx: ApiSpec["context"], options: YggdrasilConduitClientOptions): YggdrasilConduitAPIClient<ApiSpec> {
-    const createAppFn = (path: string[]) => {
-        return new Proxy(async (...args: unknown[]) => {
-            const { response, outcome } = await doConduitRequest(path, args, apiCtx, options);
+export function createConduitClientSideClient<ApiSpec extends YggdrasilConduitApi>(apiCtx: ApiSpec["apiCtx"], options: YggdrasilConduitClientOptions): YggdrasilConduitApiClient<ApiSpec> {
+    // This nested function isn't technically necessary client-side, but it keeps the client-side and server-side clients consistent. 
+    return function conduitClientSideClient(): ApiSpec["client"] {
+        const createAppFn = (path: string[]) => {
+            return new Proxy(async (...args: unknown[]) => {
+                const { response, outcome } = await doConduitRequest(path, args, apiCtx, options);
 
-            if (outcome.success) {
-                return outcome.data;
-            } else {
-                throw new YggdrasilClientStatus(response.status, outcome.error, outcome.message);
-            }
-        }, {
-            get(target, name: string) {
-                return createAppFn([...path, name]);
-            }
-        });
+                if (outcome.success) {
+                    return outcome.data;
+                } else {
+                    throw jsonToYggdrasilStatus(outcome.status);
+                }
+            }, {
+                get(target, name: string) {
+                    return createAppFn([...path, name]);
+                }
+            });
+        }
+
+        return createAppFn([]) as ApiSpec["client"];
     }
-
-    return createAppFn([]) as ApiSpec["client"];
 }
\ No newline at end of file
diff --git a/yggdrasil/src/context.ts b/yggdrasil/src/context.ts
deleted file mode 100644
index 81dfe88..0000000
--- a/yggdrasil/src/context.ts
+++ /dev/null
@@ -1,90 +0,0 @@
-// Yggdrasil
-// Copyright (c) jottocraft 2024
-
-import { YggdrasilAdditionalHeaders, YggdrasilConduitAPI, YggdrasilConduitAPIContext } from "~/conduitClient";
-import { YggdrasilRouterRequestParams } from "~/YggdrasilRouter";
-import { YggdrasilAppTypes, YggdrasilServer } from "~/YggdrasilServer";
-import { YggdrasilStatus } from "~/YggdrasilStatus";
-
-export type YggdrasilServerContextOptions<AppTypes extends YggdrasilAppTypes> = {
-    /** True if debug information should be returned on the status pages. */
-    debug?: boolean;
-    /** 
-     * The base external URL handled by this server, without a trailing slash, e.g. https://jottocraft.com, https://jottocraft.com/app.
-     * All requests must have a pathname that's prefixed with the pathname of this base URL, or an error will be thrown.
-     * The host and scheme do not have to match, however, e.g. if using a reverse proxy.
-     * The case should match your normalization.lowercase setting.
-     */
-    baseURL?: string;
-    /**
-     * The base path used for Conduit API requests. This MUST be specified if you are using Conduit.
-     * This path IS case sensitive and will not be normalized.
-     * It must start and end with a slash.
-     * e.g. /, /conduit/, etc.
-     */
-    conduitBasePath?: string;
-    /** Configures URL path normalization. */
-    normalization?: {
-        /** True if paths should have trailing slashes, e.g. /page/ instead of /page. False if they should not. Undefined if normalization should not be performed. */
-        trailingSlash?: boolean;
-        /** True if paths should be all lowercase, e.g. /page instead of /Page or /PaGe. */
-        lowercase?: boolean;
-        /** True if a redirect should be performed if the normalized path does not match the actual requested path. */
-        redirect?: boolean;
-    };
-    /** A function you can implement to generate HTML status pages for a given YggdrasilStatus object. By default, a plaintext status page will be shown. */
-    generateHtmlStatusPage?: (e: YggdrasilStatus<AppTypes>) => Promise<Response>;
-};
-
-export type YggdrasilContext<AppTypes extends YggdrasilAppTypes> = YggdrasilServerContext<AppTypes> | YggdrasilRouterContext<AppTypes> | YggdrasilConduitContext<AppTypes, { client: unknown; context: unknown; }>;
-
-export type YggdrasilServerContext<AppTypes extends YggdrasilAppTypes> = {
-    /** Constructs a YggdrasilStatus object based on the current context. */
-    status: (status: number, statusCode: string, statusMessage?: string) => YggdrasilStatus<AppTypes>;
-    /** Throws a YggdrasilStatus if the condition isn't met. */
-    assert: (condition: any, status: number, statusCode: string, statusMessage?: string) => asserts condition;
-    /** The Yggdrasil Server instance associated with this request. */
-    server: YggdrasilServer<AppTypes>;
-    /** The original request. */
-    request: Request;
-    /** The requested and normalized URLs. */
-    url: {
-        requested: URL;
-        normalized: URL;
-    };
-    /** The requested, normalized, and normalized relative (to the base URL) pathnames. */
-    pathname: {
-        requested: string;
-        normalized: string;
-        relative: string;
-    };
-    /** This server's base URL. */
-    baseURL?: URL;
-    /** Custom app context associated with this request. */
-    ctx: AppTypes["ctx"];
-    /** Yggdrasil Server options. */
-    options: YggdrasilServerContextOptions<AppTypes>;
-    /** Headers that will be set/appended to the final response. */
-    additionalHeaders: YggdrasilAdditionalHeaders;
-    /** Memoizes the result. */
-    memoize: <T>(key: string, task: () => Promise<T>) => Promise<T>;
-    /** Returns true if the requested task has been completed and its result is immediately available. */
-    hasMemoizedResult: (key: string) => boolean;
-    /** 
-     * Returns stored memoized results. Useful if you need to save/restore state without redoing memoized work. 
-     * Restore only via handleRequest's memoizedResults app option. The format of the returned value is opaque and subject to change.
-     */
-    getMemoizedResults: () => unknown;
-};
-
-export type YggdrasilRouterContext<AppTypes extends YggdrasilAppTypes> = YggdrasilServerContext<AppTypes> & {
-    /** The parameters set by variable segments in the router's path. */
-    params: YggdrasilRouterRequestParams;
-};
-
-export type YggdrasilConduitContext<AppTypes extends YggdrasilAppTypes, ApiSpec extends YggdrasilConduitAPI> = YggdrasilServerContext<AppTypes> & {
-    /** Headers that will be set/appended to the highest-level upstream request. */
-    upstreamHeaders: YggdrasilAdditionalHeaders;
-    /** Context from the Conduit request. */
-    apiCtx: YggdrasilConduitAPIContext<ApiSpec>;
-};
\ No newline at end of file
diff --git a/yggdrasil/src/index.ts b/yggdrasil/src/index.ts
index f511a3f..0c116ae 100644
--- a/yggdrasil/src/index.ts
+++ b/yggdrasil/src/index.ts
@@ -1,13 +1,12 @@
 // Yggdrasil
 // Copyright (c) jottocraft 2024
 
+export * from "~/conduit";
 export * from "~/conduitClient";
-export * from "~/context";
 export * from "~/YggdrasilConduitServer";
 export * from "~/YggdrasilRouter";
 export * from "~/YggdrasilServer";
 export * from "~/YggdrasilSpacer";
 export * from "~/YggdrasilStatus";
 
-export * from "~/util/applyHeaders";
 export * from "~/util/generateStatusPage";
\ No newline at end of file
diff --git a/yggdrasil/src/util/applyHeaders.ts b/yggdrasil/src/util/applyHeaders.ts
deleted file mode 100644
index 27b0bd8..0000000
--- a/yggdrasil/src/util/applyHeaders.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-// Yggdrasil
-// Copyright (c) jottocraft 2024
-
-import { YggdrasilAdditionalHeaders } from "~/conduitClient";
-
-export function applyHeaders(response: Response, additionalHeaders: YggdrasilAdditionalHeaders) {
-    for (const name in additionalHeaders.set) {
-        response.headers.set(name, additionalHeaders.set[name]);
-    }
-
-    for (const [name, value] of additionalHeaders.append) {
-        response.headers.append(name, value);
-    }
-}
\ No newline at end of file
diff --git a/yggdrasil/src/util/generateStatusPage.ts b/yggdrasil/src/util/generateStatusPage.ts
index 6304c80..c9a7172 100644
--- a/yggdrasil/src/util/generateStatusPage.ts
+++ b/yggdrasil/src/util/generateStatusPage.ts
@@ -1,53 +1,28 @@
 // Yggdrasil
 // Copyright (c) jottocraft 2024
 
-import { YggdrasilConduitResponseError } from "~/conduitClient";
-import { YggdrasilAppTypes } from "~/YggdrasilServer";
+import type { YggdrasilAppTypes, YggdrasilServerContext } from "~/YggdrasilServer";
 import { YggdrasilStatus } from "~/YggdrasilStatus";
 
-export async function generateStatusPage<AppTypes extends YggdrasilAppTypes>(e: YggdrasilStatus<AppTypes>): Promise<Response> {
-    const accept = e.ygg?.request.headers.get("Accept");
+/**
+ * Generates a status page for an uncaught YggdrasilStatus exception.
+ */
+export async function generateStatusPage<AppTypes extends YggdrasilAppTypes>(ygg: YggdrasilServerContext<AppTypes>, e: YggdrasilStatus<unknown>): Promise<Response> {
+    const accept = ygg.request.headers.get("Accept");
 
-    if (accept === "application/json+jottocraft-ygg-res") {
-        return generateConduitErrorPage(e);
-    } else if (accept?.includes("application/json")) {
-        return generateJsonStatusPage(e);
-    } else if (accept?.includes("text/html") && e.ygg?.options.generateHtmlStatusPage) {
-        return e.ygg.options.generateHtmlStatusPage(e);
+    if (accept?.includes("application/json")) {
+        return generateJsonStatusPage(ygg, e);
+    } else if (accept?.includes("text/html") && ygg.options.generateHtmlStatusPage) {
+        return ygg.options.generateHtmlStatusPage(ygg, e);
     } else {
-        return generatePlaintextStatusPage(e);
+        return generatePlaintextStatusPage(ygg, e);
     }
 }
 
-async function generateConduitErrorPage<AppTypes extends YggdrasilAppTypes>(e: YggdrasilStatus<AppTypes>): Promise<Response> {
-    const result: YggdrasilConduitResponseError = {
-        success: false,
-        error: e.statusCode,
-        message: e.statusMessage,
-        headers: "upstreamHeaders" in e.ygg ? e.ygg.upstreamHeaders : { set: {}, append: [] }
-    };
-
-    if (e.ygg.options.debug) {
-        result.debug = {
-            stack: e.stack,
-            ygg: {
-                url: e.ygg.url,
-                pathname: e.ygg.pathname,
-                baseURL: e.ygg.baseURL,
-                additionalHeaders: e.ygg.additionalHeaders
-            }
-        };
-    }
-    
-    return new Response(JSON.stringify(result), {
-        status: e.status,
-        headers: {
-            "Content-Type": "application/json+jottocraft-ygg-res"
-        }
-    });
-}
-
-async function generateJsonStatusPage<AppTypes extends YggdrasilAppTypes>(e: YggdrasilStatus<AppTypes>): Promise<Response> {
+/**
+ * Generates a JSON status page for an uncaught YggdrasilStatus exception.
+ */
+async function generateJsonStatusPage<AppTypes extends YggdrasilAppTypes>(ygg: YggdrasilServerContext<AppTypes>, e: YggdrasilStatus<unknown>): Promise<Response> {
     return new Response(JSON.stringify({
         success: false,
         status: e.status,
@@ -61,7 +36,10 @@
     });
 }
 
-async function generatePlaintextStatusPage<AppTypes extends YggdrasilAppTypes>(e: YggdrasilStatus<AppTypes>): Promise<Response> {
+/**
+ * Generates a human-readable plaintext status page for an uncaught YggdrasilStatus exception.
+ */
+async function generatePlaintextStatusPage<AppTypes extends YggdrasilAppTypes>(ygg: YggdrasilServerContext<AppTypes>, e: YggdrasilStatus<unknown>): Promise<Response> {
     return new Response(`Error ${e.status} ${e.statusCode}${e.statusMessage ? ": " + e.statusMessage : ""}`, {
         status: e.status,
         headers: {