summary refs log tree commit diff
path: root/api
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-12 21:09:29 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-12 21:09:29 +0200
commitd50073fc41fc7d69d3dab9a2858158320983329b (patch)
treec4507ebe83019292807f5a4cf10fc8a522334e2a /api
parentMerge pull request #348 from AlTech98/fix-cdn-upload (diff)
downloadserver-d50073fc41fc7d69d3dab9a2858158320983329b.tar.xz
:art: remove long relatives paths -> short module paths
Diffstat (limited to 'api')
-rw-r--r--api/package-lock.json76
-rw-r--r--api/package.json3
-rw-r--r--api/scripts/tsconfig-paths-bootstrap.js10
-rw-r--r--api/src/index.ts11
-rw-r--r--api/src/middlewares/ErrorHandler.ts2
-rw-r--r--api/src/middlewares/RateLimit.ts2
-rw-r--r--api/src/routes/auth/login.ts2
-rw-r--r--api/src/routes/auth/register.ts4
-rw-r--r--api/src/routes/channels/#channel_id/index.ts2
-rw-r--r--api/src/routes/channels/#channel_id/invites.ts4
-rw-r--r--api/src/routes/channels/#channel_id/messages/#message_id/ack.ts2
-rw-r--r--api/src/routes/channels/#channel_id/messages/#message_id/index.ts4
-rw-r--r--api/src/routes/channels/#channel_id/messages/bulk-delete.ts2
-rw-r--r--api/src/routes/channels/#channel_id/messages/index.ts6
-rw-r--r--api/src/routes/channels/#channel_id/permissions.ts2
-rw-r--r--api/src/routes/channels/#channel_id/webhooks.ts2
-rw-r--r--api/src/routes/guilds/#guild_id/bans.ts5
-rw-r--r--api/src/routes/guilds/#guild_id/channels.ts2
-rw-r--r--api/src/routes/guilds/#guild_id/index.ts4
-rw-r--r--api/src/routes/guilds/#guild_id/members/#member_id/index.ts4
-rw-r--r--api/src/routes/guilds/#guild_id/members/index.ts2
-rw-r--r--api/src/routes/guilds/#guild_id/regions.ts6
-rw-r--r--api/src/routes/guilds/#guild_id/roles.ts2
-rw-r--r--api/src/routes/guilds/#guild_id/templates.ts4
-rw-r--r--api/src/routes/guilds/#guild_id/vanity-url.ts2
-rw-r--r--api/src/routes/guilds/#guild_id/voice-states/#user_id/index.ts8
-rw-r--r--api/src/routes/guilds/#guild_id/voice-states/@me/index.ts8
-rw-r--r--api/src/routes/guilds/#guild_id/welcome_screen.ts2
-rw-r--r--api/src/routes/guilds/#guild_id/widget.json.ts2
-rw-r--r--api/src/routes/guilds/#guild_id/widget.ts2
-rw-r--r--api/src/routes/guilds/index.ts2
-rw-r--r--api/src/routes/guilds/templates/index.ts2
-rw-r--r--api/src/routes/users/#id/index.ts2
-rw-r--r--api/src/routes/users/#id/profile.ts2
-rw-r--r--api/src/routes/users/@me/channels.ts6
-rw-r--r--api/src/routes/users/@me/index.ts4
-rw-r--r--api/src/routes/users/@me/relationships.ts2
-rw-r--r--api/src/routes/users/@me/settings.ts2
-rw-r--r--api/src/routes/voice/regions.ts6
-rw-r--r--api/src/test/password_test.ts12
-rw-r--r--api/src/util/index.ts11
-rw-r--r--api/src/util/passwordStrength.ts2
-rw-r--r--api/tests/automatic.test.js0
-rw-r--r--api/tsconfig.json7
44 files changed, 165 insertions, 82 deletions
diff --git a/api/package-lock.json b/api/package-lock.json
index 7b1e000b..8b2c93f8 100644
--- a/api/package-lock.json
+++ b/api/package-lock.json
@@ -38,6 +38,7 @@
 				"node-fetch": "^2.6.1",
 				"patch-package": "^6.4.7",
 				"supertest": "^6.1.6",
+				"tsconfig-paths": "^3.11.0",
 				"typeorm": "^0.2.37"
 			},
 			"devDependencies": {
@@ -79,12 +80,13 @@
 				"env-paths": "^2.2.1",
 				"jsonwebtoken": "^8.5.1",
 				"lambert-server": "^1.2.10",
-				"missing-native-js-functions": "^1.2.14",
+				"missing-native-js-functions": "^1.2.15",
 				"node-fetch": "^2.6.1",
 				"patch-package": "^6.4.7",
 				"pg": "^8.7.1",
 				"reflect-metadata": "^0.1.13",
 				"sqlite3": "^5.0.2",
+				"tsconfig-paths": "^3.11.0",
 				"typeorm": "^0.2.37",
 				"typescript": "^4.4.2",
 				"typescript-json-schema": "^0.50.1"
@@ -1396,6 +1398,11 @@
 			"integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==",
 			"dev": true
 		},
