Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

♻️ Inline @rallly/api-core into web app (#2448)

Luke Vellae0d4e9be0351
diff --git a/apps/web/package.json b/apps/web/package.json
index e6a3329bb..671fd296a 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -36,7 +36,6 @@
"@radix-ui/react-select": "^2.2.2",
"@radix-ui/react-slot": "^1.1.2",
"@radix-ui/react-switch": "^1.0.2",
- "@rallly/api-core": "workspace:*",
"@rallly/billing": "workspace:*",
"@rallly/database": "workspace:*",
"@rallly/emails": "workspace:*",
diff --git a/apps/web/src/app/api/private/[...route]/route.test.ts b/apps/web/src/app/api/private/[...route]/route.test.ts
index ebe2d14b4..0c4b0ec83 100644
--- a/apps/web/src/app/api/private/[...route]/route.test.ts
+++ b/apps/web/src/app/api/private/[...route]/route.test.ts
@@ -8,12 +8,12 @@ const mockCreatePoll = vi.fn();
const mockGetPollResults = vi.fn();
const mockGetPollParticipants = vi.fn();
-vi.mock("@rallly/api-core/polls/mutations", () => ({
+vi.mock("@/features/poll/mutations", () => ({
deletePoll: (...args: unknown[]) => mockDeletePoll(...args),
createPoll: (...args: unknown[]) => mockCreatePoll(...args),
}));
-vi.mock("@rallly/api-core/polls/data", () => ({
+vi.mock("@/features/poll/data", () => ({
getPollResults: (...args: unknown[]) => mockGetPollResults(...args),
getPollParticipants: (...args: unknown[]) => mockGetPollParticipants(...args),
}));
diff --git a/apps/web/src/app/api/private/[...route]/route.ts b/apps/web/src/app/api/private/[...route]/route.ts
index 127a82651..a78beed30 100644
--- a/apps/web/src/app/api/private/[...route]/route.ts
+++ b/apps/web/src/app/api/private/[...route]/route.ts
@@ -1,9 +1,4 @@
import { RedisStore } from "@hono-rate-limiter/redis";
-import {
- getPollParticipants,
- getPollResults,
-} from "@rallly/api-core/polls/data";
-import { createPoll, deletePoll } from "@rallly/api-core/polls/mutations";
import { prisma } from "@rallly/database";
import { absoluteUrl, shortUrl } from "@rallly/utils/absolute-url";
import { Scalar } from "@scalar/hono-api-reference";
@@ -16,6 +11,8 @@ import {
validator,
} from "hono-openapi";
import { rateLimiter } from "hono-rate-limiter";
+import { getPollParticipants, getPollResults } from "@/features/poll/data";
+import { createPoll, deletePoll } from "@/features/poll/mutations";
import { redis } from "@/lib/kv";
import {
createPollInputSchema,
diff --git a/apps/web/src/app/api/private/utils/api-key.ts b/apps/web/src/app/api/private/utils/api-key.ts
index fde418ada..94339af99 100644
--- a/apps/web/src/app/api/private/utils/api-key.ts
+++ b/apps/web/src/app/api/private/utils/api-key.ts
@@ -1,11 +1,8 @@
import crypto from "node:crypto";
-import {
- extractApiKeyPrefix,
- verifyApiKey,
-} from "@rallly/api-core/auth/api-key";
import { prisma } from "@rallly/database";
import { bearerAuth } from "hono/bearer-auth";
import { after } from "next/server";
+import { extractApiKeyPrefix, verifyApiKey } from "@/features/api-keys/api-key";
export const spaceApiKeyAuth = bearerAuth({
verifyToken: async (rawKey, c) => {
diff --git a/packages/api-core/src/auth/api-key.test.ts b/apps/web/src/features/api-keys/api-key.test.ts
similarity index 100%
rename from packages/api-core/src/auth/api-key.test.ts
rename to apps/web/src/features/api-keys/api-key.test.ts
diff --git a/packages/api-core/src/auth/api-key.ts b/apps/web/src/features/api-keys/api-key.ts
similarity index 100%
rename from packages/api-core/src/auth/api-key.ts
rename to apps/web/src/features/api-keys/api-key.ts
diff --git a/packages/api-core/src/polls/data.ts b/apps/web/src/features/poll/data.ts
similarity index 100%
rename from packages/api-core/src/polls/data.ts
rename to apps/web/src/features/poll/data.ts
diff --git a/packages/api-core/src/polls/mutations.ts b/apps/web/src/features/poll/mutations.ts
similarity index 100%
rename from packages/api-core/src/polls/mutations.ts
rename to apps/web/src/features/poll/mutations.ts
diff --git a/apps/web/src/trpc/routers/api-keys.ts b/apps/web/src/trpc/routers/api-keys.ts
index 37a513908..61cd3552e 100644
--- a/apps/web/src/trpc/routers/api-keys.ts
+++ b/apps/web/src/trpc/routers/api-keys.ts
@@ -1,7 +1,7 @@
-import { createApiKey } from "@rallly/api-core/auth/api-key";
import { prisma } from "@rallly/database";
import { TRPCError } from "@trpc/server";
import * as z from "zod";
+import { createApiKey } from "@/features/api-keys/api-key";
import { isApiAccessEnabled } from "@/features/developer/data";
import { router, spaceOwnerProcedure } from "../trpc";
diff --git a/apps/web/src/trpc/routers/polls.ts b/apps/web/src/trpc/routers/polls.ts
index 616ba7658..b402f4f40 100644
--- a/apps/web/src/trpc/routers/polls.ts
+++ b/apps/web/src/trpc/routers/polls.ts
@@ -1,4 +1,3 @@
-import { getPolls } from "@rallly/api-core/polls/data";
import type { PollStatus } from "@rallly/database";
import { prisma } from "@rallly/database";
import { sendFinalizeHostEmail } from "@rallly/emails/templates/finalized-host";
@@ -12,6 +11,7 @@ import * as z from "zod";
import { getInstanceBranding, getSpaceBranding } from "@/emails/branding";
import { posthog } from "@/features/analytics/posthog";
import { moderateContent } from "@/features/moderation";
+import { getPolls } from "@/features/poll/data";
import { canUserManagePoll } from "@/features/poll/helpers";
import { hasPollAdminAccess } from "@/features/poll/query";
import { formatEventDateTime } from "@/features/scheduled-event/utils";
diff --git a/packages/api-core/biome.json b/packages/api-core/biome.json
deleted file mode 100644
index c4a672504..000000000
--- a/packages/api-core/biome.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "$schema": "https://biomejs.dev/schemas/2.3.14/schema.json",
- "extends": "//"
-}
diff --git a/packages/api-core/package.json b/packages/api-core/package.json
deleted file mode 100644
index 4a1d704ff..000000000
--- a/packages/api-core/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "@rallly/api-core",
- "version": "0.0.0",
- "private": true,
- "scripts": {
- "test:unit": "vitest run",
- "type-check": "tsc --noEmit"
- },
- "exports": {
- "./*": "./src/*.ts"
- },
- "dependencies": {
- "@rallly/database": "workspace:*",
- "@rallly/logger": "workspace:*",
- "@rallly/utils": "workspace:*"
- },
- "devDependencies": {
- "@rallly/tsconfig": "workspace:*",
- "@types/node": "^24.1.0",
- "vitest": "^4.0.16"
- }
-}
diff --git a/packages/api-core/tsconfig.json b/packages/api-core/tsconfig.json
deleted file mode 100644
index 4959f2f61..000000000
--- a/packages/api-core/tsconfig.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "extends": "@rallly/tsconfig/node.json",
- "compilerOptions": {
- "types": ["vitest/globals", "node"],
- "lib": ["es2020"]
- },
- "include": ["**/*.ts"]
-}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 913424611..ba57be996 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -92,7 +92,7 @@ importers:
version: 8.1.0([email protected])
'@vercel/analytics':
specifier: ^1.5.0
dayjs:
specifier: ^1.11.13
version: 1.11.19
@@ -131,7 +131,7 @@ importers:
version: 6.0.0(@types/[email protected])([email protected])
next-seo:
specifier: ^6.1.0
pg:
specifier: ^8.17.1
version: 8.18.0
@@ -238,9 +238,6 @@ importers:
'@radix-ui/react-switch':
specifier: ^1.0.2
- '@rallly/api-core':
- specifier: workspace:*
- version: link:../../packages/api-core
'@rallly/billing':
specifier: workspace:*
version: link:../../packages/billing
@@ -525,28 +522,6 @@ importers:
specifier: ^4.0.16
- packages/api-core:
- dependencies:
- '@rallly/database':
- specifier: workspace:*
- version: link:../database
- '@rallly/logger':
- specifier: workspace:*
- version: link:../logger
- '@rallly/utils':
- specifier: workspace:*
- version: link:../utils
- devDependencies:
- '@rallly/tsconfig':
- specifier: workspace:*
- version: link:../tsconfig
- '@types/node':
- specifier: ^24.1.0
- version: 24.10.11
- vitest:
- specifier: ^4.0.16
-
packages/billing:
dependencies:
'@radix-ui/react-radio-group':
@@ -18184,7 +18159,7 @@ snapshots:
dependencies:
uncrypto: 0.1.3
optionalDependencies:
react: 19.2.6
@@ -21942,7 +21917,7 @@ snapshots:
react: 19.2.6
react-dom: 19.2.6([email protected])
dependencies:
react: 19.2.6