Skip to content

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

♻️ Remove backend package (#1305)

Luke Vellad40d4b27e264
diff --git a/apps/landing/next.config.js b/apps/landing/next.config.js
index 8bff191e7..2476aa89d 100644
--- a/apps/landing/next.config.js
+++ b/apps/landing/next.config.js
@@ -19,12 +19,7 @@ const nextConfig = {
i18n: i18n,
productionBrowserSourceMaps: true,
output: "standalone",
- transpilePackages: [
- "@rallly/backend",
- "@rallly/icons",
- "@rallly/ui",
- "@rallly/tailwind-config",
- ],
+ transpilePackages: ["@rallly/icons", "@rallly/ui", "@rallly/tailwind-config"],
webpack(config) {
config.module.rules.push({
test: /\.svg$/,
diff --git a/apps/web/next.config.js b/apps/web/next.config.js
index 099650e36..6c589a629 100644
--- a/apps/web/next.config.js
+++ b/apps/web/next.config.js
@@ -18,7 +18,6 @@ const nextConfig = {
process.env.NEXT_PUBLIC_SELF_HOSTED === "true" ? "standalone" : undefined,
productionBrowserSourceMaps: true,
transpilePackages: [
- "@rallly/backend",
"@rallly/database",
"@rallly/icons",
"@rallly/ui",
diff --git a/apps/web/package.json b/apps/web/package.json
index f7573363b..672379c3b 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -24,14 +24,13 @@
"@next/bundle-analyzer": "^12.3.4",
"@radix-ui/react-slot": "^1.0.1",
"@radix-ui/react-switch": "^1.0.2",
- "@rallly/backend": "*",
"@rallly/billing": "*",
"@rallly/database": "*",
+ "@rallly/emails": "*",
"@rallly/icons": "*",
"@rallly/languages": "*",
"@rallly/tailwind-config": "*",
"@rallly/ui": "*",
- "@rallly/emails": "*",
"@sentry/nextjs": "*",
"@svgr/webpack": "^6.5.1",
"@t3-oss/env-nextjs": "^0.11.0",
@@ -40,6 +39,7 @@
"@trpc/client": "^10.13.0",
"@trpc/next": "^10.13.0",
"@trpc/react-query": "^10.13.0",
+ "@trpc/server": "^10.13.0",
"@upstash/ratelimit": "^1.2.1",
"@vercel/functions": "^1.0.2",
"@vercel/kv": "^2.0.0",
@@ -51,9 +51,9 @@
"cookie": "^0.6.0",
"crypto": "^1.0.1",
"dayjs": "^1.11.10",
- "i18next": "^22.4.9",
"i18next-icu": "^2.3.0",
"i18next-resources-to-backend": "^1.1.4",
+ "i18next": "^22.4.9",
"ics": "^3.1.0",
"intl-messageformat": "^10.3.4",
"iron-session": "^6.3.1",
@@ -71,8 +71,8 @@
"posthog-js": "^1.154.0",
"posthog-node": "^4.0.1",
"react-big-calendar": "^1.8.1",
- "react-hook-form": "^7.42.1",
"react-hook-form-persist": "^3.0.0",
+ "react-hook-form": "^7.42.1",
"react-i18next": "^12.1.4",
"react-remove-scroll": "^2.5.6",
"react-use": "^17.4.0",
diff --git a/apps/web/src/app/guest.ts b/apps/web/src/app/guest.ts
index 14ae378cb..55096a8f4 100644
--- a/apps/web/src/app/guest.ts
+++ b/apps/web/src/app/guest.ts
@@ -1,8 +1,8 @@
-import { randomid } from "@rallly/backend/utils/nanoid";
import { NextRequest, NextResponse } from "next/server";
import { encode, JWT } from "next-auth/jwt";
import { absoluteUrl } from "@/utils/absolute-url";
+import { randomid } from "@/utils/nanoid";
function getCookieSettings() {
const secure = absoluteUrl().startsWith("https://");
diff --git a/apps/web/src/app/providers.tsx b/apps/web/src/app/providers.tsx
index aa77b46dc..cc3a96405 100644
--- a/apps/web/src/app/providers.tsx
+++ b/apps/web/src/app/providers.tsx
@@ -1,5 +1,4 @@
"use client";
-import { AppRouter } from "@rallly/backend/trpc/routers";
import { TooltipProvider } from "@rallly/ui/tooltip";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { createTRPCReact } from "@trpc/react-query";
@@ -9,6 +8,7 @@ import { useState } from "react";
import { I18nProvider } from "@/app/i18n/client";
import { UserProvider } from "@/components/user-provider";
+import { AppRouter } from "@/trpc/routers";
import { ConnectedDayjsProvider } from "@/utils/dayjs";
import { trpcConfig } from "@/utils/trpc/config";
diff --git a/apps/web/src/pages/[locale]/auth/disable-notifications.tsx b/apps/web/src/pages/[locale]/auth/disable-notifications.tsx
index 00a980306..dc3bc1594 100644
--- a/apps/web/src/pages/[locale]/auth/disable-notifications.tsx
+++ b/apps/web/src/pages/[locale]/auth/disable-notifications.tsx
@@ -1,9 +1,9 @@
-import { DisableNotificationsPayload } from "@rallly/backend";
-import { decryptToken } from "@rallly/backend/session";
import { prisma } from "@rallly/database";
import { GetServerSideProps } from "next";
+import type { DisableNotificationsPayload } from "@/trpc/types";
import { getServerSession } from "@/utils/auth";
+import { decryptToken } from "@/utils/session";
const Page = () => {
return null;
diff --git a/apps/web/src/pages/api/trpc/[trpc].ts b/apps/web/src/pages/api/trpc/[trpc].ts
index e1e4a0140..e525926d0 100644
--- a/apps/web/src/pages/api/trpc/[trpc].ts
+++ b/apps/web/src/pages/api/trpc/[trpc].ts
@@ -1,5 +1,3 @@
-import { createTRPCContext } from "@rallly/backend/trpc/context";
-import { AppRouter, appRouter } from "@rallly/backend/trpc/routers";
import * as Sentry from "@sentry/nextjs";
import { createNextApiHandler } from "@trpc/server/adapters/next";
import { Ratelimit } from "@upstash/ratelimit";
@@ -7,6 +5,8 @@ import { kv } from "@vercel/kv";
import requestIp from "request-ip";
import { posthog, posthogApiHandler } from "@/app/posthog";
+import { createTRPCContext } from "@/trpc/context";
+import { AppRouter, appRouter } from "@/trpc/routers";
import { absoluteUrl, shortUrl } from "@/utils/absolute-url";
import { getServerSession, isEmailBlocked } from "@/utils/auth";
import { isSelfHosted } from "@/utils/constants";
diff --git a/packages/backend/trpc/context.ts b/apps/web/src/trpc/context.ts
similarity index 100%
rename from packages/backend/trpc/context.ts
rename to apps/web/src/trpc/context.ts
diff --git a/packages/backend/trpc/routers/auth.ts b/apps/web/src/trpc/routers/auth.ts
similarity index 96%
rename from packages/backend/trpc/routers/auth.ts
rename to apps/web/src/trpc/routers/auth.ts
index db6ece5f0..2217d750c 100644
--- a/packages/backend/trpc/routers/auth.ts
+++ b/apps/web/src/trpc/routers/auth.ts
@@ -1,8 +1,9 @@
import { prisma } from "@rallly/database";
import { z } from "zod";
-import { createToken, decryptToken } from "../../session";
-import { generateOtp } from "../../utils/nanoid";
+import { generateOtp } from "@/utils/nanoid";
+import { createToken, decryptToken } from "@/utils/session";
+
import { publicProcedure, rateLimitMiddleware, router } from "../trpc";
import { RegistrationTokenPayload } from "../types";
diff --git a/packages/backend/trpc/routers/dashboard.ts b/apps/web/src/trpc/routers/dashboard.ts
similarity index 100%
rename from packages/backend/trpc/routers/dashboard.ts
rename to apps/web/src/trpc/routers/dashboard.ts
diff --git a/packages/backend/trpc/routers/index.ts b/apps/web/src/trpc/routers/index.ts
similarity index 100%
rename from packages/backend/trpc/routers/index.ts
rename to apps/web/src/trpc/routers/index.ts
diff --git a/packages/backend/trpc/routers/polls.ts b/apps/web/src/trpc/routers/polls.ts
similarity index 100%
rename from packages/backend/trpc/routers/polls.ts
rename to apps/web/src/trpc/routers/polls.ts
diff --git a/packages/backend/trpc/routers/polls/comments.ts b/apps/web/src/trpc/routers/polls/comments.ts
similarity index 98%
rename from packages/backend/trpc/routers/polls/comments.ts
rename to apps/web/src/trpc/routers/polls/comments.ts
index 47fabcc8a..8c1e464a8 100644
--- a/packages/backend/trpc/routers/polls/comments.ts
+++ b/apps/web/src/trpc/routers/polls/comments.ts
@@ -1,7 +1,8 @@
import { prisma } from "@rallly/database";
import { z } from "zod";
-import { createToken } from "../../../session";
+import { createToken } from "@/utils/session";
+
import { publicProcedure, router } from "../../trpc";
import { DisableNotificationsPayload } from "../../types";
diff --git a/packages/backend/trpc/routers/polls/participants.ts b/apps/web/src/trpc/routers/polls/participants.ts
similarity index 99%
rename from packages/backend/trpc/routers/polls/participants.ts
rename to apps/web/src/trpc/routers/polls/participants.ts
index 7b8cb542d..954d0c6d1 100644
--- a/packages/backend/trpc/routers/polls/participants.ts
+++ b/apps/web/src/trpc/routers/polls/participants.ts
@@ -2,7 +2,8 @@ import { prisma } from "@rallly/database";
import { TRPCError } from "@trpc/server";
import { z } from "zod";
-import { createToken } from "../../../session";
+import { createToken } from "@/utils/session";
+
import { publicProcedure, rateLimitMiddleware, router } from "../../trpc";
import { DisableNotificationsPayload } from "../../types";
diff --git a/packages/backend/trpc/routers/scheduled-events.ts b/apps/web/src/trpc/routers/scheduled-events.ts
similarity index 100%
rename from packages/backend/trpc/routers/scheduled-events.ts
rename to apps/web/src/trpc/routers/scheduled-events.ts
diff --git a/packages/backend/trpc/routers/user.ts b/apps/web/src/trpc/routers/user.ts
similarity index 98%
rename from packages/backend/trpc/routers/user.ts
rename to apps/web/src/trpc/routers/user.ts
index cf5c5b870..4c61cc428 100644
--- a/packages/backend/trpc/routers/user.ts
+++ b/apps/web/src/trpc/routers/user.ts
@@ -1,7 +1,8 @@
import { prisma } from "@rallly/database";
import { z } from "zod";
-import { getSubscriptionStatus } from "../../utils/auth";
+import { getSubscriptionStatus } from "@/utils/subscription";
+
import {
possiblyPublicProcedure,
privateProcedure,
diff --git a/packages/backend/trpc/trpc.ts b/apps/web/src/trpc/trpc.ts
similarity index 96%
rename from packages/backend/trpc/trpc.ts
rename to apps/web/src/trpc/trpc.ts
index 24cd1c009..fabda8f16 100644
--- a/packages/backend/trpc/trpc.ts
+++ b/apps/web/src/trpc/trpc.ts
@@ -1,7 +1,8 @@
import { initTRPC, TRPCError } from "@trpc/server";
import superjson from "superjson";
-import { getSubscriptionStatus } from "../utils/auth";
+import { getSubscriptionStatus } from "@/utils/subscription";
+
import { TRPCContext } from "./context";
const t = initTRPC.context<TRPCContext>().create({
diff --git a/packages/backend/trpc/types.ts b/apps/web/src/trpc/types.ts
similarity index 100%
rename from packages/backend/trpc/types.ts
rename to apps/web/src/trpc/types.ts
diff --git a/apps/web/src/utils/auth.ts b/apps/web/src/utils/auth.ts
index e45e54fec..940b6d19e 100644
--- a/apps/web/src/utils/auth.ts
+++ b/apps/web/src/utils/auth.ts
@@ -1,6 +1,3 @@
-import { RegistrationTokenPayload } from "@rallly/backend";
-import { decryptToken } from "@rallly/backend/session";
-import { generateOtp, randomid } from "@rallly/backend/utils/nanoid";
import { prisma } from "@rallly/database";
import {
GetServerSidePropsContext,
@@ -19,11 +16,14 @@ import { Provider } from "next-auth/providers/index";
import { posthog } from "@/app/posthog";
import { env } from "@/env";
+import type { RegistrationTokenPayload } from "@/trpc/types";
import { absoluteUrl } from "@/utils/absolute-url";
import { CustomPrismaAdapter } from "@/utils/auth/custom-prisma-adapter";
import { mergeGuestsIntoUser } from "@/utils/auth/merge-user";
import { getEmailClient } from "@/utils/emails";
import { getValueByPath } from "@/utils/get-value-by-path";
+import { generateOtp, randomid } from "@/utils/nanoid";
+import { decryptToken } from "@/utils/session";
const providers: Provider[] = [
// When a user registers, we don't want to go through the email verification process
diff --git a/packages/backend/utils/date.ts b/apps/web/src/utils/date.ts
similarity index 100%
rename from packages/backend/utils/date.ts
rename to apps/web/src/utils/date.ts
diff --git a/packages/backend/utils/nanoid.ts b/apps/web/src/utils/nanoid.ts
similarity index 100%
rename from packages/backend/utils/nanoid.ts
rename to apps/web/src/utils/nanoid.ts
diff --git a/packages/backend/session.ts b/apps/web/src/utils/session/index.ts
similarity index 100%
rename from packages/backend/session.ts
rename to apps/web/src/utils/session/index.ts
diff --git a/packages/backend/session-config.ts b/apps/web/src/utils/session/session-config.ts
similarity index 100%
rename from packages/backend/session-config.ts
rename to apps/web/src/utils/session/session-config.ts
diff --git a/packages/backend/utils/auth.ts b/apps/web/src/utils/subscription.ts
similarity index 100%
rename from packages/backend/utils/auth.ts
rename to apps/web/src/utils/subscription.ts
diff --git a/apps/web/src/utils/trpc/client.ts b/apps/web/src/utils/trpc/client.ts
index 557f31602..d5017dee2 100644
--- a/apps/web/src/utils/trpc/client.ts
+++ b/apps/web/src/utils/trpc/client.ts
@@ -1,6 +1,6 @@
-import { AppRouter } from "@rallly/backend/trpc/routers";
import { createTRPCNext } from "@trpc/next";
+import type { AppRouter } from "@/trpc/routers";
import { trpcConfig } from "@/utils/trpc/config";
export const trpc = createTRPCNext<AppRouter>({
diff --git a/packages/backend/.eslintrc.js b/packages/backend/.eslintrc.js
deleted file mode 100644
index 3d9be6e61..000000000
--- a/packages/backend/.eslintrc.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/** @type {import("eslint").Linter.Config} */
-module.exports = {
- ...require("@rallly/eslint-config")(__dirname),
-};
diff --git a/packages/backend/index.ts b/packages/backend/index.ts
deleted file mode 100644
index b2dc61224..000000000
--- a/packages/backend/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from "./trpc/types";
diff --git a/packages/backend/next/edge.ts b/packages/backend/next/edge.ts
deleted file mode 100644
index 57397898e..000000000
--- a/packages/backend/next/edge.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import type { IncomingMessage, ServerResponse } from "http";
-import { getIronSession } from "iron-session/edge";
-
-import { sessionConfig } from "../session-config";
-
-export const getSession = async (
- req: Request | IncomingMessage,
- res: Response | ServerResponse,
-) => {
- return getIronSession(req, res, sessionConfig);
-};
diff --git a/packages/backend/next/index.ts b/packages/backend/next/index.ts
deleted file mode 100644
index 178cd64f8..000000000
--- a/packages/backend/next/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from "./utils";
diff --git a/packages/backend/next/utils.ts b/packages/backend/next/utils.ts
deleted file mode 100644
index c46dfce00..000000000
--- a/packages/backend/next/utils.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { GetServerSideProps } from "next";
-
-export function composeGetServerSideProps(
- ...fns: GetServerSideProps[]
-): GetServerSideProps {
- return async (ctx) => {
- const res = { props: {} };
- for (const getServerSideProps of fns) {
- const fnRes = await getServerSideProps(ctx);
-
- if ("notFound" in fnRes) {
- return fnRes;
- }
-
- if ("redirect" in fnRes) {
- return fnRes;
- }
-
- if ("props" in fnRes) {
- res.props = {
- ...res.props,
- ...fnRes.props,
- };
- }
- }
-
- return res;
- };
-}
diff --git a/packages/backend/package.json b/packages/backend/package.json
deleted file mode 100644
index 720b63969..000000000
--- a/packages/backend/package.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "name": "@rallly/backend",
- "version": "0.0.0",
- "private": true,
- "scripts": {
- "lint": "eslint .",
- "type-check": "tsc --pretty --noEmit"
- },
- "main": "src/index.ts",
- "types": "src/index.ts",
- "dependencies": {
- "@rallly/database": "*",
- "@rallly/features": "*",
- "@rallly/emails": "*",
- "@rallly/utils": "*",
- "@trpc/server": "^10.13.0",
- "iron-session": "^6.3.1",
- "spacetime": "^7.4.7",
- "stripe": "^13.2.0"
- }
-}
diff --git a/packages/backend/tsconfig.json b/packages/backend/tsconfig.json
deleted file mode 100644
index beac8603e..000000000
--- a/packages/backend/tsconfig.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "extends": "@rallly/tsconfig/next.json",
- "include": ["**/*.ts", "**/*.tsx", "**/*.js"],
- "exclude": ["node_modules"],
-}
diff --git a/yarn.lock b/yarn.lock
index ff8d83013..6d9994a9c 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4943,9 +4943,9 @@
integrity sha512-pCLZfIgcnneq1AocPLvstALawZYWS/sbhujd4mwUwA3UXFBWC/D31ysPlbz7R1dhjxhhPaIM+C6pz8vmr2ctpw==
"@trpc/server@^10.13.0":
- version "10.13.2"
- resolved "https://registry.npmjs.org/@trpc/server/-/server-10.13.2.tgz"
- integrity sha512-/5L09a7EHxRy1D6RIFsIt5fMJ8bBspMp/eDPjAH7T033f9AMyYx0jWU7r5lswoBVSbdUDJgxKyLzwXIrVNVisg==
+ version "10.45.2"
+ resolved "https://registry.yarnpkg.com/@trpc/server/-/server-10.45.2.tgz#5f2778c4810f93b5dc407146334f8da70a0b51fb"
+ integrity sha512-wOrSThNNE4HUnuhJG6PfDRp4L2009KDVxsd+2VYH8ro6o/7/jwYZ8Uu5j+VaW+mOmc8EHerHzGcdbGNQSAUPgg==
"@trysound/[email protected]":
version "0.2.0"