+		"node_modules/@types/json5": {
+			"version": "0.0.29",
+			"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
+			"integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4="
+		},
 		"node_modules/@types/jsonwebtoken": {
 			"version": "8.5.4",
 			"resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-8.5.4.tgz",
@@ -11344,6 +11351,36 @@
 				"strip-json-comments": "^2.0.0"
 			}
 		},
+		"node_modules/tsconfig-paths": {
+			"version": "3.11.0",
+			"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.11.0.tgz",
+			"integrity": "sha512-7ecdYDnIdmv639mmDwslG6KQg1Z9STTz1j7Gcz0xa+nshh/gKDAHcPxRbWOsA3SPp0tXP2leTcY9Kw+NAkfZzA==",
+			"dependencies": {
+				"@types/json5": "^0.0.29",
+				"json5": "^1.0.1",
+				"minimist": "^1.2.0",
+				"strip-bom": "^3.0.0"
+			}
+		},
+		"node_modules/tsconfig-paths/node_modules/json5": {
+			"version": "1.0.1",
+			"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
+			"integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
+			"dependencies": {
+				"minimist": "^1.2.0"
+			},
+			"bin": {
+				"json5": "lib/cli.js"
+			}
+		},
+		"node_modules/tsconfig-paths/node_modules/strip-bom": {
+			"version": "3.0.0",
+			"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
+			"integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=",
+			"engines": {
+				"node": ">=4"
+			}
+		},
 		"node_modules/tsconfig/node_modules/strip-bom": {
 			"version": "3.0.0",
 			"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
@@ -12977,12 +13014,13 @@
 				"jest": "^27.0.6",
 				"jsonwebtoken": "^8.5.1",
 				"lambert-server": "^1.2.10",
-				"missing-native-js-functions": "^1.2.14",
+				"missing-native-js-functions": "^1.2.15",
 				"node-fetch": "^2.6.1",
 				"patch-package": "^6.4.7",
 				"pg": "^8.7.1",
 				"reflect-metadata": "^0.1.13",
 				"sqlite3": "^5.0.2",
+				"tsconfig-paths": "^3.11.0",
 				"typeorm": "^0.2.37",
 				"typescript": "^4.4.2",
 				"typescript-json-schema": "^0.50.1"
@@ -13574,6 +13612,11 @@
 			"integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==",
 			"dev": true
 		},
+		"@types/json5": {
+			"version": "0.0.29",
+			"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
+			"integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4="
+		},
 		"@types/jsonwebtoken": {
 			"version": "8.5.4",
 			"resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-8.5.4.tgz",
@@ -18703,8 +18746,7 @@
 			"dev": true
 		},
 		"mpath": {
-			"version": "0.8.3",
-			"resolved": "https://registry.npmjs.org/mpath/-/mpath-0.8.4.tgz",
+			"version": "https://registry.npmjs.org/mpath/-/mpath-0.8.4.tgz",
 			"integrity": "sha512-eb9rRvhDltXVNL6Fxd2zM9D4vKBxjVVQNLNijlj7uoXUy19zNDsIif5zR+pWmPCWNKwAtqyo4JveQm4nfD5+eA=="
 		},
 		"mquery": {
@@ -21726,6 +21768,32 @@
 				}
 			}
 		},
