Skip to content

Commit 5e336af

Browse files
committed
[WEB-5040] feat: migrate admin app from Next.js to React Router
1 parent f266cd8 commit 5e336af

File tree

102 files changed

+2575
-1044
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+2575
-1044
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,4 @@ temp/
6666
.react-router/
6767
build/
6868
node_modules/
69-
README.md
69+
README.md

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,6 @@ dev-editor
102102
storybook-static
103103

104104
CLAUDE.md
105+
106+
build/
107+
.react-router/

apps/admin/.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# React Router - https://github.com/remix-run/react-router-templates/blob/dc79b1a065f59f3bfd840d4ef75cc27689b611e6/default/.dockerignore
2+
.react-router/
3+
build/
4+
node_modules/
5+
README.md

apps/admin/.eslintrc.js renamed to apps/admin/.eslintrc.cjs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
module.exports = {
22
root: true,
33
extends: ["@plane/eslint-config/next.js"],
4+
ignorePatterns: [
5+
"build/**",
6+
"dist/**",
7+
".vite/**",
8+
],
49
rules: {
510
"no-duplicate-imports": "off",
6-
"import/no-duplicates": ["error", { "prefer-inline": false }],
11+
"import/no-duplicates": ["error", {"prefer-inline": false}],
712
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
813
"@typescript-eslint/no-import-type-side-effects": "error",
914
"@typescript-eslint/consistent-type-imports": [
@@ -16,3 +21,5 @@ module.exports = {
1621
],
1722
},
1823
};
24+
25+

apps/admin/Dockerfile.admin

Lines changed: 47 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,86 @@
1-
# syntax=docker/dockerfile:1.7
21
FROM node:22-alpine AS base
32

4-
# Setup pnpm package manager with corepack and configure global bin directory for caching
3+
WORKDIR /app
4+
5+
ENV TURBO_TELEMETRY_DISABLED=1
56
ENV PNPM_HOME="/pnpm"
67
ENV PATH="$PNPM_HOME:$PATH"
7-
RUN corepack enable
8+
ENV CI=1
9+
10+
RUN corepack enable pnpm
11+
12+
# =========================================================================== #
813

9-
# *****************************************************************************
10-
# STAGE 1: Build the project
11-
# *****************************************************************************
1214
FROM base AS builder
13-
RUN apk add --no-cache libc6-compat
14-
WORKDIR /app
1515

16-
ARG TURBO_VERSION=2.5.6
17-
RUN corepack enable pnpm && pnpm add -g turbo@${TURBO_VERSION}
16+
RUN pnpm add -g turbo@2.5.8
17+
1818
COPY . .
1919

20+
# Create a pruned workspace for just the admin app
2021
RUN turbo prune --scope=admin --docker
2122

22-
# *****************************************************************************
23-
# STAGE 2: Install dependencies & build the project
24-
# *****************************************************************************
25-
FROM base AS installer
26-
27-
RUN apk add --no-cache libc6-compat
28-
WORKDIR /app
23+
# =========================================================================== #
2924

30-
COPY .gitignore .gitignore
31-
COPY --from=builder /app/out/json/ .
32-
COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
33-
RUN corepack enable pnpm
34-
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm fetch --store-dir=/pnpm/store
25+
FROM base AS installer
3526

36-
COPY --from=builder /app/out/full/ .
37-
COPY turbo.json turbo.json
38-
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm install --offline --frozen-lockfile --store-dir=/pnpm/store
27+
# Build in production mode; we still install dev deps explicitly below
28+
ENV NODE_ENV=production
3929

30+
# Public envs required at build time (pick up via process.env)
4031
ARG NEXT_PUBLIC_API_BASE_URL=""
4132
ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL
33+
ARG NEXT_PUBLIC_API_BASE_PATH="/api"
34+
ENV NEXT_PUBLIC_API_BASE_PATH=$NEXT_PUBLIC_API_BASE_PATH
4235

4336
ARG NEXT_PUBLIC_ADMIN_BASE_URL=""
4437
ENV NEXT_PUBLIC_ADMIN_BASE_URL=$NEXT_PUBLIC_ADMIN_BASE_URL
45-
4638
ARG NEXT_PUBLIC_ADMIN_BASE_PATH="/god-mode"
4739
ENV NEXT_PUBLIC_ADMIN_BASE_PATH=$NEXT_PUBLIC_ADMIN_BASE_PATH
4840

4941
ARG NEXT_PUBLIC_SPACE_BASE_URL=""
5042
ENV NEXT_PUBLIC_SPACE_BASE_URL=$NEXT_PUBLIC_SPACE_BASE_URL
51-
5243
ARG NEXT_PUBLIC_SPACE_BASE_PATH="/spaces"
5344
ENV NEXT_PUBLIC_SPACE_BASE_PATH=$NEXT_PUBLIC_SPACE_BASE_PATH
5445

46+
ARG NEXT_PUBLIC_LIVE_BASE_URL=""
47+
ENV NEXT_PUBLIC_LIVE_BASE_URL=$NEXT_PUBLIC_LIVE_BASE_URL
48+
ARG NEXT_PUBLIC_LIVE_BASE_PATH="/live"
49+
ENV NEXT_PUBLIC_LIVE_BASE_PATH=$NEXT_PUBLIC_LIVE_BASE_PATH
50+
5551
ARG NEXT_PUBLIC_WEB_BASE_URL=""
5652
ENV NEXT_PUBLIC_WEB_BASE_URL=$NEXT_PUBLIC_WEB_BASE_URL
53+
ARG NEXT_PUBLIC_WEB_BASE_PATH=""
54+
ENV NEXT_PUBLIC_WEB_BASE_PATH=$NEXT_PUBLIC_WEB_BASE_PATH
5755

58-
ENV NEXT_TELEMETRY_DISABLED=1
59-
ENV TURBO_TELEMETRY_DISABLED=1
60-
61-
RUN pnpm turbo run build --filter=admin
56+
ARG NEXT_PUBLIC_WEBSITE_URL="https://plane.so"
57+
ENV NEXT_PUBLIC_WEBSITE_URL=$NEXT_PUBLIC_WEBSITE_URL
58+
ARG NEXT_PUBLIC_SUPPORT_EMAIL="[email protected]"
59+
ENV NEXT_PUBLIC_SUPPORT_EMAIL=$NEXT_PUBLIC_SUPPORT_EMAIL
6260

63-
# *****************************************************************************
64-
# STAGE 3: Copy the project and start it
65-
# *****************************************************************************
66-
FROM base AS runner
67-
WORKDIR /app
68-
69-
# Don't run production as root
70-
RUN addgroup --system --gid 1001 nodejs
71-
RUN adduser --system --uid 1001 nextjs
72-
USER nextjs
73-
74-
# Automatically leverage output traces to reduce image size
75-
# https://nextjs.org/docs/advanced-features/output-file-tracing
76-
COPY --from=installer /app/apps/admin/.next/standalone ./
77-
COPY --from=installer /app/apps/admin/.next/static ./apps/admin/.next/static
78-
COPY --from=installer /app/apps/admin/public ./apps/admin/public
79-
80-
ARG NEXT_PUBLIC_API_BASE_URL=""
81-
ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL
82-
83-
ARG NEXT_PUBLIC_ADMIN_BASE_URL=""
84-
ENV NEXT_PUBLIC_ADMIN_BASE_URL=$NEXT_PUBLIC_ADMIN_BASE_URL
61+
COPY .gitignore .gitignore
62+
COPY --from=builder /app/out/json/ .
63+
COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
8564

86-
ARG NEXT_PUBLIC_ADMIN_BASE_PATH="/god-mode"
87-
ENV NEXT_PUBLIC_ADMIN_BASE_PATH=$NEXT_PUBLIC_ADMIN_BASE_PATH
65+
# Fetch dependencies to cache store, then install offline with dev deps
66+
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm fetch --store-dir=/pnpm/store
67+
COPY --from=builder /app/out/full/ .
68+
COPY turbo.json turbo.json
69+
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm install --offline --frozen-lockfile --store-dir=/pnpm/store --prod=false
8870

89-
ARG NEXT_PUBLIC_SPACE_BASE_URL=""
90-
ENV NEXT_PUBLIC_SPACE_BASE_URL=$NEXT_PUBLIC_SPACE_BASE_URL
71+
# Build only the admin package
72+
RUN pnpm turbo run build --filter=admin
9173

92-
ARG NEXT_PUBLIC_SPACE_BASE_PATH="/spaces"
93-
ENV NEXT_PUBLIC_SPACE_BASE_PATH=$NEXT_PUBLIC_SPACE_BASE_PATH
74+
# =========================================================================== #
9475

95-
ARG NEXT_PUBLIC_WEB_BASE_URL=""
96-
ENV NEXT_PUBLIC_WEB_BASE_URL=$NEXT_PUBLIC_WEB_BASE_URL
76+
FROM nginx:1.27-alpine AS production
9777

98-
ENV NEXT_TELEMETRY_DISABLED=1
99-
ENV TURBO_TELEMETRY_DISABLED=1
78+
COPY apps/admin/nginx/nginx.conf /etc/nginx/nginx.conf
79+
COPY --from=installer /app/apps/admin/build/client /usr/share/nginx/html
10080

10181
EXPOSE 3000
10282

103-
CMD ["node", "apps/admin/server.js"]
83+
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
84+
CMD curl -fsS http://127.0.0.1:3000/ >/dev/null || exit 1
85+
86+
CMD ["nginx", "-g", "daemon off;"]

apps/admin/app/(all)/(dashboard)/ai/layout.tsx

Lines changed: 0 additions & 10 deletions
This file was deleted.

apps/admin/app/(all)/(dashboard)/ai/page.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import { Loader } from "@plane/ui";
66
// hooks
77
import { useInstance } from "@/hooks/store";
88
// components
9+
import type { Route } from "./+types/page";
910
import { InstanceAIForm } from "./form";
1011

11-
const InstanceAIPage = observer(() => {
12+
const InstanceAIPage = observer<React.FC<Route.ComponentProps>>(() => {
1213
// store
1314
const { fetchInstanceConfigurations, formattedConfig } = useInstance();
1415

@@ -42,4 +43,6 @@ const InstanceAIPage = observer(() => {
4243
);
4344
});
4445

46+
export const meta: Route.MetaFunction = () => [{ title: "Artificial Intelligence Settings - God Mode" }];
47+
4548
export default InstanceAIPage;

apps/admin/app/(all)/(dashboard)/authentication/github/layout.tsx

Lines changed: 0 additions & 10 deletions
This file was deleted.

apps/admin/app/(all)/(dashboard)/authentication/github/page.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ import { setPromiseToast } from "@plane/propel/toast";
1010
import { Loader, ToggleSwitch } from "@plane/ui";
1111
import { resolveGeneralTheme } from "@plane/utils";
1212
// components
13+
import githubLightModeImage from "@/app/assets/logos/github-black.png?url";
14+
import githubDarkModeImage from "@/app/assets/logos/github-white.png?url";
1315
import { AuthenticationMethodCard } from "@/components/authentication/authentication-method-card";
1416
// hooks
1517
import { useInstance } from "@/hooks/store";
1618
// icons
17-
import githubLightModeImage from "@/public/logos/github-black.png";
18-
import githubDarkModeImage from "@/public/logos/github-white.png";
1919
// local components
20+
import type { Route } from "./+types/page";
2021
import { InstanceGithubConfigForm } from "./form";
2122

22-
const InstanceGithubAuthenticationPage = observer(() => {
23+
const InstanceGithubAuthenticationPage = observer<React.FC<Route.ComponentProps>>(() => {
2324
// store
2425
const { fetchInstanceConfigurations, formattedConfig, updateInstanceConfigurations } = useInstance();
2526
// state
@@ -111,4 +112,6 @@ const InstanceGithubAuthenticationPage = observer(() => {
111112
);
112113
});
113114

115+
export const meta: Route.MetaFunction = () => [{ title: "GitHub Authentication - God Mode" }];
116+
114117
export default InstanceGithubAuthenticationPage;

apps/admin/app/(all)/(dashboard)/authentication/gitlab/layout.tsx

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)