Index: pages/auth/register/register.telefunc.ts
===================================================================
--- pages/auth/register/register.telefunc.ts	(revision b69759dc4c8f1a000afc0d0c5c5afcc6868641fb)
+++ pages/auth/register/register.telefunc.ts	(revision b69759dc4c8f1a000afc0d0c5c5afcc6868641fb)
@@ -0,0 +1,18 @@
+import * as drizzleQueries from "../../../database/drizzle/queries/users";
+import { ctx } from "../../../server/telefunc/ctx";
+import { Abort } from "telefunc";
+import bcrypt from "bcrypt";
+
+export async function registerNewUser({ username, email, password }
+                                      : { username: string; email: string; password: string }) {
+    const c = ctx();
+
+    if (c.session?.user?.id) throw Abort();
+
+    if(!username || !email || !password) throw Abort();
+
+    const passwordHash = await bcrypt.hash(password, 8);
+    await drizzleQueries.createUser(c.db, username, email, passwordHash);
+
+    return { success: true };
+}