+		"tsconfig-paths": {
+			"version": "3.11.0",
+			"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.11.0.tgz",
+			"integrity": "sha512-7ecdYDnIdmv639mmDwslG6KQg1Z9STTz1j7Gcz0xa+nshh/gKDAHcPxRbWOsA3SPp0tXP2leTcY9Kw+NAkfZzA==",
+			"requires": {
+				"@types/json5": "^0.0.29",
+				"json5": "^1.0.1",
+				"minimist": "^1.2.0",
+				"strip-bom": "^3.0.0"
+			},
+			"dependencies": {
+				"json5": {
+					"version": "1.0.1",
+					"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
+					"integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
+					"requires": {
+						"minimist": "^1.2.0"
+					}
+				},
+				"strip-bom": {
+					"version": "3.0.0",
+					"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
+					"integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM="
+				}
+			}
+		},
 		"tslib": {
 			"version": "2.3.1",
 			"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
diff --git a/api/package.json b/api/package.json
index a501fb15..b762b944 100644
--- a/api/package.json
+++ b/api/package.json
@@ -7,7 +7,7 @@
 	"scripts": {
 		"test": "npm run build && jest --coverage --verbose --forceExit ./tests",
 		"test:watch": "jest --watch",
-		"start": "npm run build && node dist/start",
+		"start": "npm run build && node -r ./scripts/tsconfig-paths-bootstrap.js dist/start",
 		"build": "npx tsc -b .",
 		"build-docker": "tsc -p tsconfig-docker.json",
 		"dev": "tsnd --respawn src/start.ts",
@@ -86,6 +86,7 @@
 		"node-fetch": "^2.6.1",
 		"patch-package": "^6.4.7",
 		"supertest": "^6.1.6",
+		"tsconfig-paths": "^3.11.0",
 		"typeorm": "^0.2.37"
 	},
 	"jest": {
diff --git a/api/scripts/tsconfig-paths-bootstrap.js b/api/scripts/tsconfig-paths-bootstrap.js
new file mode 100644
index 00000000..d6ad3c57
--- /dev/null
+++ b/api/scripts/tsconfig-paths-bootstrap.js
@@ -0,0 +1,10 @@
+const tsConfigPaths = require("tsconfig-paths");
+const path = require("path");
+
+const cleanup = tsConfigPaths.register({
+	baseUrl: path.join(__dirname, ".."),
+	paths: {
+		"@fosscord/api": ["dist/index.js"],
+		"@fosscord/api/*": ["dist/*"]
+	}
+});
diff --git a/api/src/index.ts b/api/src/index.ts
index fe59310f..adc7649c 100644
--- a/api/src/index.ts
+++ b/api/src/index.ts
@@ -1,12 +1,3 @@
 export * from "./Server";
 export * from "./middlewares/";
-export * from "./schema/Ban";
-export * from "./schema/Channel";
-export * from "./schema/Guild";
-export * from "./schema/Invite";
-export * from "./schema/Message";
-export * from "./util/instanceOf";
-export * from "./util/instanceOf";
-export * from "./util/RandomInviteID";
-export * from "./util/String";
-export { check as checkPassword } from "./util/passwordStrength";
+export * from "./util/";
diff --git a/api/src/middlewares/ErrorHandler.ts b/api/src/middlewares/ErrorHandler.ts
index be2586cf..d288f3fb 100644
--- a/api/src/middlewares/ErrorHandler.ts
+++ b/api/src/middlewares/ErrorHandler.ts
@@ -1,7 +1,7 @@
 import { NextFunction, Request, Response } from "express";
 import { HTTPError } from "lambert-server";
 import { EntityNotFoundError } from "typeorm";
-import { FieldError } from "../util/instanceOf";
+import { FieldError } from "@fosscord/api";
 import { ApiError } from "@fosscord/util";
 
 export function ErrorHandler(error: Error, req: Request, res: Response, next: NextFunction) {
diff --git a/api/src/middlewares/RateLimit.ts b/api/src/middlewares/RateLimit.ts
index dffbc0d9..d1fd072f 100644
--- a/api/src/middlewares/RateLimit.ts
+++ b/api/src/middlewares/RateLimit.ts
@@ -1,6 +1,6 @@
 import { Config, listenEvent } from "@fosscord/util";
 import { NextFunction, Request, Response, Router } from "express";
-import { getIpAdress } from "../util/ipAddress";
+import { getIpAdress } from "@fosscord/api";
 import { API_PREFIX_TRAILING_SLASH } from "./Authentication";
 
 // Docs: https://discord.com/developers/docs/topics/rate-limits
diff --git a/api/src/routes/auth/login.ts b/api/src/routes/auth/login.ts
index 7fd0f870..2e2f763d 100644
--- a/api/src/routes/auth/login.ts
+++ b/api/src/routes/auth/login.ts
@@ -1,5 +1,5 @@
 import { Request, Response, Router } from "express";
-import { check, FieldErrors, Length } from "../../util/instanceOf";
+import { check, FieldErrors, Length } from "@fosscord/api";
 import bcrypt from "bcrypt";
 import jwt from "jsonwebtoken";
 import { Config, User } from "@fosscord/util";
diff --git a/api/src/routes/auth/register.ts b/api/src/routes/auth/register.ts
index a9518e91..d3c85778 100644
--- a/api/src/routes/auth/register.ts
+++ b/api/src/routes/auth/register.ts
@@ -1,10 +1,10 @@
 import { Request, Response, Router } from "express";
 import { trimSpecial, User, Snowflake, Config, defaultSettings } from "@fosscord/util";
 import bcrypt from "bcrypt";
-import { check, Email, EMAIL_REGEX, FieldErrors, Length } from "../../util/instanceOf";
+import { check, Email, EMAIL_REGEX, FieldErrors, Length } from "@fosscord/api";
 import "missing-native-js-functions";
 import { generateToken } from "./login";
-import { getIpAdress, IPAnalysis, isProxy } from "../../util/ipAddress";
+import { getIpAdress, IPAnalysis, isProxy } from "@fosscord/api";
 import { HTTPError } from "lambert-server";
 import { In } from "typeorm";
 
diff --git a/api/src/routes/channels/#channel_id/index.ts b/api/src/routes/channels/#channel_id/index.ts
index 4aa5a5b9..46554d70 100644
--- a/api/src/routes/channels/#channel_id/index.ts
+++ b/api/src/routes/channels/#channel_id/index.ts
@@ -2,7 +2,7 @@ import { ChannelDeleteEvent, Channel, ChannelUpdateEvent, emitEvent, getPermissi
 import { Router, Response, Request } from "express";
 import { HTTPError } from "lambert-server";
 import { ChannelModifySchema } from "../../../schema/Channel";
-import { check } from "../../../util/instanceOf";
+import { check } from "@fosscord/api";
 const router: Router = Router();
 // TODO: delete channel
 // TODO: Get channel
diff --git a/api/src/routes/channels/#channel_id/invites.ts b/api/src/routes/channels/#channel_id/invites.ts
index fe22d3bc..c6909fd0 100644
--- a/api/src/routes/channels/#channel_id/invites.ts
+++ b/api/src/routes/channels/#channel_id/invites.ts
@@ -1,7 +1,7 @@
 import { Router, Request, Response } from "express";
 import { HTTPError } from "lambert-server";
-import { check } from "../../../util/instanceOf";
-import { random } from "../../../util/RandomInviteID";
+import { check } from "@fosscord/api";
+import { random } from "@fosscord/api";
 import { InviteCreateSchema } from "../../../schema/Invite";
 import { getPermission, Channel, Invite, InviteCreateEvent, emitEvent, User, Guild, PublicInviteRelation } from "@fosscord/util";
 import { isTextChannel } from "./messages";
diff --git a/api/src/routes/channels/#channel_id/messages/#message_id/ack.ts b/api/src/routes/channels/#channel_id/messages/#message_id/ack.ts
index 0fd5f2be..aab51484 100644
--- a/api/src/routes/channels/#channel_id/messages/#message_id/ack.ts
+++ b/api/src/routes/channels/#channel_id/messages/#message_id/ack.ts
@@ -1,7 +1,7 @@
 import { emitEvent, getPermission, MessageAckEvent, ReadState } from "@fosscord/util";
 import { Request, Response, Router } from "express";
 
-import { check } from "../../../../../util/instanceOf";
+import { check } from "@fosscord/api";
 
 const router = Router();
 
diff --git a/api/src/routes/channels/#channel_id/messages/#message_id/index.ts b/api/src/routes/channels/#channel_id/messages/#message_id/index.ts
index 7a00de43..e9588bd3 100644
--- a/api/src/routes/channels/#channel_id/messages/#message_id/index.ts
+++ b/api/src/routes/channels/#channel_id/messages/#message_id/index.ts
@@ -1,8 +1,8 @@
 import { Channel, emitEvent, getPermission, MessageDeleteEvent, Message, MessageUpdateEvent } from "@fosscord/util";
 import { Router, Response, Request } from "express";
 import { MessageCreateSchema } from "../../../../../schema/Message";
-import { check } from "../../../../../util/instanceOf";
-import { handleMessage, postHandleMessage } from "../../../../../util/Message";
+import { check } from "@fosscord/api";
+import { handleMessage, postHandleMessage } from "@fosscord/api";
 
 const router = Router();
 
diff --git a/api/src/routes/channels/#channel_id/messages/bulk-delete.ts b/api/src/routes/channels/#channel_id/messages/bulk-delete.ts
index 5c486676..5d7566e1 100644
--- a/api/src/routes/channels/#channel_id/messages/bulk-delete.ts
+++ b/api/src/routes/channels/#channel_id/messages/bulk-delete.ts
@@ -2,7 +2,7 @@ import { Router, Response, Request } from "express";
 import { Channel, Config, emitEvent, getPermission, MessageDeleteBulkEvent, Message } from "@fosscord/util";
 import { HTTPError } from "lambert-server";
 
-import { check } from "../../../../util/instanceOf";
+import { check } from "@fosscord/api";
 import { In } from "typeorm";
 
 const router: Router = Router();
diff --git a/api/src/routes/channels/#channel_id/messages/index.ts b/api/src/routes/channels/#channel_id/messages/index.ts
index ad590d05..591ebbbe 100644
--- a/api/src/routes/channels/#channel_id/messages/index.ts
+++ b/api/src/routes/channels/#channel_id/messages/index.ts
@@ -2,11 +2,11 @@ import { Router, Response, Request } from "express";
 import { Attachment, Channel, ChannelType, getPermission, Message } from "@fosscord/util";
 import { HTTPError } from "lambert-server";
 import { MessageCreateSchema } from "../../../../schema/Message";
-import { check, instanceOf, Length } from "../../../../util/instanceOf";
+import { check, instanceOf, Length } from "@fosscord/api";
 import multer from "multer";
 import { Query } from "mongoose";
-import { sendMessage } from "../../../../util/Message";
-import { uploadFile } from "../../../../util/cdn";
+import { sendMessage } from "@fosscord/api";
+import { uploadFile } from "@fosscord/api";
 import { FindManyOptions, LessThan, MoreThan } from "typeorm";
 
 const router: Router = Router();
diff --git a/api/src/routes/channels/#channel_id/permissions.ts b/api/src/routes/channels/#channel_id/permissions.ts
index 9c49542b..0465ca31 100644
--- a/api/src/routes/channels/#channel_id/permissions.ts
+++ b/api/src/routes/channels/#channel_id/permissions.ts
@@ -2,7 +2,7 @@ import { Channel, ChannelPermissionOverwrite, ChannelUpdateEvent, emitEvent, get
 import { Router, Response, Request } from "express";
 import { HTTPError } from "lambert-server";
 
-import { check } from "../../../util/instanceOf";
+import { check } from "@fosscord/api";
 const router: Router = Router();
 
 // TODO: Only permissions your bot has in the guild or channel can be allowed/denied (unless your bot has a MANAGE_ROLES overwrite in the channel)
diff --git a/api/src/routes/channels/#channel_id/webhooks.ts b/api/src/routes/channels/#channel_id/webhooks.ts
index e4125879..821a62db 100644
--- a/api/src/routes/channels/#channel_id/webhooks.ts
+++ b/api/src/routes/channels/#channel_id/webhooks.ts
@@ -1,5 +1,5 @@
 import { Router, Response, Request } from "express";
-import { check, Length } from "../../../util/instanceOf";
+import { check, Length } from "@fosscord/api";
 import { Channel, Config, getPermission, trimSpecial, Webhook } from "@fosscord/util";
 import { HTTPError } from "lambert-server";
 import { isTextChannel } from "./messages/index";
diff --git a/api/src/routes/guilds/#guild_id/bans.ts b/api/src/routes/guilds/#guild_id/bans.ts
index 31aa2385..86bff6b4 100644
--- a/api/src/routes/guilds/#guild_id/bans.ts
+++ b/api/src/routes/guilds/#guild_id/bans.ts
@@ -1,9 +1,8 @@
 import { Request, Response, Router } from "express";
 import { emitEvent, getPermission, GuildBanAddEvent, GuildBanRemoveEvent, Guild, Ban, User, Member } from "@fosscord/util";
 import { HTTPError } from "lambert-server";
-import { getIpAdress } from "../../../util/ipAddress";
-import { BanCreateSchema } from "../../../schema/Ban";
-import { check } from "../../../util/instanceOf";
+import { getIpAdress, check } from "@fosscord/api";
+import { BanCreateSchema } from "@fosscord/api/schema/Ban";
 
 const router: Router = Router();
 
diff --git a/api/src/routes/guilds/#guild_id/channels.ts b/api/src/routes/guilds/#guild_id/channels.ts
index 5aa1d33d..faeecb76 100644
--- a/api/src/routes/guilds/#guild_id/channels.ts
+++ b/api/src/routes/guilds/#guild_id/channels.ts
@@ -3,7 +3,7 @@ import { Channel, ChannelUpdateEvent, getPermission, emitEvent } from "@fosscord
 import { HTTPError } from "lambert-server";
 import { ChannelModifySchema } from "../../../schema/Channel";
 
-import { check } from "../../../util/instanceOf";
+import { check } from "@fosscord/api";
 const router = Router();
 
 router.get("/", async (req: Request, res: Response) => {
diff --git a/api/src/routes/guilds/#guild_id/index.ts b/api/src/routes/guilds/#guild_id/index.ts
index 9d302a48..244900ec 100644
--- a/api/src/routes/guilds/#guild_id/index.ts
+++ b/api/src/routes/guilds/#guild_id/index.ts
@@ -3,8 +3,8 @@ import { emitEvent, getPermission, Guild, GuildUpdateEvent, Member } from "@foss
 import { HTTPError } from "lambert-server";
 import { GuildUpdateSchema } from "../../../schema/Guild";
 
-import { check } from "../../../util/instanceOf";
-import { handleFile } from "../../../util/cdn";
+import { check } from "@fosscord/api";
+import { handleFile } from "@fosscord/api";
 import "missing-native-js-functions";
 
 const router = Router();
diff --git a/api/src/routes/guilds/#guild_id/members/#member_id/index.ts b/api/src/routes/guilds/#guild_id/members/#member_id/index.ts
index 0d62e555..8b04a508 100644
--- a/api/src/routes/guilds/#guild_id/members/#member_id/index.ts
+++ b/api/src/routes/guilds/#guild_id/members/#member_id/index.ts
@@ -11,8 +11,8 @@ import {
 	emitEvent
 } from "@fosscord/util";
 import { HTTPError } from "lambert-server";
-import { check } from "../../../../../util/instanceOf";
-import { MemberChangeSchema } from "../../../../../schema/Member";
+import { check } from "@fosscord/api";
+import { MemberChangeSchema } from "@fosscord/api/schema/Member";
 import { In } from "typeorm";
 
 const router = Router();
diff --git a/api/src/routes/guilds/#guild_id/members/index.ts b/api/src/routes/guilds/#guild_id/members/index.ts
index 0bfd71cb..198d6946 100644
--- a/api/src/routes/guilds/#guild_id/members/index.ts
+++ b/api/src/routes/guilds/#guild_id/members/index.ts
@@ -1,6 +1,6 @@
 import { Request, Response, Router } from "express";
 import { Guild, Member, PublicMemberProjection } from "@fosscord/util";
-import { instanceOf, Length } from "../../../../util/instanceOf";
+import { instanceOf, Length } from "@fosscord/api";
 import { MoreThan } from "typeorm";
 
 const router = Router();
diff --git a/api/src/routes/guilds/#guild_id/regions.ts b/api/src/routes/guilds/#guild_id/regions.ts
index 212c9bcd..86208b79 100644
--- a/api/src/routes/guilds/#guild_id/regions.ts
+++ b/api/src/routes/guilds/#guild_id/regions.ts
@@ -1,7 +1,7 @@
-import {Config, Guild, Member} from "@fosscord/util";
+import { Config, Guild, Member } from "@fosscord/util";
 import { Request, Response, Router } from "express";
-import {getVoiceRegions} from "../../../util/Voice";
-import {getIpAdress} from "../../../util/ipAddress";
+import { getVoiceRegions } from "@fosscord/api";
+import { getIpAdress } from "@fosscord/api";
 
 const router = Router();
 
diff --git a/api/src/routes/guilds/#guild_id/roles.ts b/api/src/routes/guilds/#guild_id/roles.ts
index 6a318688..76dd47c5 100644
--- a/api/src/routes/guilds/#guild_id/roles.ts
+++ b/api/src/routes/guilds/#guild_id/roles.ts
@@ -12,7 +12,7 @@ import {
 } from "@fosscord/util";
 import { HTTPError } from "lambert-server";
 
-import { check } from "../../../util/instanceOf";
+import { check } from "@fosscord/api";
 import { RoleModifySchema, RolePositionUpdateSchema } from "../../../schema/Roles";
 import { DiscordApiErrors } from "@fosscord/util";
 import { In } from "typeorm";
diff --git a/api/src/routes/guilds/#guild_id/templates.ts b/api/src/routes/guilds/#guild_id/templates.ts
index a7613abf..e9304e11 100644
--- a/api/src/routes/guilds/#guild_id/templates.ts
+++ b/api/src/routes/guilds/#guild_id/templates.ts
@@ -2,8 +2,8 @@ import { Request, Response, Router } from "express";
 import { Guild, getPermission, Template } from "@fosscord/util";
 import { HTTPError } from "lambert-server";
 import { TemplateCreateSchema, TemplateModifySchema } from "../../../schema/Template";
-import { check } from "../../../util/instanceOf";
-import { generateCode } from "../../../util/String";
+import { check } from "@fosscord/api";
+import { generateCode } from "@fosscord/api";
 
 const router: Router = Router();
 
diff --git a/api/src/routes/guilds/#guild_id/vanity-url.ts b/api/src/routes/guilds/#guild_id/vanity-url.ts
index 58940b42..f1887cc0 100644
--- a/api/src/routes/guilds/#guild_id/vanity-url.ts
+++ b/api/src/routes/guilds/#guild_id/vanity-url.ts
@@ -1,7 +1,7 @@
 import { Channel, ChannelType, getPermission, Guild, Invite, trimSpecial } from "@fosscord/util";
 import { Router, Request, Response } from "express";
 import { HTTPError } from "lambert-server";
-import { check, Length } from "../../../util/instanceOf";
+import { check, Length } from "@fosscord/api";
 
 const router = Router();
 
diff --git a/api/src/routes/guilds/#guild_id/voice-states/#user_id/index.ts b/api/src/routes/guilds/#guild_id/voice-states/#user_id/index.ts
index 02951f81..447e15c1 100644
--- a/api/src/routes/guilds/#guild_id/voice-states/#user_id/index.ts
+++ b/api/src/routes/guilds/#guild_id/voice-states/#user_id/index.ts
@@ -1,15 +1,15 @@
-import { check } from "../../../../../util/instanceOf";
+import { check } from "@fosscord/api";
 import { VoiceStateUpdateSchema } from "../../../../../schema";
 import { Request, Response, Router } from "express";
-import { updateVoiceState } from "../../../../../util/VoiceState";
+import { updateVoiceState } from "@fosscord/api";
 
 const router = Router();
 
 router.patch("/", check(VoiceStateUpdateSchema), async (req: Request, res: Response) => {
 	const body = req.body as VoiceStateUpdateSchema;
 	const { guild_id, user_id } = req.params;
-	await updateVoiceState(body, guild_id, req.user_id, user_id)
+	await updateVoiceState(body, guild_id, req.user_id, user_id);
 	return res.sendStatus(204);
 });
 
-export default router;
\ No newline at end of file
+export default router;
diff --git a/api/src/routes/guilds/#guild_id/voice-states/@me/index.ts b/api/src/routes/guilds/#guild_id/voice-states/@me/index.ts
index 42ba543e..b637ff66 100644
--- a/api/src/routes/guilds/#guild_id/voice-states/@me/index.ts
+++ b/api/src/routes/guilds/#guild_id/voice-states/@me/index.ts
@@ -1,15 +1,15 @@
-import { check } from "../../../../../util/instanceOf";
+import { check } from "@fosscord/api";
 import { VoiceStateUpdateSchema } from "../../../../../schema";
 import { Request, Response, Router } from "express";
-import { updateVoiceState } from "../../../../../util/VoiceState";
+import { updateVoiceState } from "@fosscord/api";
 
 const router = Router();
 
 router.patch("/", check(VoiceStateUpdateSchema), async (req: Request, res: Response) => {
 	const body = req.body as VoiceStateUpdateSchema;
 	const { guild_id } = req.params;
-	await updateVoiceState(body, guild_id, req.user_id)
+	await updateVoiceState(body, guild_id, req.user_id);
 	return res.sendStatus(204);
 });
 
-export default router;
\ No newline at end of file
+export default router;
diff --git a/api/src/routes/guilds/#guild_id/welcome_screen.ts b/api/src/routes/guilds/#guild_id/welcome_screen.ts
index defbcd40..7ca49b4e 100644
--- a/api/src/routes/guilds/#guild_id/welcome_screen.ts
+++ b/api/src/routes/guilds/#guild_id/welcome_screen.ts
@@ -2,7 +2,7 @@ import { Request, Response, Router } from "express";
 import { Guild, getPermission, Snowflake, Member } from "@fosscord/util";
 import { HTTPError } from "lambert-server";
 
-import { check } from "../../../util/instanceOf";
+import { check } from "@fosscord/api";
 import { GuildUpdateWelcomeScreenSchema } from "../../../schema/Guild";
 
 const router: Router = Router();
diff --git a/api/src/routes/guilds/#guild_id/widget.json.ts b/api/src/routes/guilds/#guild_id/widget.json.ts
index 193ed095..f871fac8 100644
--- a/api/src/routes/guilds/#guild_id/widget.json.ts
+++ b/api/src/routes/guilds/#guild_id/widget.json.ts
@@ -1,7 +1,7 @@
 import { Request, Response, Router } from "express";
 import { Config, Permissions, Guild, Invite, Channel, Member } from "@fosscord/util";
 import { HTTPError } from "lambert-server";
-import { random } from "../../../util/RandomInviteID";
+import { random } from "@fosscord/api";
 
 const router: Router = Router();
 
diff --git a/api/src/routes/guilds/#guild_id/widget.ts b/api/src/routes/guilds/#guild_id/widget.ts
index fcf71402..d9ce817e 100644
--- a/api/src/routes/guilds/#guild_id/widget.ts
+++ b/api/src/routes/guilds/#guild_id/widget.ts
@@ -1,7 +1,7 @@
 import { Request, Response, Router } from "express";
 import { getPermission, Guild } from "@fosscord/util";
 import { HTTPError } from "lambert-server";
-import { check } from "../../../util/instanceOf";
+import { check } from "@fosscord/api";
 import { WidgetModifySchema } from "../../../schema/Widget";
 
 const router: Router = Router();
diff --git a/api/src/routes/guilds/index.ts b/api/src/routes/guilds/index.ts
index e5830647..a1b199e7 100644
--- a/api/src/routes/guilds/index.ts
+++ b/api/src/routes/guilds/index.ts
@@ -1,7 +1,7 @@
 import { Router, Request, Response } from "express";
 import { Role, Guild, Snowflake, Config, User, Member, Channel } from "@fosscord/util";
 import { HTTPError } from "lambert-server";
-import { check } from "./../../util/instanceOf";
+import { check } from "@fosscord/api";
 import { GuildCreateSchema } from "../../schema/Guild";
 import { DiscordApiErrors } from "@fosscord/util";
 
diff --git a/api/src/routes/guilds/templates/index.ts b/api/src/routes/guilds/templates/index.ts
index 58201f65..1d0f2716 100644
--- a/api/src/routes/guilds/templates/index.ts
+++ b/api/src/routes/guilds/templates/index.ts
@@ -3,7 +3,7 @@ const router: Router = Router();
 import { Template, Guild, Role, Snowflake, Config, User, Member } from "@fosscord/util";
 import { HTTPError } from "lambert-server";
 import { GuildTemplateCreateSchema } from "../../../schema/Guild";
-import { check } from "../../../util/instanceOf";
+import { check } from "@fosscord/api";
 import { DiscordApiErrors } from "@fosscord/util";
 
 router.get("/:code", async (req: Request, res: Response) => {
diff --git a/api/src/routes/users/#id/index.ts b/api/src/routes/users/#id/index.ts
index 3841756b..07956360 100644
--- a/api/src/routes/users/#id/index.ts
+++ b/api/src/routes/users/#id/index.ts
@@ -1,5 +1,5 @@
 import { Router, Request, Response } from "express";
-import { User } from "../../../../../util/dist";
+import { User } from "@fosscord/util";
 
 const router: Router = Router();
 
diff --git a/api/src/routes/users/#id/profile.ts b/api/src/routes/users/#id/profile.ts
index 8be03b47..0f43a82f 100644
--- a/api/src/routes/users/#id/profile.ts
+++ b/api/src/routes/users/#id/profile.ts
@@ -1,5 +1,5 @@
 import { Router, Request, Response } from "express";
-import { PublicConnectedAccount, PublicUser, User, UserPublic } from "../../../../../util/dist";
+import { PublicConnectedAccount, PublicUser, User, UserPublic } from "@fosscord/util";
 
 const router: Router = Router();
 
diff --git a/api/src/routes/users/@me/channels.ts b/api/src/routes/users/@me/channels.ts
index 6fd396b8..77fc8296 100644
--- a/api/src/routes/users/@me/channels.ts
+++ b/api/src/routes/users/@me/channels.ts
@@ -1,11 +1,9 @@
 import { Router, Request, Response } from "express";
-import { Channel, ChannelCreateEvent, ChannelType, Snowflake, trimSpecial, User, emitEvent } from "@fosscord/util";
+import { Channel, ChannelCreateEvent, ChannelType, Snowflake, trimSpecial, User, emitEvent, Recipient } from "@fosscord/util";
 import { HTTPError } from "lambert-server";
-
 import { DmChannelCreateSchema } from "../../../schema/Channel";
-import { check } from "../../../util/instanceOf";
+import { check } from "@fosscord/api";
 import { In } from "typeorm";
-import { Recipient } from "../../../../../util/dist/entities/Recipient";
 
 const router: Router = Router();
 
diff --git a/api/src/routes/users/@me/index.ts b/api/src/routes/users/@me/index.ts
index 68649215..451a657c 100644
--- a/api/src/routes/users/@me/index.ts
+++ b/api/src/routes/users/@me/index.ts
@@ -1,8 +1,8 @@
 import { Router, Request, Response } from "express";
 import { User, PrivateUserProjection } from "@fosscord/util";
 import { UserModifySchema } from "../../../schema/User";
-import { check } from "../../../util/instanceOf";
-import { handleFile } from "../../../util/cdn";
+import { check } from "@fosscord/api";
+import { handleFile } from "@fosscord/api";
 
 const router: Router = Router();
 
diff --git a/api/src/routes/users/@me/relationships.ts b/api/src/routes/users/@me/relationships.ts
index 995b0244..67ca2f35 100644
--- a/api/src/routes/users/@me/relationships.ts
+++ b/api/src/routes/users/@me/relationships.ts
@@ -12,7 +12,7 @@ import { Router, Response, Request } from "express";
 import { HTTPError } from "lambert-server";
 import { DiscordApiErrors } from "@fosscord/util";
 
-import { check, Length } from "../../../util/instanceOf";
+import { check, Length } from "@fosscord/api";
 
 const router = Router();
 
diff --git a/api/src/routes/users/@me/settings.ts b/api/src/routes/users/@me/settings.ts
index 90ee6372..e7db85ed 100644
--- a/api/src/routes/users/@me/settings.ts
+++ b/api/src/routes/users/@me/settings.ts
@@ -1,6 +1,6 @@
 import { Router, Response, Request } from "express";
 import { User, UserSettings } from "@fosscord/util";
-import { check } from "../../../util/instanceOf";
+import { check } from "@fosscord/api";
 import { UserSettingsSchema } from "../../../schema/User";
 
 const router = Router();
diff --git a/api/src/routes/voice/regions.ts b/api/src/routes/voice/regions.ts
index 812aa8f6..da1aaade 100644
--- a/api/src/routes/voice/regions.ts
+++ b/api/src/routes/voice/regions.ts
@@ -1,11 +1,11 @@
 import { Router, Request, Response } from "express";
-import {getIpAdress} from "../../util/ipAddress";
-import {getVoiceRegions} from "../../util/Voice";
+import { getIpAdress } from "@fosscord/api";
+import { getVoiceRegions } from "@fosscord/api";
 
 const router: Router = Router();
 
 router.get("/", async (req: Request, res: Response) => {
-    res.json(await getVoiceRegions(getIpAdress(req), true))//vip true?
+	res.json(await getVoiceRegions(getIpAdress(req), true)); //vip true?
 });
 
 export default router;
diff --git a/api/src/test/password_test.ts b/api/src/test/password_test.ts
index 59d36621..983b18ae 100644
--- a/api/src/test/password_test.ts
+++ b/api/src/test/password_test.ts
@@ -1,12 +1,12 @@
-import { check } from "./../util/passwordStrength";
+import { checkPassword } from "@fosscord/api";
 
-console.log(check("123456789012345"));
+console.log(checkPassword("123456789012345"));
 // -> 0.25
-console.log(check("ABCDEFGHIJKLMOPQ"));
+console.log(checkPassword("ABCDEFGHIJKLMOPQ"));
 // -> 0.25
-console.log(check("ABC123___...123"));
+console.log(checkPassword("ABC123___...123"));
 // ->
-console.log(check(""));
+console.log(checkPassword(""));
 // ->
-// console.log(check(""));
+// console.log(checkPassword(""));
 // // ->
diff --git a/api/src/util/index.ts b/api/src/util/index.ts
new file mode 100644
index 00000000..43481289
--- /dev/null
+++ b/api/src/util/index.ts
@@ -0,0 +1,11 @@
+export * from "./Base64";
+export * from "./cdn";
+export * from "./instanceOf";
+export * from "./ipAddress";
+export * from "./Message";
+export * from "./passwordStrength";
+export * from "./RandomInviteID";
+export * from "./route";
+export * from "./String";
+export * from "./Voice";
+export * from "./VoiceState";
diff --git a/api/src/util/passwordStrength.ts b/api/src/util/passwordStrength.ts
index dfffa2c0..047df008 100644
--- a/api/src/util/passwordStrength.ts
+++ b/api/src/util/passwordStrength.ts
@@ -16,7 +16,7 @@ const blocklist: string[] = []; // TODO: update ones passwordblocklist is stored
  *
  * Returns: 0 > pw > 1
  */
-export function check(password: string): number {
+export function checkPassword(password: string): number {
 	const { minLength, minNumbers, minUpperCase, minSymbols } = Config.get().register.password;
 	var strength = 0;
 
diff --git a/api/tests/automatic.test.js b/api/tests/automatic.test.js
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/api/tests/automatic.test.js
diff --git a/api/tsconfig.json b/api/tsconfig.json
index 6bf2e6b7..21a8eb96 100644
--- a/api/tsconfig.json
+++ b/api/tsconfig.json
@@ -63,6 +63,11 @@
 
 		/* Advanced Options */
 		"skipLibCheck": true /* Skip type checking of declaration files. */,
-		"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
+		"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
+		"baseUrl": ".",
+		"paths": {
+			"@fosscord/api": ["src/index.ts"],
+			"@fosscord/api/*": ["src/*"]
+		}
 	}
 }