Add initial alpha prototype version
diff --git a/.gitignore b/.gitignore
index 07a883a..6c41ee7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,6 @@
 !.yarn/versions
 
 tsconfig.tsbuildinfo
-/lib
+lib
 
 .wrangler
\ No newline at end of file
diff --git a/demo/package.json b/demo/package.json
index e301413..e4465d1 100644
--- a/demo/package.json
+++ b/demo/package.json
@@ -6,6 +6,9 @@
         "start": "wrangler dev"
     },
     "dependencies": {
+        "@cloudflare/workers-types": "^4.20240821.1",
+        "@jottocraft/yggdrasil": "workspace:*",
+        "typescript": "^5.5.4",
         "wrangler": "^3.74.0"
     }
 }
diff --git a/demo/src/DemoAPI.ts b/demo/src/DemoAPI.ts
new file mode 100644
index 0000000..defdbe2
--- /dev/null
+++ b/demo/src/DemoAPI.ts
@@ -0,0 +1,17 @@
+// 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.
+
+export type DemoAPI = YggdrasilConduitAPI<{
+    /** The first argument to YggdrasilConduitAPI defines your API functions available to the client. */
+    hello: (time: "morning" | "evening" | "afternoon" | "night") => Promise<string>;
+    goodbye: () => Promise<string>;
+}, {
+    /** The second argument defines common context parameters passed to all Conduit API calls. */
+    name: string;
+}>;
\ No newline at end of file
diff --git a/demo/src/api/goodbye.ts b/demo/src/api/goodbye.ts
new file mode 100644
index 0000000..3b3cb6f
--- /dev/null
+++ b/demo/src/api/goodbye.ts
@@ -0,0 +1,10 @@
+// Yggdrasil
+// Copyright (c) jottocraft 2024. All rights reserved.
+
+import { DemoServer } from "../server";
+
+export const goodbye = DemoServer.defineAPI().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 + "!";
+});
\ No newline at end of file
diff --git a/demo/src/api/hello.ts b/demo/src/api/hello.ts
new file mode 100644
index 0000000..1969727
--- /dev/null
+++ b/demo/src/api/hello.ts
@@ -0,0 +1,8 @@
+// Yggdrasil
+// Copyright (c) jottocraft 2024. All rights reserved.
+
+import { DemoServer } from "../server";
+
+export const hello = DemoServer.defineAPI().hello(async (ygg, time) => {
+    return "Good " + time + " " + ygg.apiCtx.name + "!";
+});
\ No newline at end of file
diff --git a/demo/src/api/index.ts b/demo/src/api/index.ts
new file mode 100644
index 0000000..9da0086
--- /dev/null
+++ b/demo/src/api/index.ts
@@ -0,0 +1,5 @@
+// Yggdrasil
+// Copyright (c) jottocraft 2024
+
+export * from "./goodbye";
+export * from "./hello";
\ No newline at end of file
diff --git a/demo/src/env.d.ts b/demo/src/env.d.ts
new file mode 100644
index 0000000..18773be
--- /dev/null
+++ b/demo/src/env.d.ts
@@ -0,0 +1,9 @@
+// Yggdrasil
+// Copyright (c) jottocraft 2024
+
+// This file declares any global environment variables that
+// the demo server may use.
+
+declare type DemoEnv = {
+    SOME_ENV_VAR: string;
+};
\ No newline at end of file
diff --git a/demo/src/index.js b/demo/src/index.js
deleted file mode 100644
index e4b934d..0000000
--- a/demo/src/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-// yggdrasil
-// Copyright (c) jottocraft 2024
-
-export default {
-    async fetch(request, env, ctx) {
-        const url = new URL(request.url);
-        console.log(`Hello ${navigator.userAgent} at path ${url.pathname}!`);
-
-        return new Response("Hello world", {
-            status: 200
-        });
-    }
-};
diff --git a/demo/src/index.ts b/demo/src/index.ts
new file mode 100644
index 0000000..17bb99f
--- /dev/null
+++ b/demo/src/index.ts
@@ -0,0 +1,47 @@
+// Yggdrasil
+// Copyright (c) jottocraft 2024
+
+import { YggdrasilConduitServer, YggdrasilServerContext, YggdrasilRouter, YggdrasilStatus, createConduitServerSideClient } from "@jottocraft/yggdrasil";
+
+import { DemoServer } from "./server";
+import * as routes from "./routes";
+import * as api from "./api";
+import { DemoAPI } from "./DemoAPI";
+
+const DemoRouter = new YggdrasilRouter(DemoServer, routes);
+const DemoConduitServer = new YggdrasilConduitServer(DemoServer, api);
+
+export default {
+    async fetch(request: Request, env: DemoEnv, ctx: ExecutionContext): Promise<Response> {
+        return DemoServer.handleRequest(request, async (ygg) => {
+            if (ygg.pathname.relative === "/") throw ygg.status(200, "DEMO_OK", "This is a sample error.");
+
+            try {
+                return await DemoConduitServer.handleRequest(ygg);
+            } catch(e) {
+                if (!(e instanceof YggdrasilStatus) || (e.status !== 404)) throw e;
+            }
+
+            try {
+                return await DemoRouter.handleRequest(ygg);
+            } catch(e) {
+                if (!(e instanceof YggdrasilStatus) || (e.status !== 404)) throw e;
+            }
+
+            throw ygg.status(404, "INVALID_PATH", "Nobody was able to handle your request :(");
+        }, {
+            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) })
+        }, {
+            debug: true,
+            baseURL: "https://yggdrasil.ns.jottocraft.com/demo",
+            conduitBasePath: "/demo/conduit/",
+            normalization: {
+                trailingSlash: false,
+                lowercase: true,
+                redirect: true
+            }
+        });
+    }
+};
diff --git a/demo/src/routes/abc.ts b/demo/src/routes/abc.ts
new file mode 100644
index 0000000..a7e9bd1
--- /dev/null
+++ b/demo/src/routes/abc.ts
@@ -0,0 +1,8 @@
+// Yggdrasil
+// Copyright (c) jottocraft 2024
+
+import { DemoServer } from "../server";
+
+export const abc = DemoServer.defineRoute("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
new file mode 100644
index 0000000..c8417cc
--- /dev/null
+++ b/demo/src/routes/def.ts
@@ -0,0 +1,10 @@
+// Yggdrasil
+// Copyright (c) jottocraft 2024
+
+import { YggdrasilStatus } from "@jottocraft/yggdrasil";
+
+import { DemoServer } from "../server";
+
+export const def = DemoServer.defineRoute("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
new file mode 100644
index 0000000..22ffba2
--- /dev/null
+++ b/demo/src/routes/goodbye.ts
@@ -0,0 +1,9 @@
+// Yggdrasil
+// Copyright (c) jottocraft 2024
+
+import { DemoServer } from "../server";
+
+export const goodbye = DemoServer.defineRoute("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
new file mode 100644
index 0000000..900cdb6
--- /dev/null
+++ b/demo/src/routes/hij.ts
@@ -0,0 +1,8 @@
+// Yggdrasil
+// Copyright (c) jottocraft 2024
+
+import { DemoServer } from "../server";
+
+export const hij = DemoServer.defineRoute("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/index.ts b/demo/src/routes/index.ts
new file mode 100644
index 0000000..3aba3b8
--- /dev/null
+++ b/demo/src/routes/index.ts
@@ -0,0 +1,7 @@
+// Yggdrasil
+// Copyright (c) jottocraft 2024
+
+export * from "./abc";
+export * from "./def";
+export * from "./goodbye";
+export * from "./hij";
\ No newline at end of file
diff --git a/demo/src/server.ts b/demo/src/server.ts
new file mode 100644
index 0000000..fd8ed6f
--- /dev/null
+++ b/demo/src/server.ts
@@ -0,0 +1,15 @@
+// Yggdrasil
+// Copyright (c) jottocraft 2024
+
+// 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";
+
+import { DemoAPI } from "./DemoAPI";
+
+export const DemoServer = new YggdrasilServer<{
+    env: DemoEnv;
+    ctx: ExecutionContext;
+    conduit: YggdrasilConduitAPIClient<DemoAPI>;
+}, DemoAPI>();
\ No newline at end of file
diff --git a/demo/tsconfig.json b/demo/tsconfig.json
new file mode 100644
index 0000000..10c1151
--- /dev/null
+++ b/demo/tsconfig.json
@@ -0,0 +1,17 @@
+{
+	"compilerOptions": {
+		"noEmit": true,
+		"module": "ESNext",
+		"moduleResolution": "Bundler",
+		"lib": ["esnext"],
+		"strict": true,
+		"types": ["@cloudflare/workers-types"],
+		"esModuleInterop": true,
+		"skipLibCheck": true,
+		"target": "es2022",
+		"allowJs": true,
+		"moduleDetection": "force",
+		"isolatedModules": true
+	},
+	"exclude": ["node_modules", "dist", "test"]
+}
\ No newline at end of file
diff --git a/demo/wrangler.toml b/demo/wrangler.toml
index f3d2799..391444b 100644
--- a/demo/wrangler.toml
+++ b/demo/wrangler.toml
@@ -1,6 +1,9 @@
 name = "yggdrasil-demo"
-main = "src/index.js"
+main = "src/index.ts"
 compatibility_date = "2024-09-03"
 
 account_id = "17174d3fc7098a664b04fb3c4c4ec65c"
-workers_dev = false
\ No newline at end of file
+workers_dev = false
+
+[vars]
+SOME_ENV_VAR = "This is a demo environment variable"
\ No newline at end of file
diff --git a/docs/.gitignore b/docs/.gitignore
index b2d6de3..72027a2 100644
--- a/docs/.gitignore
+++ b/docs/.gitignore
@@ -3,6 +3,7 @@
 
 # Production
 /build
+/dist
 
 # Generated files
 .docusaurus
diff --git a/docs/docs/features/ConduitSubrequests.png b/docs/docs/features/ConduitSubrequests.png
new file mode 100644
index 0000000..a9149d0
--- /dev/null
+++ b/docs/docs/features/ConduitSubrequests.png
Binary files differ
diff --git a/docs/docs/features/_category_.json b/docs/docs/features/_category_.json
new file mode 100644
index 0000000..45de7f0
--- /dev/null
+++ b/docs/docs/features/_category_.json
@@ -0,0 +1,6 @@
+{
+    "position": 2,
+    "label": "Features",
+    "collapsible": true,
+    "collapsed": false
+}
\ No newline at end of file
diff --git a/docs/docs/features/conduit.md b/docs/docs/features/conduit.md
new file mode 100644
index 0000000..b8dc52c
--- /dev/null
+++ b/docs/docs/features/conduit.md
@@ -0,0 +1,205 @@
+---
+sidebar_position: 4
+---
+
+# Conduit
+
+Whenever you setup an API sever, you also need to setup a client
+to consume the interfaces you expose. Yggdrasil Server Conduit allows
+you to simply define functions that take and return JSON-serializable
+data, then it handles the transit for you. Conduit provides options for
+constructing a type-safe TypeScript client, providing your own fetcher, and more.
+
+## Requests and subrequests
+
+Conduit supports both client-to-server requests and server-to-server requests.
+The latter case is useful particularly for modern server architectures that may
+need to make many subrequests to different internal services in order
+to respond to a single external request. Consider the following example:
+
+![A diagram showing a client PC making a request that triggers a Yggdrasil Conduit request and subrequest.](./ConduitSubrequests.png)
+
+The above example illustrates how a To-Do application might be setup to
+respond to requests. When the user loads the To-Do application 
+(the "Initial Request" in the diagram), the application needs to get the
+user's tasks in order to render a webpage with their data. To get the user's
+tasks, the frontend server makes a Conduit request to an internal API
+called `getMyTasks()`. The `getMyTasks()` API needs to authenticate the user
+in order to load their data, so it makes a Conduit request to an internal
+API called `authConsumer()`. Thus, the single request to the frontend
+server triggers multiple subrequests internally.
+
+Conduit makes these types of configurations easy by providing the following
+server-to-server features:
+
+- When an uncaught `YggdrasilStatus` error is thrown from a Conduit request, it will be passed up and thrown in the client as well, allowing deeply nested errors to automatically "bubble up" to the end user.
+  - In the example above, this means that if `authConsumer()` throws a `YggdrasilStatus`, it will be thrown all the way up to the frontend server's Conduit client.
+- Conduit APIs are able to add headers to the final response. This is implemented by passing the headers up through Conduit response data. When a non-Conduit request is found, the headers are added to the actual response.
+  - In the example above, this allows `authConsumer()` to append a `Set-Cookie` header to the frontend's response rotate the user's tokens.
+- Conduit APIs can define a set of context parameters common to all APIs. The required context is provided by the client when constructing the Conduit client and will be passed to all APIs called without the need to explicitly include them in each function call.
+  - In the example above, this allows the authentication server to expect context parameters such as `cookie`, `user_agent`, and `ip_address`. This allows the authentication server to read session cookies and perform audit logging.
+
+## Assumptions and limitations
+
+- Your API must be defined as an object, optionally including nested objects, that can only include valid API functions.
+- Each argument in your API's functions must be JSON-serializable.
+- Your API's functions must be asynchronous (return a Promise).
+- Your API function and nested object names must be safe to include in URL paths.
+- Conduit type safety only occurs at compile time through TypeScript. 
+  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.
+
+## Implementation
+
+### Define your API
+
+To use Conduit's type safety features, you'll need to define your
+API's types in a file that can be imported from the client. This may
+involve putting it in an NPM package, git submodule, etc.
+
+```ts title="my-shared-library/conduit.ts"
+import { YggdrasilConduitAPI } from "@jottocraft/yggdrasil";
+
+// This defines the type of your Conduit API.
+export type MyAPI = YggdrasilConduitAPI<{
+    /** The first argument to YggdrasilConduitAPI defines your API functions available to the client. */
+    hello: (time: "morning" | "evening" | "afternoon" | "night") => Promise<string>;
+    goodbye: () => Promise<string>;
+}, {
+    /** The second argument defines common context parameters passed to all Conduit API calls. */
+    name: string;
+}>;
+
+// It's recommended to define the client options here to ensure consistency.
+// They can always be overridden if needed.
+export const myConduitClientOptions: YggdrasilConduitClientOptions = {
+    baseURL: "https://yggdrasil.ns.jottocraft.com/my-api/conduit/"
+};
+```
+
+### Add your API type to YggdrasilServer
+
+```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<AppCtx, MyAPI>();
+```
+
+### Implement your API
+
+Now, simply write functions that implement your API! Note that
+in your server-side implementation, a `YggdrasilConduitContext` object
+is added before your own arguments so you can utilize Yggdrasil
+Server features in your handlers. `YggdrasilConduitContext` extends
+`YggdrasilContext` with additional Conduit-specific features, such as
+the ability to add headers to the upstream request.
+
+```ts title="src/api/hello.ts"
+import { DemoServer } from "../server";
+
+export const hello = DemoServer.defineAPI().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.
+  ygg.upstreamHeaders.set["X-My-Header"] = "My-Value";
+
+  // Notice how `time` is a parameter, while `name` comes from the common Conduit API context.
+  return "Good " + time + " " + ygg.apiCtx.name + "!";
+});
+```
+
+### Re-export all the routes from a single file
+
+```ts title="src/api/index.ts"
+export * from "./hello";
+// repeat the above for each route file in your project
+```
+
+### Handle requests
+
+Once you have your API handlers defined, simply call YggdrasilConduitServer.handleRequest
+to serve your API:
+
+```ts title="src/index.ts"
+import * as api from "./api";
+
+// This should ideally be defined outside your request handler
+const DemoConduitServer = new YggdrasilConduitServer(DemoServer, api);
+
+// Additional required setup omitted for brevity
+
+// Inside DemoServer.handleRequest:
+return DemoConduitServer.handleRequest(ygg);
+```
+
+## Call your API from a client
+
+### From another Yggdrasil Server instance
+
+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.
+See the "Context" documentation for more details.
+
+```ts title="src/index.ts"
+import { MyAPI } from "my-shared-library/conduit.ts";
+import { createConduitServerSideClient } from "@jottocraft/yggdrasil";
+
+AnotherDemoServer.handleRequest(request, async (ygg) => {
+  // Call the Conduit API
+  const greeting = await ygg.ctx().conduit().hello("morning");
+
+  // Do whatever you want based on the outcome
+}, {
+  // 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
+    name: "jottocraft" 
+  }, { 
+    // Options (baseURL is required)
+    baseURL: "https://yggdrasil.ns.jottocraft.com/demo/conduit/"
+  })
+
+  // The rest of your app's context
+}, {
+  // YggdrasilServer options
+});
+```
+
+### From an external source
+
+Call `createConduitClientSideClient()` to create a client
+for use outside a Yggdrasil Server context. When you call a
+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 { createConduitClientSideClient } from "@jottocraft/yggdrasil";
+
+async function fetchConduitData() {
+  const conduit = createConduitClientSideClient<MyAPI>({
+    // Common context about this request to send to MyAPI
+    name: "jottocraft" 
+  }, { 
+    // Options (baseURL is required)
+    baseURL: "https://yggdrasil.ns.jottocraft.com/demo/conduit/"
+  });
+
+  const greeting = await conduit.hello("morning");
+
+  // Do whatever you want based on the outcome
+}
+```
\ No newline at end of file
diff --git a/docs/docs/features/context.md b/docs/docs/features/context.md
new file mode 100644
index 0000000..dded0e8
--- /dev/null
+++ b/docs/docs/features/context.md
@@ -0,0 +1,50 @@
+---
+sidebar_position: 1
+---
+
+# Context
+
+To make it easy to pass state between functions responding to a request,
+Yggdrasil Server packages the original request, normalized parameters, options,
+your app's context, utilities, and more in a single, shared `YggdrasilServerContext` object
+(commonly named `ygg`).
+
+Some Yggdrasil Server features (Yggdrasil Server Router and Conduit) have their own
+state that they provide to you via an extended version of the `YggdrasilServerContext`.
+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).
+
+Please observe the following practices to avoid inadvertently breaking Yggdrasil Server's context:
+
+## 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.
+
+## Calling context-based functions
+
+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.
+
+## Using your own context-based functions
+
+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 (this is why `ygg.ctx` is
+a function instead of an object). 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
diff --git a/docs/docs/features/errors.md b/docs/docs/features/errors.md
new file mode 100644
index 0000000..cc0a519
--- /dev/null
+++ b/docs/docs/features/errors.md
@@ -0,0 +1,75 @@
+---
+sidebar_position: 2
+---
+
+# Error handling
+
+Yggdrasil Server has a built-in error handling mechanism. To use it, simply throw
+a `YggdrasilStatus` object from inside a request handler:
+
+```ts
+throw new YggdrasilStatus(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:
+
+```ts
+ygg.assert(user.isAuthenticated, 401, "AUTH_REQUIRED", "You need to be signed in to load this page.");
+```
+
+## YggdrasilStatus parameters
+
+The `YggdrasilStatus` constructor and `ygg.assert` function share a common set of parameters.
+Those parameters are:
+
+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
+   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.
+
+## Built-in errors
+
+Yggdrasil Server itself may throw a `YggdrasilStatus` if your configuration causes an
+unworkable state. When Yggdrasil Server itself throws an error, it will use an status
+code prefixed with `YGG_`. Please don't prefix any of your own status codes with `YGG_`.
+
+Just because one of these errors is thrown doesn't mean your app is badly configured, however.
+For example, if your server's base URL is in a subdirectory, and it's deployed behind a
+reverse proxy that routes other directories elsewhere, you may receive a 
+`YGG_BASE_URL_MISMATCH` when you try to load the root path directly (without going through
+the proxy), but this would be expected since your reverse proxy would otherwise
+route that path somewhere else on the user-facing URL.
+
+### List of built-in errors
+
+| HTTP status code | Yggdrasil status code | Description |
+| - | - | - |
+| 404 | `YGG_BASE_URL_MISMATCH` | Thrown when your base URL indicates that your server is deployed in a sub-directory (e.g. `/app`), but the requested URL does not use that prefix. |
+| 404 | `YGG_ROUTE_NOT_FOUND` | Thrown when YggdrasilRouter can't find a route that matches the request's path. |
+| 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_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
+
+When a `YggdrasilStatus` object is thrown and uncaught by your handler, Yggdrasil Server will
+return a Response with the corresponding HTTP status code and a generated status page:
+
+| 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`. |
+| `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. |
+
+## Uncaught errors
+
+The bulk of this document details how Yggdrasil Server handles uncaught `YggdrasilStatus`
+objects to generate a status page. Please keep in mind that this behavior **only applies
+to `YggdrasilStatus` objects**. Any other errors that happen in your code will remain
+uncaught, and it's up to you to determine how those should be handled.
\ No newline at end of file
diff --git a/docs/docs/features/router.md b/docs/docs/features/router.md
new file mode 100644
index 0000000..653def8
--- /dev/null
+++ b/docs/docs/features/router.md
@@ -0,0 +1,147 @@
+---
+sidebar_position: 3
+---
+
+# Router
+
+Yggdrasil Server includes a simple router. With the router, you can
+register different handlers for each URL path and method combination
+you support. Then, Yggdrasil Server will call the appropriate handler
+when requests come in.
+
+## Implementation
+
+### Setup routes
+
+To define routes, simply use YggdrasilServer.defineRoute to create a
+route object. Then, pass all of your route objects into YggdrasilRouter's
+constructor to register them.
+
+Please note that route handlers are passed a YggdrasilRouterContext,
+which extends YggdrasilContext with additional context about your routing.
+
+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/routes/hello.ts"
+import { DemoServer } 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) => {
+    return new Response("Hello world!", { status: 200 });
+});
+```
+
+### Re-export all the routes from a single file
+
+```ts title="src/routes/index.ts"
+export * from "./hello";
+// repeat the above for each route file in your project
+```
+
+### Handle requests
+
+Once you have your router setup, simply call YggdrasilRouter.handleRequest
+to use it:
+
+```ts title="src/index.ts"
+import * as routes from "./routes";
+
+// This should ideally be defined outside your request handler
+const DemoRouter = new YggdrasilRouter(DemoServer, routes);
+
+// Additional required setup omitted for brevity
+
+// Inside DemoServer.handleRequest:
+return DemoRouter.handleRequest(ygg);
+```
+
+## Routing
+
+When you define a route, you need to specify a method and path. Requests
+that match the defined method and path will be handled by the route.
+
+### HTTP method
+
+The method can be any HTTP method, or * to match all methods.
+
+### Path
+
+#### Normalization
+
+Incoming requests match paths based on their normalized, relative paths.
+Paths must be exactly equal to match.
+
+For example, if you have no normalization configured, a route
+path `/abc` will match requests made to `/abc` but not `/ABC`, `/abc/`, or `/ABC/`.
+If you have lowercase normalization and trailing slash removal enabled, `/abc`
+will match requests made to `/abc`, `/ABC`, `/abc/`, and `/ABC/`.
+
+However, please keep in mind that your route configuration is assumed to already
+be normalized. For example, if you have lowercase normalization enabled, and
+define a route with path `/ABC`, it will never match, because all requests
+will have their paths converted to lowercase before matching.
+
+Since routes use the relative path, a route path `/abc` will match
+requests made to `/demo/abc` if the base url is `https://yggdrasil.jottocraft.com/demo`,
+for example.
+
+#### Variable segments
+
+It is possible to make segments variable so they can match any slug.
+To do this, simply prefix the segment with a dollar sign (`$`).
+
+For example, to match any arbitrary ID in the path `/posts/<any arbitrary ID>`,
+define the route path as `/posts/$postID`. Then, when handling the request,
+you can retrieve the post ID as `ygg.params.postID`.
+
+Variable segment names MUST be consistent between routes, or the
+behavior of which name will be used is undefined. For example, if you have
+routes `/posts/$postID` and `/posts/$PostID/likes`, the name of the entry
+in the `ygg.params` object is undefined.
+
+### Multiple matches
+
+YggdrasilRouter does not check
+every possible way to match a request. This creates the potential for
+requests to unexpectedly fail to match.
+
+#### Same method and path
+
+If you define multiple routes with the exact same method and path, the behavior
+for which will be called is undefined.
+
+#### Different method, same path
+
+If you define multiple routes with different methods, but the same path,
+YggdrasilRouter will call the route that matches the specific method
+used in the request. If no route is defined for the specific method,
+it will call the route that can match any method (*) if it exists.
+
+#### Different paths
+
+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.
+
+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`.
+A request to `/posts/specialPost/likes` will fail to match because Yggdrasil Router
+sees and matches `posts` and `specialPost`, but doesn't see any `likes` segment
+under `specialPost`. It will not consider the possibility that `$postId` could
+be used to match `specialPost` to locate the intended route.
+
+YggdrasilRouter matches the path before the method, so if you have routes
+`GET /posts/$postId`, `POST /posts/$postId`, and `GET /posts/specialPost`,
+a request `POST /posts/specialPost` will fail because it took the literal
+path instead of the variable path, and there isn't a `POST` handler on the
+literal path.
+
+## Errors
+
+YggdrasilRouter can throw YggdrasilStatus objects when a route can't
+be matched, an invalid method is used, etc. Please see the "Error handling"
+page for documentation of these internal errors.
\ No newline at end of file
diff --git a/docs/docs/index.md b/docs/docs/index.md
index 64de153..0511c35 100644
--- a/docs/docs/index.md
+++ b/docs/docs/index.md
@@ -2,6 +2,70 @@
 sidebar_position: 1
 ---
 
-# Hello world!
+# Getting started
 
-TODO: Write the docs
\ No newline at end of file
+Welcome to Yggdrasil Server! Yggdrasil Server is a modern JavaScript library
+for managing context, errors, and routing when handling and responding to
+HTTP requests.
+
+## Quickstart
+
+### Step 1: Install Yggdrasil Server
+
+```bash npm2yarn
+npm install @jottocraft/yggdrasil --save
+```
+
+
+### Step 2: Construct a YggdrasilServer instance
+
+```ts title="src/server.ts"
+import { YggdrasilServer } from "@jottocraft/yggdrasil";
+
+// Any arbitrary custom data to pass to your request handlers
+// e.g. environment variables, database bindings, etc.
+export type AppCtx = {
+    env: DemoEnv;
+    ctx: ExecutionContext;
+};
+
+export const DemoServer = new YggdrasilServer<AppCtx>();
+```
+
+### Step 3: Handle requests
+
+```ts title="src/index.ts"
+import { DemoServer } from "./server";
+
+export default {
+    async fetch(request: Request, env: DemoEnv, ctx: ExecutionContext) {
+        return DemoServer.handleRequest(request, async (ygg) => {
+            // Yggdrasil Server uses YggdrasilStatus objects to indicate errors
+            // that you can either catch yourself, or ignore to let Yggdrasil Server
+            // generate an error page for you.
+            if (ygg.pathname !== "/") throw ygg.status(404, "INVALID_PATHNAME");
+
+            // You can do whatever you want to handle the request here.
+
+            return new Response("Hello World!", {
+                status: 200
+            });
+        },
+        // Your custom request context, available as ygg.ctx() in request handlers.
+        {
+            env, ctx
+        }, 
+        // Yggdrasil Server options. These are specified here rather than in
+        // the YggdrasilServer object to support multi-tenancy.
+        {
+            debug: true
+        });
+    }
+};
+```
+
+## Explore more features
+
+The quickstart example shows how to get up and running with the basic
+functionality of Yggdrasil Server. To continue exploring more powerful
+features, head to the "Features" section in the sidebar.
\ No newline at end of file
diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js
index bba0588..b7bfe60 100644
--- a/docs/docusaurus.config.js
+++ b/docs/docusaurus.config.js
@@ -9,7 +9,7 @@
 /** @type {import('@docusaurus/types').Config} */
 const config = {
     title: 'Yggdrasil Server',
-    tagline: 'A flexible JavaScript router.',
+    tagline: 'A simple and flexible TypeScript library for streamlining web request handling.',
     favicon: '/docs/favicon.png',
 
     // Set the production url of your site here
@@ -30,7 +30,7 @@
     },
 
     presets: [
-        ["classic", { docs: { routeBasePath: '/' }, blog: false, theme: { customCss: './src/css/custom.css' } }]
+        ["classic", { docs: { routeBasePath: '/', remarkPlugins: [require("@docusaurus/remark-plugin-npm2yarn")] }, blog: false, theme: { customCss: './src/css/custom.css' } }]
     ],
 
     themeConfig:
@@ -54,7 +54,13 @@
         },
         prism: {
             theme: prismThemes.github,
-            darkTheme: prismThemes.dracula
+            darkTheme: prismThemes.dracula,
+            additionalLanguages: ["bash"]
+        },
+        announcementBar: {
+            id: "yggdrasil_alpha",
+            content: "Yggdrasil Server is currently in alpha and is subject to change drastically. Please proceed at your own risk.",
+            isCloseable: false
         }
     }
 };
diff --git a/docs/package.json b/docs/package.json
index acdf220..2403376 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -4,9 +4,9 @@
   "scripts": {
     "docusaurus": "docusaurus",
     "start": "docusaurus start",
-    "build": "docusaurus build",
+    "build": "rmdir /s /q dist && docusaurus build && mkdir dist && move build dist && move dist\\build dist\\docs",
     "swizzle": "docusaurus swizzle",
-    "deploy": "docusaurus deploy",
+    "deploy": "wrangler pages deploy dist --project-name yggdrasil-docs",
     "clear": "docusaurus clear",
     "serve": "docusaurus serve",
     "write-translations": "docusaurus write-translations",
@@ -15,6 +15,7 @@
   "dependencies": {
     "@docusaurus/core": "3.5.2",
     "@docusaurus/preset-classic": "3.5.2",
+    "@docusaurus/remark-plugin-npm2yarn": "^3.5.2",
     "@mdx-js/react": "^3.0.0",
     "clsx": "^2.0.0",
     "prism-react-renderer": "^2.3.0",
diff --git a/package.json b/package.json
index e241c02..51efab7 100644
--- a/package.json
+++ b/package.json
@@ -1,24 +1,10 @@
 {
-    "name": "@jottocraft/yggdrasil",
-    "license": "LGPL-2.1-only",
-    "author": "jottocraft <[email protected]>",
+    "name": "yggdrasil",
+    "private": true,
     "workspaces": [
         "demo",
-        "docs"
+        "docs",
+        "yggdrasil"
     ],
-    "scripts": {
-        "test": "echo \"Error: no test specified\" && exit 1",
-        "build": "npm run clean && tsc --build && tsc-alias",
-        "clean": "rimraf lib tsconfig.tsbuildinfo",
-        "start": "run-p dev:*",
-        "dev:ts": "tsc --build --watch",
-        "dev:ts-alias": "tsc-alias --watch"
-    },
-    "packageManager": "[email protected]",
-    "dependencies": {
-        "npm-run-all": "^4.1.5",
-        "rimraf": "^6.0.1",
-        "tsc-alias": "^1.8.10",
-        "typescript": "^5.5.4"
-    }
+    "packageManager": "[email protected]"
 }
diff --git a/src/YggdrasilContext.ts b/src/YggdrasilContext.ts
deleted file mode 100644
index 372c674..0000000
--- a/src/YggdrasilContext.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-// yggdrasil
-// Copyright (c) jottocraft 2024
-
-export class YggdrasilContext {
-
-};
\ No newline at end of file
diff --git a/src/YggdrasilRouter.ts b/src/YggdrasilRouter.ts
deleted file mode 100644
index e92b4ee..0000000
--- a/src/YggdrasilRouter.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-// yggdrasil
-// Copyright (c) jottocraft 2024
-
-export class YggdrasilRouter {
-
-};
\ No newline at end of file
diff --git a/src/YggdrasilServer.ts b/src/YggdrasilServer.ts
deleted file mode 100644
index 9bb73c8..0000000
--- a/src/YggdrasilServer.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-// yggdrasil
-// Copyright (c) jottocraft 2024
-
-export class YggdrasilServer {
-
-};
\ No newline at end of file
diff --git a/src/index.ts b/src/index.ts
deleted file mode 100644
index 360a179..0000000
--- a/src/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-// yggdrasil
-// Copyright (c) jottocraft 2024
-
-export * from "~/YggdrasilServer";
\ No newline at end of file
diff --git a/yarn.lock b/yarn.lock
index 468f7a8..a23bb63 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -206,6 +206,13 @@
   languageName: node
   linkType: hard
 
+"@alloc/quick-lru@npm:^5.2.0":
+  version: 5.2.0
+  resolution: "@alloc/quick-lru@npm:5.2.0"
+  checksum: 10c0/7b878c48b9d25277d0e1a9b8b2f2312a314af806b4129dc902f2bc29ab09b58236e53964689feec187b28c80d2203aff03829754773a707a8a5987f1b7682d92
+  languageName: node
+  linkType: hard
+
 "@ampproject/remapping@npm:^2.2.0":
   version: 2.3.0
   resolution: "@ampproject/remapping@npm:2.3.0"
@@ -1726,6 +1733,13 @@
   languageName: node
   linkType: hard
 
+"@cloudflare/workers-types@npm:^4.20240821.1":
+  version: 4.20240821.1
+  resolution: "@cloudflare/workers-types@npm:4.20240821.1"
+  checksum: 10c0/5abf7cfb4241ee7babd382807f6061ab4315c7703957673289238234a5e4ed7c24154afe8b3cda15c0e60ea52e4c2e44b3554a10e854f85a5f5ea2d5bf5cde46
+  languageName: node
+  linkType: hard
+
 "@colors/colors@npm:1.5.0":
   version: 1.5.0
   resolution: "@colors/colors@npm:1.5.0"
@@ -2123,6 +2137,19 @@
   languageName: node
   linkType: hard
 
+"@docusaurus/remark-plugin-npm2yarn@npm:^3.5.2":
+  version: 3.5.2
+  resolution: "@docusaurus/remark-plugin-npm2yarn@npm:3.5.2"
+  dependencies:
+    mdast-util-mdx: "npm:^3.0.0"
+    npm-to-yarn: "npm:^2.2.1"
+    tslib: "npm:^2.6.0"
+    unified: "npm:^11.0.3"
+    unist-util-visit: "npm:^5.0.0"
+  checksum: 10c0/a9a7f212e0fad41c9c74184259eca37a838b6637b382f4ddee47f533036c292b0d6bdfcde93d8d7bed259baf8d4a36c7dd1456bfeb8bde5c4d92d3b4c7a99db7
+  languageName: node
+  linkType: hard
+
 "@docusaurus/theme-classic@npm:3.5.2":
   version: 3.5.2
   resolution: "@docusaurus/theme-classic@npm:3.5.2"
@@ -2538,18 +2565,21 @@
   languageName: node
   linkType: hard
 
-"@jottocraft/yggdrasil@workspace:.":
+"@jottocraft/yggdrasil@workspace:*, @jottocraft/yggdrasil@workspace:yggdrasil":
   version: 0.0.0-use.local
-  resolution: "@jottocraft/yggdrasil@workspace:."
+  resolution: "@jottocraft/yggdrasil@workspace:yggdrasil"
   dependencies:
+    "@types/lodash": "npm:^4"
+    lodash: "npm:^4.17.21"
     npm-run-all: "npm:^4.1.5"
     rimraf: "npm:^6.0.1"
+    tailwindcss: "npm:^3.4.10"
     tsc-alias: "npm:^1.8.10"
     typescript: "npm:^5.5.4"
   languageName: unknown
   linkType: soft
 
-"@jridgewell/gen-mapping@npm:^0.3.5":
+"@jridgewell/gen-mapping@npm:^0.3.2, @jridgewell/gen-mapping@npm:^0.3.5":
   version: 0.3.5
   resolution: "@jridgewell/gen-mapping@npm:0.3.5"
   dependencies:
@@ -3159,6 +3189,13 @@
   languageName: node
   linkType: hard
 
+"@types/lodash@npm:^4":
+  version: 4.17.7
+  resolution: "@types/lodash@npm:4.17.7"
+  checksum: 10c0/40c965b5ffdcf7ff5c9105307ee08b782da228c01b5c0529122c554c64f6b7168fc8f11dc79aa7bae4e67e17efafaba685dc3a47e294dbf52a65ed2b67100561
+  languageName: node
+  linkType: hard
+
 "@types/mdast@npm:^4.0.0, @types/mdast@npm:^4.0.2":
   version: 4.0.4
   resolution: "@types/mdast@npm:4.0.4"
@@ -3785,6 +3822,13 @@
   languageName: node
   linkType: hard
 
+"any-promise@npm:^1.0.0":
+  version: 1.3.0
+  resolution: "any-promise@npm:1.3.0"
+  checksum: 10c0/60f0298ed34c74fef50daab88e8dab786036ed5a7fad02e012ab57e376e0a0b4b29e83b95ea9b5e7d89df762f5f25119b83e00706ecaccb22cfbacee98d74889
+  languageName: node
+  linkType: hard
+
 "anymatch@npm:~3.1.2":
   version: 3.1.3
   resolution: "anymatch@npm:3.1.3"
@@ -3795,7 +3839,7 @@
   languageName: node
   linkType: hard
 
-"arg@npm:^5.0.0":
+"arg@npm:^5.0.0, arg@npm:^5.0.2":
   version: 5.0.2
   resolution: "arg@npm:5.0.2"
   checksum: 10c0/ccaf86f4e05d342af6666c569f844bec426595c567d32a8289715087825c2ca7edd8a3d204e4d2fb2aa4602e09a57d0c13ea8c9eea75aac3dbb4af5514e6800e
@@ -4214,6 +4258,13 @@
   languageName: node
   linkType: hard
 
+"camelcase-css@npm:^2.0.1":
+  version: 2.0.1
+  resolution: "camelcase-css@npm:2.0.1"
+  checksum: 10c0/1a1a3137e8a781e6cbeaeab75634c60ffd8e27850de410c162cce222ea331cd1ba5364e8fb21c95e5ca76f52ac34b81a090925ca00a87221355746d049c6e273
+  languageName: node
+  linkType: hard
+
 "camelcase@npm:^6.2.0":
   version: 6.3.0
   resolution: "camelcase@npm:6.3.0"
@@ -4531,6 +4582,13 @@
   languageName: node
   linkType: hard
 
+"commander@npm:^4.0.0":
+  version: 4.1.1
+  resolution: "commander@npm:4.1.1"
+  checksum: 10c0/84a76c08fe6cc08c9c93f62ac573d2907d8e79138999312c92d4155bc2325d487d64d13f669b2000c9f8caf70493c1be2dac74fec3c51d5a04f8bc3ae1830bab
+  languageName: node
+  linkType: hard
+
 "commander@npm:^5.1.0":
   version: 5.1.0
   resolution: "commander@npm:5.1.0"
@@ -5264,6 +5322,13 @@
   languageName: node
   linkType: hard
 
+"didyoumean@npm:^1.2.2":
+  version: 1.2.2
+  resolution: "didyoumean@npm:1.2.2"
+  checksum: 10c0/95d0b53d23b851aacff56dfadb7ecfedce49da4232233baecfeecb7710248c4aa03f0aa8995062f0acafaf925adf8536bd7044a2e68316fd7d411477599bc27b
+  languageName: node
+  linkType: hard
+
 "dir-glob@npm:^3.0.1":
   version: 3.0.1
   resolution: "dir-glob@npm:3.0.1"
@@ -5273,6 +5338,13 @@
   languageName: node
   linkType: hard
 
+"dlv@npm:^1.1.3":
+  version: 1.1.3
+  resolution: "dlv@npm:1.1.3"
+  checksum: 10c0/03eb4e769f19a027fd5b43b59e8a05e3fd2100ac239ebb0bf9a745de35d449e2f25cfaf3aa3934664551d72856f4ae8b7822016ce5c42c2d27c18ae79429ec42
+  languageName: node
+  linkType: hard
+
 "dns-packet@npm:^5.2.2":
   version: 5.6.1
   resolution: "dns-packet@npm:5.6.1"
@@ -6416,7 +6488,7 @@
   languageName: node
   linkType: hard
 
-"glob-parent@npm:^6.0.1":
+"glob-parent@npm:^6.0.1, glob-parent@npm:^6.0.2":
   version: 6.0.2
   resolution: "glob-parent@npm:6.0.2"
   dependencies:
@@ -7754,7 +7826,7 @@
   languageName: node
   linkType: hard
 
-"jiti@npm:^1.20.0":
+"jiti@npm:^1.20.0, jiti@npm:^1.21.0":
   version: 1.21.6
   resolution: "jiti@npm:1.21.6"
   bin:
@@ -7937,7 +8009,14 @@
   languageName: node
   linkType: hard
 
-"lilconfig@npm:^3.1.1":
+"lilconfig@npm:^2.1.0":
+  version: 2.1.0
+  resolution: "lilconfig@npm:2.1.0"
+  checksum: 10c0/64645641aa8d274c99338e130554abd6a0190533c0d9eb2ce7ebfaf2e05c7d9961f3ffe2bfa39efd3b60c521ba3dd24fa236fe2775fc38501bf82bf49d4678b8
+  languageName: node
+  linkType: hard
+
+"lilconfig@npm:^3.0.0, lilconfig@npm:^3.1.1":
   version: 3.1.2
   resolution: "lilconfig@npm:3.1.2"
   checksum: 10c0/f059630b1a9bddaeba83059db00c672b64dc14074e9f232adce32b38ca1b5686ab737eb665c5ba3c32f147f0002b4bee7311ad0386a9b98547b5623e87071fbe
@@ -9273,6 +9352,17 @@
   languageName: node
   linkType: hard
 
+"mz@npm:^2.7.0":
+  version: 2.7.0
+  resolution: "mz@npm:2.7.0"
+  dependencies:
+    any-promise: "npm:^1.0.0"
+    object-assign: "npm:^4.0.1"
+    thenify-all: "npm:^1.0.0"
+  checksum: 10c0/103114e93f87362f0b56ab5b2e7245051ad0276b646e3902c98397d18bb8f4a77f2ea4a2c9d3ad516034ea3a56553b60d3f5f78220001ca4c404bd711bd0af39
+  languageName: node
+  linkType: hard
+
 "nanoid@npm:^3.3.3, nanoid@npm:^3.3.7":
   version: 3.3.7
   resolution: "nanoid@npm:3.3.7"
@@ -9433,6 +9523,13 @@
   languageName: node
   linkType: hard
 
+"npm-to-yarn@npm:^2.2.1":
+  version: 2.2.1
+  resolution: "npm-to-yarn@npm:2.2.1"
+  checksum: 10c0/65c696a3e595facad802b6b13c04e504806ea88fd4f87ab758f8042c19f65b4c4822815a47095df944b0809a95e574c27323c33cca5533f8454515eaa6e14fac
+  languageName: node
+  linkType: hard
+
 "nprogress@npm:^0.2.0":
   version: 0.2.0
   resolution: "nprogress@npm:0.2.0"
@@ -9449,13 +9546,20 @@
   languageName: node
   linkType: hard
 
-"object-assign@npm:^4.1.1":
+"object-assign@npm:^4.0.1, object-assign@npm:^4.1.1":
   version: 4.1.1
   resolution: "object-assign@npm:4.1.1"
   checksum: 10c0/1f4df9945120325d041ccf7b86f31e8bcc14e73d29171e37a7903050e96b81323784ec59f93f102ec635bcf6fa8034ba3ea0a8c7e69fa202b87ae3b6cec5a414
   languageName: node
   linkType: hard
 
+"object-hash@npm:^3.0.0":
+  version: 3.0.0
+  resolution: "object-hash@npm:3.0.0"
+  checksum: 10c0/a06844537107b960c1c8b96cd2ac8592a265186bfa0f6ccafe0d34eabdb526f6fa81da1f37c43df7ed13b12a4ae3457a16071603bcd39d8beddb5f08c37b0f47
+  languageName: node
+  linkType: hard
+
 "object-inspect@npm:^1.13.1":
   version: 1.13.2
   resolution: "object-inspect@npm:1.13.2"
@@ -9919,6 +10023,13 @@
   languageName: node
   linkType: hard
 
+"pify@npm:^2.3.0":
+  version: 2.3.0
+  resolution: "pify@npm:2.3.0"
+  checksum: 10c0/551ff8ab830b1052633f59cb8adc9ae8407a436e06b4a9718bcb27dc5844b83d535c3a8512b388b6062af65a98c49bdc0dd523d8b2617b188f7c8fee457158dc
+  languageName: node
+  linkType: hard
+
 "pify@npm:^3.0.0":
   version: 3.0.0
   resolution: "pify@npm:3.0.0"
@@ -9926,6 +10037,13 @@
   languageName: node
   linkType: hard
 
+"pirates@npm:^4.0.1":
+  version: 4.0.6
+  resolution: "pirates@npm:4.0.6"
+  checksum: 10c0/00d5fa51f8dded94d7429700fb91a0c1ead00ae2c7fd27089f0c5b63e6eca36197fe46384631872690a66f390c5e27198e99006ab77ae472692ab9c2ca903f36
+  languageName: node
+  linkType: hard
+
 "pkg-dir@npm:^7.0.0":
   version: 7.0.0
   resolution: "pkg-dir@npm:7.0.0"
@@ -10045,6 +10163,48 @@
   languageName: node
   linkType: hard
 
+"postcss-import@npm:^15.1.0":
+  version: 15.1.0
+  resolution: "postcss-import@npm:15.1.0"
+  dependencies:
+    postcss-value-parser: "npm:^4.0.0"
+    read-cache: "npm:^1.0.0"
+    resolve: "npm:^1.1.7"
+  peerDependencies:
+    postcss: ^8.0.0
+  checksum: 10c0/518aee5c83ea6940e890b0be675a2588db68b2582319f48c3b4e06535a50ea6ee45f7e63e4309f8754473245c47a0372632378d1d73d901310f295a92f26f17b
+  languageName: node
+  linkType: hard
+
+"postcss-js@npm:^4.0.1":
+  version: 4.0.1
+  resolution: "postcss-js@npm:4.0.1"
+  dependencies:
+    camelcase-css: "npm:^2.0.1"
+  peerDependencies:
+    postcss: ^8.4.21
+  checksum: 10c0/af35d55cb873b0797d3b42529514f5318f447b134541844285c9ac31a17497297eb72296902967911bb737a75163441695737300ce2794e3bd8c70c13a3b106e
+  languageName: node
+  linkType: hard
+
+"postcss-load-config@npm:^4.0.1":
+  version: 4.0.2
+  resolution: "postcss-load-config@npm:4.0.2"
+  dependencies:
+    lilconfig: "npm:^3.0.0"
+    yaml: "npm:^2.3.4"
+  peerDependencies:
+    postcss: ">=8.0.9"
+    ts-node: ">=9.0.0"
+  peerDependenciesMeta:
+    postcss:
+      optional: true
+    ts-node:
+      optional: true
+  checksum: 10c0/3d7939acb3570b0e4b4740e483d6e555a3e2de815219cb8a3c8fc03f575a6bde667443aa93369c0be390af845cb84471bf623e24af833260de3a105b78d42519
+  languageName: node
+  linkType: hard
+
 "postcss-loader@npm:^7.3.3":
   version: 7.3.4
   resolution: "postcss-loader@npm:7.3.4"
@@ -10189,6 +10349,17 @@
   languageName: node
   linkType: hard
 
+"postcss-nested@npm:^6.0.1":
+  version: 6.2.0
+  resolution: "postcss-nested@npm:6.2.0"
+  dependencies:
+    postcss-selector-parser: "npm:^6.1.1"
+  peerDependencies:
+    postcss: ^8.2.14
+  checksum: 10c0/7f9c3f2d764191a39364cbdcec350f26a312431a569c9ef17408021424726b0d67995ff5288405e3724bb7152a4c92f73c027e580ec91e798800ed3c52e2bc6e
+  languageName: node
+  linkType: hard
+
 "postcss-normalize-charset@npm:^6.0.2":
   version: 6.0.2
   resolution: "postcss-normalize-charset@npm:6.0.2"
@@ -10333,7 +10504,7 @@
   languageName: node
   linkType: hard
 
-"postcss-selector-parser@npm:^6.0.11, postcss-selector-parser@npm:^6.0.16, postcss-selector-parser@npm:^6.0.2, postcss-selector-parser@npm:^6.0.4":
+"postcss-selector-parser@npm:^6.0.11, postcss-selector-parser@npm:^6.0.16, postcss-selector-parser@npm:^6.0.2, postcss-selector-parser@npm:^6.0.4, postcss-selector-parser@npm:^6.1.1":
   version: 6.1.2
   resolution: "postcss-selector-parser@npm:6.1.2"
   dependencies:
@@ -10377,7 +10548,7 @@
   languageName: node
   linkType: hard
 
-"postcss-value-parser@npm:^4.1.0, postcss-value-parser@npm:^4.2.0":
+"postcss-value-parser@npm:^4.0.0, postcss-value-parser@npm:^4.1.0, postcss-value-parser@npm:^4.2.0":
   version: 4.2.0
   resolution: "postcss-value-parser@npm:4.2.0"
   checksum: 10c0/f4142a4f56565f77c1831168e04e3effd9ffcc5aebaf0f538eee4b2d465adfd4b85a44257bb48418202a63806a7da7fe9f56c330aebb3cac898e46b4cbf49161
@@ -10404,6 +10575,17 @@
   languageName: node
   linkType: hard
 
+"postcss@npm:^8.4.23":
+  version: 8.4.45
+  resolution: "postcss@npm:8.4.45"
+  dependencies:
+    nanoid: "npm:^3.3.7"
+    picocolors: "npm:^1.0.1"
+    source-map-js: "npm:^1.2.0"
+  checksum: 10c0/ad6f8b9b1157d678560373696109745ab97a947d449f8a997acac41c7f1e4c0f3ca4b092d6df1387f430f2c9a319987b1780dbdc27e35800a88cde9b606c1e8f
+  languageName: node
+  linkType: hard
+
 "pretty-error@npm:^4.0.0":
   version: 4.0.0
   resolution: "pretty-error@npm:4.0.0"
@@ -10810,6 +10992,15 @@
   languageName: node
   linkType: hard
 
+"read-cache@npm:^1.0.0":
+  version: 1.0.0
+  resolution: "read-cache@npm:1.0.0"
+  dependencies:
+    pify: "npm:^2.3.0"
+  checksum: 10c0/90cb2750213c7dd7c80cb420654344a311fdec12944e81eb912cd82f1bc92aea21885fa6ce442e3336d9fccd663b8a7a19c46d9698e6ca55620848ab932da814
+  languageName: node
+  linkType: hard
+
 "read-pkg@npm:^3.0.0":
   version: 3.0.0
   resolution: "read-pkg@npm:3.0.0"
@@ -11145,7 +11336,7 @@
   languageName: node
   linkType: hard
 
-"resolve@npm:^1.1.6, resolve@npm:^1.10.0, resolve@npm:^1.14.2, resolve@npm:^1.22.8":
+"resolve@npm:^1.1.6, resolve@npm:^1.1.7, resolve@npm:^1.10.0, resolve@npm:^1.14.2, resolve@npm:^1.22.2, resolve@npm:^1.22.8":
   version: 1.22.8
   resolution: "resolve@npm:1.22.8"
   dependencies:
@@ -11158,7 +11349,7 @@
   languageName: node
   linkType: hard
 
-"resolve@patch:resolve@npm%3A^1.1.6#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.10.0#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.14.2#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.22.8#optional!builtin<compat/resolve>":
+"resolve@patch:resolve@npm%3A^1.1.6#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.1.7#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.10.0#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.14.2#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.22.2#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.22.8#optional!builtin<compat/resolve>":
   version: 1.22.8
   resolution: "resolve@patch:resolve@npm%3A1.22.8#optional!builtin<compat/resolve>::version=1.22.8&hash=c3c19d"
   dependencies:
@@ -12122,6 +12313,24 @@
   languageName: node
   linkType: hard
 
+"sucrase@npm:^3.32.0":
+  version: 3.35.0
+  resolution: "sucrase@npm:3.35.0"
+  dependencies:
+    "@jridgewell/gen-mapping": "npm:^0.3.2"
+    commander: "npm:^4.0.0"
+    glob: "npm:^10.3.10"
+    lines-and-columns: "npm:^1.1.6"
+    mz: "npm:^2.7.0"
+    pirates: "npm:^4.0.1"
+    ts-interface-checker: "npm:^0.1.9"
+  bin:
+    sucrase: bin/sucrase
+    sucrase-node: bin/sucrase-node
+  checksum: 10c0/ac85f3359d2c2ecbf5febca6a24ae9bf96c931f05fde533c22a94f59c6a74895e5d5f0e871878dfd59c2697a75ebb04e4b2224ef0bfc24ca1210735c2ec191ef
+  languageName: node
+  linkType: hard
+
 "supports-color@npm:^5.3.0":
   version: 5.5.0
   resolution: "supports-color@npm:5.5.0"
@@ -12180,6 +12389,39 @@
   languageName: node
   linkType: hard
 
+"tailwindcss@npm:^3.4.10":
+  version: 3.4.10
+  resolution: "tailwindcss@npm:3.4.10"
+  dependencies:
+    "@alloc/quick-lru": "npm:^5.2.0"
+    arg: "npm:^5.0.2"
+    chokidar: "npm:^3.5.3"
+    didyoumean: "npm:^1.2.2"
+    dlv: "npm:^1.1.3"
+    fast-glob: "npm:^3.3.0"
+    glob-parent: "npm:^6.0.2"
+    is-glob: "npm:^4.0.3"
+    jiti: "npm:^1.21.0"
+    lilconfig: "npm:^2.1.0"
+    micromatch: "npm:^4.0.5"
+    normalize-path: "npm:^3.0.0"
+    object-hash: "npm:^3.0.0"
+    picocolors: "npm:^1.0.0"
+    postcss: "npm:^8.4.23"
+    postcss-import: "npm:^15.1.0"
+    postcss-js: "npm:^4.0.1"
+    postcss-load-config: "npm:^4.0.1"
+    postcss-nested: "npm:^6.0.1"
+    postcss-selector-parser: "npm:^6.0.11"
+    resolve: "npm:^1.22.2"
+    sucrase: "npm:^3.32.0"
+  bin:
+    tailwind: lib/cli.js
+    tailwindcss: lib/cli.js
+  checksum: 10c0/5212f4d90f21fc21b87008570a37de46af9c955a7c197d0f0e1d888edd5ef597f1f41194bec6b1fdc8a21e9460089d370bf728ce39b13abe93324a768b7043fd
+  languageName: node
+  linkType: hard
+
 "tapable@npm:^1.0.0":
   version: 1.1.3
   resolution: "tapable@npm:1.1.3"
@@ -12251,6 +12493,24 @@
   languageName: node
   linkType: hard
 
+"thenify-all@npm:^1.0.0":
+  version: 1.6.0
+  resolution: "thenify-all@npm:1.6.0"
+  dependencies:
+    thenify: "npm:>= 3.1.0 < 4"
+  checksum: 10c0/9b896a22735e8122754fe70f1d65f7ee691c1d70b1f116fda04fea103d0f9b356e3676cb789506e3909ae0486a79a476e4914b0f92472c2e093d206aed4b7d6b
+  languageName: node
+  linkType: hard
+
+"thenify@npm:>= 3.1.0 < 4":
+  version: 3.3.1
+  resolution: "thenify@npm:3.3.1"
+  dependencies:
+    any-promise: "npm:^1.0.0"
+  checksum: 10c0/f375aeb2b05c100a456a30bc3ed07ef03a39cbdefe02e0403fb714b8c7e57eeaad1a2f5c4ecfb9ce554ce3db9c2b024eba144843cd9e344566d9fcee73b04767
+  languageName: node
+  linkType: hard
+
 "thunky@npm:^1.0.2":
   version: 1.1.0
   resolution: "thunky@npm:1.1.0"
@@ -12316,6 +12576,13 @@
   languageName: node
   linkType: hard
 
+"ts-interface-checker@npm:^0.1.9":
+  version: 0.1.13
+  resolution: "ts-interface-checker@npm:0.1.13"
+  checksum: 10c0/232509f1b84192d07b81d1e9b9677088e590ac1303436da1e92b296e9be8e31ea042e3e1fd3d29b1742ad2c959e95afe30f63117b8f1bc3a3850070a5142fea7
+  languageName: node
+  linkType: hard
+
 "tsc-alias@npm:^1.8.10":
   version: 1.8.10
   resolution: "tsc-alias@npm:1.8.10"
@@ -13247,10 +13514,22 @@
   languageName: node
   linkType: hard
 
+"yaml@npm:^2.3.4":
+  version: 2.5.1
+  resolution: "yaml@npm:2.5.1"
+  bin:
+    yaml: bin.mjs
+  checksum: 10c0/40fba5682898dbeeb3319e358a968fe886509fab6f58725732a15f8dda3abac509f91e76817c708c9959a15f786f38ff863c1b88062d7c1162c5334a7d09cb4a
+  languageName: node
+  linkType: hard
+
 "yggdrasil-demo@workspace:demo":
   version: 0.0.0-use.local
   resolution: "yggdrasil-demo@workspace:demo"
   dependencies:
+    "@cloudflare/workers-types": "npm:^4.20240821.1"
+    "@jottocraft/yggdrasil": "workspace:*"
+    typescript: "npm:^5.5.4"
     wrangler: "npm:^3.74.0"
   languageName: unknown
   linkType: soft
@@ -13262,6 +13541,7 @@
     "@docusaurus/core": "npm:3.5.2"
     "@docusaurus/module-type-aliases": "npm:3.5.2"
     "@docusaurus/preset-classic": "npm:3.5.2"
+    "@docusaurus/remark-plugin-npm2yarn": "npm:^3.5.2"
     "@docusaurus/types": "npm:3.5.2"
     "@mdx-js/react": "npm:^3.0.0"
     clsx: "npm:^2.0.0"
@@ -13271,6 +13551,12 @@
   languageName: unknown
   linkType: soft
 
+"yggdrasil@workspace:.":
+  version: 0.0.0-use.local
+  resolution: "yggdrasil@workspace:."
+  languageName: unknown
+  linkType: soft
+
 "yocto-queue@npm:^0.1.0":
   version: 0.1.0
   resolution: "yocto-queue@npm:0.1.0"
diff --git a/yggdrasil/README.md b/yggdrasil/README.md
new file mode 100644
index 0000000..ecc3aa5
--- /dev/null
+++ b/yggdrasil/README.md
@@ -0,0 +1,7 @@
+# Yggdrasil Server (alpha)
+
+A simple and flexible TypeScript library for streamlining web request handling.
+
+[Documentation](https://yggdrasil.jottocraft.com/docs)
+
+Copyright (c) jottocraft 2024
\ No newline at end of file
diff --git a/yggdrasil/package.json b/yggdrasil/package.json
new file mode 100644
index 0000000..5b2e22c
--- /dev/null
+++ b/yggdrasil/package.json
@@ -0,0 +1,25 @@
+{
+    "name": "@jottocraft/yggdrasil",
+    "description": "A simple and flexible TypeScript library for streamlining web request handling.",
+    "version": "0.0.1-alpha.1",
+    "license": "LGPL-2.1-only",
+    "author": "jottocraft <[email protected]>",
+    "main": "lib/index.js",
+    "scripts": {
+        "test": "echo \"Error: no test specified\" && exit 1",
+        "build": "npm run clean && tsc --build && tsc-alias",
+        "clean": "rimraf lib tsconfig.tsbuildinfo",
+        "start": "run-p dev:*",
+        "dev:ts": "tsc --build --watch",
+        "dev:ts-alias": "tsc-alias --watch"
+    },
+    "devDependencies": {
+        "npm-run-all": "^4.1.5",
+        "rimraf": "^6.0.1",
+        "tsc-alias": "^1.8.10",
+        "typescript": "^5.5.4"
+    },
+    "files": [
+        "lib"
+    ]
+}
diff --git a/yggdrasil/src/YggdrasilConduitServer.ts b/yggdrasil/src/YggdrasilConduitServer.ts
new file mode 100644
index 0000000..4d53913
--- /dev/null
+++ b/yggdrasil/src/YggdrasilConduitServer.ts
@@ -0,0 +1,107 @@
+// Yggdrasil
+// Copyright (c) jottocraft 2024
+
+import { YggdrasilConduitAPI, YggdrasilConduitRequest, YggdrasilConduitResponse } from "~/conduitClient";
+import { YggdrasilConduitContext, YggdrasilServerContext } from "~/context";
+import { YggdrasilServer } from "~/YggdrasilServer";
+
+type AnyFn = (...args: any[]) => any;
+
+/**
+ * A function that executes the server's implementation of its Conduit function.
+ */
+export type YggdrasilConduitAPIHandler<AppContext, ApiSpec extends YggdrasilConduitAPI<any, any>, API extends AnyFn> = (ygg: YggdrasilConduitContext<AppContext, ApiSpec>, ...parameters: Parameters<API>) => ReturnType<API>;
+
+/**
+ * An object that stores the server's Conduit function implementations.
+ */
+export type YggdrasilConduitApiClientImpl<AppContext, ApiSpec extends YggdrasilConduitAPI<any, any>> = {
+    [Property in keyof ApiSpec["client"]]: ApiSpec["client"][Property] extends AnyFn ? YggdrasilConduitAPIHandler<AppContext, ApiSpec, ApiSpec["client"][Property]> : YggdrasilConduitApiClientImpl<AppContext, ApiSpec>;
+};
+
+/**
+ * A helper object for defining Conduit function implementations with automatic type safety.
+ */
+export type YggdrasilConduitApiClientBlueprint<AppContext, ApiSpec extends YggdrasilConduitAPI<any, any>> = {
+    [Property in keyof ApiSpec["client"]]: ApiSpec["client"][Property] extends AnyFn ? (impl: YggdrasilConduitAPIHandler<AppContext, ApiSpec, ApiSpec["client"][Property]>) => YggdrasilConduitAPIHandler<AppContext, ApiSpec, ApiSpec["client"][Property]> : YggdrasilConduitApiClientBlueprint<AppContext, ApiSpec>;
+};
+
+/**
+ * Internal type for recursing through arbitrary segments in the API object.
+ */
+type APISegment<AppContext, ApiSpec extends YggdrasilConduitAPI<any, any>> = {
+    [segment: string]: APISegment<AppContext, ApiSpec> | YggdrasilConduitAPIHandler<AppContext, ApiSpec, AnyFn>;
+};
+
+/**
+ * A server for handling Conduit requests made to Yggdrasil Server.
+ */
+export class YggdrasilConduitServer<AppContext, ApiSpec extends YggdrasilConduitAPI<any, any>> {
+    constructor(server: YggdrasilServer<AppContext, ApiSpec>, api: YggdrasilConduitApiClientImpl<AppContext, ApiSpec>) {
+        this.#server = server;
+        this.#api = api;
+    }
+
+    async handleRequest(ygg: YggdrasilServerContext<AppContext>): Promise<Response> {
+        if (!ygg.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 requestedApiSegment = this.#api as APISegment<AppContext, ApiSpec>;
+        let requestedApi: YggdrasilConduitAPIHandler<AppContext, ApiSpec, 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];
+            } 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.");
+            }
+
+            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<AppContext, ApiSpec>, keyof YggdrasilServerContext<AppContext>> as unknown as YggdrasilConduitContext<AppContext, 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<AppContext>;
+    #api: YggdrasilConduitApiClientImpl<AppContext, ApiSpec>;
+};
\ No newline at end of file
diff --git a/yggdrasil/src/YggdrasilRouter.ts b/yggdrasil/src/YggdrasilRouter.ts
new file mode 100644
index 0000000..af2f3a5
--- /dev/null
+++ b/yggdrasil/src/YggdrasilRouter.ts
@@ -0,0 +1,99 @@
+// Yggdrasil
+// Copyright (c) jottocraft 2024
+
+import { YggdrasilRouterContext, YggdrasilServerContext } from "~/context";
+import { YggdrasilServer } from "~/YggdrasilServer";
+
+/**
+ * An object that represents the route configuration made by YggdrasilServer.defineRoute().
+ */
+export type YggdrasilRouteConfig<AppContext> = {
+    method: string;
+    route: string;
+    handler: YggdrasilRouterHandler<AppContext>;
+};
+
+/**
+ * The structure used internally for storing and matching registered routes.
+ */
+type RegisteredRoutes<AppContext> = {
+    param?: string;
+    handlers?: {
+        [method: string]: YggdrasilRouterHandler<AppContext>;
+    };
+    children: {
+        [segment: string]: RegisteredRoutes<AppContext>;
+    };
+};
+
+/**
+ * The parameters set by variable segments in the router's path.
+ */
+export type YggdrasilRouterRequestParams = { [name: string]: string; };
+
+/**
+ * A function that handles a request made to a YggdrasilRouter route.
+ */
+export type YggdrasilRouterHandler<AppContext> = (ygg: YggdrasilRouterContext<AppContext>) => Promise<Response>;
+
+/**
+ * A server for routing requests made to YggdrasilServer.
+ */
+export class YggdrasilRouter<AppContext> {
+    constructor(server: YggdrasilServer<AppContext>, routes: { [key: string]: YggdrasilRouteConfig<AppContext>; }) {
+        this.#server = server;
+
+        for (const route of Object.values(routes)) {
+            let registeredPath = this.#registeredRoutes;
+
+            const segments = route.route.slice(1).split("/");
+            for (const segment of segments) {
+                if (segment.startsWith("$")) {
+                    registeredPath.children["$"] ??= { param: segment.slice(1), children: {} };
+                    registeredPath = registeredPath.children["$"];
+                } else {
+                    registeredPath.children[segment] ??= { children: {} };
+                    registeredPath = registeredPath.children[segment];
+                }
+            }
+    
+            registeredPath.handlers ??= {};
+            registeredPath.handlers[route.method] = route.handler;    
+        }
+    }
+
+    async handleRequest(ygg: YggdrasilServerContext<AppContext>): Promise<Response> {
+        let requestedPath = this.#registeredRoutes;
+        const params: YggdrasilRouterRequestParams = {};
+
+        const segments = ygg.pathname.relative.slice(1).split("/");
+        for (const segment of segments) {
+            if (requestedPath.children[segment]) {
+                requestedPath = requestedPath.children[segment];
+            } else if (requestedPath.children["$"]) {
+                requestedPath = requestedPath.children["$"];
+                params[requestedPath.param!] = segment;
+            } else {
+                throw ygg.status(404, "YGG_ROUTE_NOT_FOUND", "The requested page can't be located.");
+            }
+        }
+
+        if (requestedPath.handlers) {
+            const yggRouterCtx = { params } as YggdrasilRouterContext<AppContext>;
+            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.");
+        }
+    }
+
+    #server: YggdrasilServer<AppContext>;
+    #registeredRoutes: RegisteredRoutes<AppContext> = { children: {} };
+};
\ No newline at end of file
diff --git a/yggdrasil/src/YggdrasilServer.ts b/yggdrasil/src/YggdrasilServer.ts
new file mode 100644
index 0000000..8f4454c
--- /dev/null
+++ b/yggdrasil/src/YggdrasilServer.ts
@@ -0,0 +1,151 @@
+// 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";
+
+/**
+ * A function that handles a request made to Yggdrasil Server.
+ */
+export type YggdrasilHandler<AppContext> = (ygg: YggdrasilServerContext<AppContext>) => Promise<Response>;
+
+/**
+ * The main class for processing requests.
+ */
+export class YggdrasilServer<AppContext, ApiSpec extends YggdrasilConduitAPI<any, any> = YggdrasilConduitAPI<unknown, unknown>> {
+    constructor() { }
+
+    /**
+     * Defines a route to use with YggdrasilRouter.
+     */
+    defineRoute(method: string, route: string, handler: YggdrasilRouterHandler<AppContext>): YggdrasilRouteConfig<AppContext> {
+        return { method, route, handler };
+    }
+
+    /**
+     * Defines an API to use with YggdrasilConduitServer.
+     */
+    defineAPI(): YggdrasilConduitApiClientBlueprint<AppContext, 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<AppContext>, ctx: AppContext, options: YggdrasilServerContextOptions<AppContext> = {}): Promise<Response> {
+        const url = new URL(request.url);
+        const baseURL = options.baseURL ? new URL(options.baseURL) : undefined;
+
+        const requestedPath = url.pathname;
+        
+        let normalizedPath: string;
+        if (requestedPath === "/") {
+            normalizedPath = "/";
+        } else if (options.normalization?.trailingSlash === true) {
+            normalizedPath = requestedPath.endsWith("/") ? requestedPath : requestedPath + "/";
+        } else if (options.normalization?.trailingSlash === false) {
+            normalizedPath = requestedPath.endsWith("/") ? requestedPath.slice(0, -1) : requestedPath;
+        } else {
+            normalizedPath = requestedPath;
+        }
+
+        if (options.normalization?.lowercase) {
+            normalizedPath = normalizedPath.toLowerCase();
+        }
+
+        let relativePath: string;
+        if (baseURL) {
+            if (normalizedPath === baseURL.pathname) {
+                relativePath = "/";
+            } else if (normalizedPath.startsWith(baseURL.pathname + "/")) {
+                relativePath = normalizedPath.replace(baseURL.pathname, "");
+            } else {
+                relativePath = "";
+            }
+        } else {
+            relativePath = normalizedPath;
+        }
+
+        const ygg: YggdrasilServerContext<AppContext> = {
+            status(...args) {
+                return new YggdrasilStatus(this, ...args);
+            },
+            assert(condition, ...args) {
+                if (!condition) {
+                    throw this.status(...args);
+                }        
+            },
+            server: this,
+            request,
+            url: {
+                requested: new URL(url),
+                normalized: new URL(url)
+            },
+            pathname: {
+                requested: requestedPath,
+                normalized: normalizedPath,
+                relative: relativePath
+            },
+            baseURL,
+            ctx() {
+                const boundCtx: AppContext = {} as AppContext;
+
+                for (const key in ctx) {
+                    if (typeof ctx[key] === "function") {
+                        boundCtx[key] = ctx[key].bind(this);
+                    } else {
+                        boundCtx[key] = ctx[key];
+                    }
+                }
+            
+                return boundCtx;            
+            },
+            options,
+            additionalHeaders: {
+                set: {},
+                append: [
+                    ["X-Powered-By", "@jottocraft/yggdrasil"]
+                ]
+            }
+        };
+
+        let response: Response;
+
+        if (!ygg.pathname.relative) {
+            response = await generateStatusPage(new YggdrasilStatus(ygg, 404, "YGG_BASE_URL_MISMATCH"));
+        } else if (options.normalization?.redirect && (ygg.pathname.normalized !== ygg.pathname.requested)) {
+            response = new Response(null, {
+                status: 301,
+                headers: {
+                    Location: ygg.pathname.normalized
+                }
+            });
+        } else {
+            try {
+                response = await handler(ygg);
+            } catch (e) {
+                if (e instanceof YggdrasilStatus) {
+                    response = await generateStatusPage(e);
+                } else {
+                    throw e;
+                }
+            }    
+        }
+
+        applyHeaders(response, ygg.additionalHeaders);
+
+        return response;
+    }
+};
\ No newline at end of file
diff --git a/yggdrasil/src/YggdrasilStatus.ts b/yggdrasil/src/YggdrasilStatus.ts
new file mode 100644
index 0000000..f36329f
--- /dev/null
+++ b/yggdrasil/src/YggdrasilStatus.ts
@@ -0,0 +1,48 @@
+// Yggdrasil
+// Copyright (c) jottocraft 2024
+
+import { YggdrasilContext } from "~/context";
+
+/**
+ * YggdrasilStatus for clients without a server-side YggdrasilContext
+ */
+export class YggdrasilClientStatus extends Error {    
+    constructor(status: number, statusCode: string, statusMessage?: string) {
+        super(statusCode);
+
+        this.#status = status;
+        this.#statusCode = statusCode;
+        this.#statusMessage = statusMessage;
+    }
+
+    #status: number;
+    get status() {
+        return this.#status;
+    }
+
+    #statusCode: string;
+    get statusCode() {
+        return this.#statusCode;
+    }
+
+    #statusMessage?: string;
+    get statusMessage() {
+        return this.#statusMessage;
+    }
+};
+
+/**
+ * An Error that will cause an HTTP status page to show.
+ */
+export class YggdrasilStatus<AppContext> extends YggdrasilClientStatus {    
+    constructor(ygg: YggdrasilContext<AppContext>, status: number, statusCode: string, statusMessage?: string) {
+        super(status, statusCode, statusMessage);
+
+        this.#ygg = ygg;
+    }
+
+    #ygg: YggdrasilContext<AppContext>;
+    get ygg() {
+        return this.#ygg;
+    }
+};
\ No newline at end of file
diff --git a/yggdrasil/src/conduitClient.ts b/yggdrasil/src/conduitClient.ts
new file mode 100644
index 0000000..6e51c5c
--- /dev/null
+++ b/yggdrasil/src/conduitClient.ts
@@ -0,0 +1,150 @@
+// Yggdrasil
+// Copyright (c) jottocraft 2024
+
+import { YggdrasilContext } from "~/context";
+import { YggdrasilClientStatus } from "~/YggdrasilStatus";
+
+export type YggdrasilConduitAPI<ApiClient, ApiCtx> = {
+    client: ApiClient;
+    context: ApiCtx;
+};
+
+// 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<any, any>> = () => ApiSpec["client"];
+export type YggdrasilConduitAPIContext<ApiSpec extends YggdrasilConduitAPI<any, any>> = 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<unknown>, "url" | "pathname" | "baseURL" | "additionalHeaders">;
+    };
+};
+
+export type YggdrasilConduitClientOptions = {
+    /**
+     * The fetcher used to submit requests to the Yggdrasil Server instance hosting these Conduit functions.
+     */
+    fetcher?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
+    /**
+     * The base URL of the Yggdrasil Server instance hosting these Conduit functions, WITH a trailing slash.
+     */
+    baseURL: string;
+};
+
+async function doConduitRequest<ApiSpec extends YggdrasilConduitAPI<any, any>>(path: string[], args: unknown[], apiCtx: ApiSpec["context"], options: YggdrasilConduitClientOptions): Promise<{
+    response: Response;
+    outcome: YggdrasilConduitResponse<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,
+        context: apiCtx
+    };
+
+    const response = await fetcher(callURL.href, {
+        method: "POST",
+        headers: {
+            "Content-Type": "application/json+jottocraft-ygg-req"
+        },
+        body: JSON.stringify(request)
+    });
+
+    let outcome: YggdrasilConduitResponse<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: [] } };
+    } else {
+        outcome = await response.json();
+    }
+
+    return { response, outcome };
+}
+
+/**
+ * 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<any, any>>(apiCtx: ApiSpec["context"], options: YggdrasilConduitClientOptions): YggdrasilConduitAPIClient<ApiSpec> {
+    return function conduitServerSideClient(this: YggdrasilContext<unknown>): ApiSpec["client"] {
+        const createAppFn = (path: string[]) => {
+            return new Proxy(async (...args: unknown[]) => {
+                const { response, outcome } = await doConduitRequest(path, args, apiCtx, options);
+
+                const passHeadersTo: YggdrasilAdditionalHeaders = "upstreamHeaders" in this ? this.upstreamHeaders : this.additionalHeaders;
+
+                for (const name in outcome.headers.set) {
+                    if (passHeadersTo.set[name]) continue;
+                    passHeadersTo.set[name] = outcome.headers.set[name];
+                }
+
+                for (const [name, value] of outcome.headers.append) {
+                    passHeadersTo.append.push([name, value]);
+                }
+
+                if (outcome.success) {
+                    return outcome.data;
+                } else {
+                    throw this.status(response.status, outcome.error, outcome.message);
+                }
+            }, {
+                get(target, name: string) {
+                    return createAppFn([...path, name]);
+                }
+            });
+        }
+
+        return createAppFn([]) as ApiSpec["client"];
+    }
+}
+
+/**
+ * Creates a client for calling Yggdrasil Server Conduit-powered APIs from a client application.
+ */
+export function createConduitClientSideClient<ApiSpec extends YggdrasilConduitAPI<any, any>>(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);
+
+            if (outcome.success) {
+                return outcome.data;
+            } else {
+                throw new YggdrasilClientStatus(response.status, outcome.error, outcome.message);
+            }
+        }, {
+            get(target, name: string) {
+                return createAppFn([...path, name]);
+            }
+        });
+    }
+
+    return createAppFn([]) as ApiSpec["client"];
+}
\ No newline at end of file
diff --git a/yggdrasil/src/context.ts b/yggdrasil/src/context.ts
new file mode 100644
index 0000000..a22b239
--- /dev/null
+++ b/yggdrasil/src/context.ts
@@ -0,0 +1,81 @@
+// Yggdrasil
+// Copyright (c) jottocraft 2024
+
+import { YggdrasilAdditionalHeaders, YggdrasilConduitAPI, YggdrasilConduitAPIContext } from "~/conduitClient";
+import { YggdrasilRouterRequestParams } from "~/YggdrasilRouter";
+import { YggdrasilServer } from "~/YggdrasilServer";
+import { YggdrasilStatus } from "~/YggdrasilStatus";
+
+export type YggdrasilServerContextOptions<AppContext> = {
+    /** 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<AppContext>) => Promise<Response>;
+};
+
+export type YggdrasilContext<AppContext> = YggdrasilServerContext<AppContext> | YggdrasilRouterContext<AppContext> | YggdrasilConduitContext<AppContext, YggdrasilConduitAPI<unknown, unknown>>;
+
+export type YggdrasilServerContext<AppContext> = {
+    /** Constructs a YggdrasilStatus object based on the current context. */
+    status: (status: number, statusCode: string, statusMessage?: string) => YggdrasilStatus<AppContext>;
+    /** 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<AppContext>;
+    /** 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: () => AppContext;
+    /** Yggdrasil Server options. */
+    options: YggdrasilServerContextOptions<AppContext>;
+    /** Headers that will be set/appended to the final response. */
+    additionalHeaders: YggdrasilAdditionalHeaders;
+};
+
+export type YggdrasilRouterContext<AppContext> = YggdrasilServerContext<AppContext> & {
+    /** The parameters set by variable segments in the router's path. */
+    params: YggdrasilRouterRequestParams;
+};
+
+export type YggdrasilConduitContext<AppContext, ApiSpec extends YggdrasilConduitAPI<any, any>> = YggdrasilServerContext<AppContext> & {
+    /** 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
new file mode 100644
index 0000000..fc84449
--- /dev/null
+++ b/yggdrasil/src/index.ts
@@ -0,0 +1,12 @@
+// Yggdrasil
+// Copyright (c) jottocraft 2024
+
+export * from "~/conduitClient";
+export * from "~/context";
+export * from "~/YggdrasilConduitServer";
+export * from "~/YggdrasilRouter";
+export * from "~/YggdrasilServer";
+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
new file mode 100644
index 0000000..27b0bd8
--- /dev/null
+++ b/yggdrasil/src/util/applyHeaders.ts
@@ -0,0 +1,14 @@
+// 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
new file mode 100644
index 0000000..89f287c
--- /dev/null
+++ b/yggdrasil/src/util/generateStatusPage.ts
@@ -0,0 +1,70 @@
+// Yggdrasil
+// Copyright (c) jottocraft 2024
+
+import { YggdrasilConduitResponseError } from "~/conduitClient";
+import { YggdrasilStatus } from "~/YggdrasilStatus";
+
+export async function generateStatusPage<AppContext>(e: YggdrasilStatus<AppContext>): Promise<Response> {
+    const accept = e.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);
+    } else {
+        return generatePlaintextStatusPage(e);
+    }
+}
+
+async function generateConduitErrorPage<AppContext>(e: YggdrasilStatus<AppContext>): 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<AppContext>(e: YggdrasilStatus<AppContext>): Promise<Response> {
+    return new Response(JSON.stringify({
+        success: false,
+        status: e.status,
+        error: e.statusCode,
+        message: e.statusMessage
+    }), {
+        status: e.status,
+        headers: {
+            "Content-Type": "application/json"
+        }
+    });
+}
+
+async function generatePlaintextStatusPage<AppContext>(e: YggdrasilStatus<AppContext>): Promise<Response> {
+    return new Response(`Error ${e.status} ${e.statusCode}${e.statusMessage ? ": " + e.statusMessage : ""}`, {
+        status: e.status,
+        headers: {
+            "Content-Type": "text/plain"
+        }
+    });
+}
\ No newline at end of file
diff --git a/tsconfig.json b/yggdrasil/tsconfig.json
similarity index 100%
rename from tsconfig.json
rename to yggdrasil/tsconfig.json