diff --git a/apps/web/.eslintrc.cjs b/apps/web/.eslintrc.cjs deleted file mode 100644 index 1a3fb53d9..000000000 --- a/apps/web/.eslintrc.cjs +++ /dev/null @@ -1,11 +0,0 @@ -/** @type {import('eslint').Linter.Config} */ -const config = { - extends: ['@technifit/eslint-config/base', '@technifit/eslint-config/react'], - ignorePatterns: ['types/remix-routes.d.ts'], - root: true, - parserOptions: { - project: true, - }, -}; - -module.exports = config; diff --git a/apps/web/.gitignore b/apps/web/.gitignore deleted file mode 100644 index 0a75933e7..000000000 --- a/apps/web/.gitignore +++ /dev/null @@ -1,28 +0,0 @@ -# Enable for this app only -!*.pem - - -node_modules - -.cache -.env -.vercel -.output -.DS_Store - -/build/ -/public/build -/api/index.js -/api/index.js.map - -# Remix-Routes -/types/remix-routes.d.ts - -# Playwright -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ - -# Vitest -/coverage/ diff --git a/apps/web/.prettierignore b/apps/web/.prettierignore deleted file mode 100644 index 7720da003..000000000 --- a/apps/web/.prettierignore +++ /dev/null @@ -1,10 +0,0 @@ -.cache -.turbo - - -build - -node_modules - -/types/remix-routes.d.ts - diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile deleted file mode 100644 index 43fc2d06d..000000000 --- a/apps/web/Dockerfile +++ /dev/null @@ -1,67 +0,0 @@ -ARG APP_GROUP=apps -ARG APP_NAME=web -ARG APP_PKG_NAME=@technifit/$APP_NAME - -# base node image -FROM node:22.11.0-bookworm-slim AS node - -# set the environment to bash -ENV SHELL=/bin/bash - -# install dependencies using npm or pnpm -RUN npm install -g pnpm -RUN pnpm setup -RUN pnpm config set global-bin-dir /usr/local/bin -RUN pnpm add turbo --global - -# pruner -FROM node AS pruner -ARG APP_PKG_NAME -WORKDIR /app -COPY . . -RUN turbo prune $APP_PKG_NAME --docker -# RUN rm -rf ./out/full/*/*/node_modules - -# base node image -FROM node AS base -WORKDIR /app -COPY --from=pruner /app/out/json/ . - -FROM base AS dev-deps -WORKDIR /app -RUN pnpm install - -FROM base AS production-deps -WORKDIR /app -ENV NODE_ENV=production -RUN pnpm install --production - -FROM base AS builder -ARG APP_PKG_NAME -ARG SENTRY_AUTH_TOKEN -ARG SENTRY_ORG -ARG SENTRY_PROJECT -WORKDIR /app -ENV NODE_ENV=production -COPY --from=pruner /app/out/full/ . -COPY --from=dev-deps /app/ . -COPY turbo.json turbo.json -RUN turbo build --filter=$APP_PKG_NAME... -RUN echo "Builder stage, NODE_ENV: $NODE_ENV, SENTRY_AUTH_TOKEN: $SENTRY_AUTH_TOKEN, SENTRY_ORG: $SENTRY_ORG, SENTRY_PROJECT: $SENTRY_PROJECT" - -# Final image -FROM base AS runner -ARG APP_GROUP -ARG APP_NAME -ENV PORT=8080 -ENV NODE_ENV=production -WORKDIR /app - -COPY --from=production-deps /app . -COPY --from=builder /app/$APP_GROUP/$APP_NAME/package.json ./$APP_GROUP/$APP_NAME/package.json -COPY --from=builder /app/$APP_GROUP/$APP_NAME/build ./$APP_GROUP/$APP_NAME/build - -WORKDIR /app/$APP_GROUP/$APP_NAME - -# It is the app package.json -CMD [ "pnpm", "start" ] \ No newline at end of file diff --git a/apps/web/README.md b/apps/web/README.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/apps/web/app/entry.client.tsx b/apps/web/app/entry.client.tsx deleted file mode 100644 index 4e24864a4..000000000 --- a/apps/web/app/entry.client.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { startTransition, StrictMode, useEffect } from 'react'; -import { RemixBrowser, useLocation, useMatches } from '@remix-run/react'; -import * as Sentry from '@sentry/remix'; -import { hydrateRoot } from 'react-dom/client'; - -import { getPublicEnv } from './features/environment/public-env'; - -Sentry.init({ - dsn: getPublicEnv('SENTRY_DSN'), - debug: getPublicEnv('NODE_ENV') === 'development', - environment: getPublicEnv('NODE_ENV'), - integrations: [ - Sentry.browserTracingIntegration({ - useEffect, - useLocation, - useMatches, - }), - // Replay is only available in the client - Sentry.replayIntegration(), - Sentry.sessionTimingIntegration(), - Sentry.browserProfilingIntegration(), - ], - // Set tracesSampleRate to 1.0 to capture 100% - // of transactions for performance monitoring. - // We recommend adjusting this value in production - tracesSampleRate: 1.0, - // Set profilesSampleRate to 1.0 to profile every transaction. - // Since profilesSampleRate is relative to tracesSampleRate, - // the final profiling rate can be computed as tracesSampleRate * profilesSampleRate - // For example, a tracesSampleRate of 0.5 and profilesSampleRate of 0.5 would - // results in 25% of transactions being profiled (0.5*0.5=0.25) - profilesSampleRate: 1.0, - - // Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled - tracePropagationTargets: ['localhost', 'https://technifit.dev', 'https://www.technifit.dev'], - - // Capture Replay for 10% of all sessions, - // plus for 100% of sessions with an error - replaysSessionSampleRate: 0.1, - replaysOnErrorSampleRate: 1.0, -}); - -startTransition(() => { - const App = ( - - - - ); - - hydrateRoot(document, App); -}); diff --git a/apps/web/app/entry.server.tsx b/apps/web/app/entry.server.tsx deleted file mode 100644 index a2d09f44d..000000000 --- a/apps/web/app/entry.server.tsx +++ /dev/null @@ -1,167 +0,0 @@ -import { PassThrough } from 'node:stream'; -import type { AppLoadContext, EntryContext } from '@remix-run/node'; -import { createReadableStreamFromReadable } from '@remix-run/node'; -import { RemixServer } from '@remix-run/react'; -import { sentryHandleError } from '@sentry/remix'; -import * as Sentry from '@sentry/remix'; -import { isbot } from 'isbot'; -import { renderToPipeableStream } from 'react-dom/server'; -import { createExpressApp } from 'remix-create-express-app'; - -import { envSchema } from '@technifit/environment/schema'; - -Sentry.init({ - dsn: process.env.SENTRY_DSN, - autoInstrumentRemix: true, - debug: process.env.NODE_ENV === 'development', - environment: process.env.NODE_ENV, - // Set tracesSampleRate to 1.0 to capture 100% - // of transactions for performance monitoring. - // We recommend adjusting this value in production - tracesSampleRate: 1.0, - profilesSampleRate: 1.0, // Profiling sample rate is relative to tracesSampleRate -}); - -export const handleError = sentryHandleError; - -// Reject all pending promises from handler functions after 5 seconds -export const streamTimeout = 5000; -const ABORT_DELAY = 10000; - -export default async function handleRequest( - request: Request, - responseStatusCode: number, - responseHeaders: Headers, - remixContext: EntryContext, -) { - return isBotRequest(request.headers.get('user-agent')) - ? handleBotRequest(request, responseStatusCode, responseHeaders, remixContext) - : handleBrowserRequest(request, responseStatusCode, responseHeaders, remixContext); -} - -// We have some Remix apps in the wild already running with isbot@3 so we need -// to maintain backwards compatibility even though we want new apps to use -// isbot@4. That way, we can ship this as a minor Semver update to @remix-run/dev. -function isBotRequest(userAgent: string | null) { - if (!userAgent) { - return false; - } - - return isbot(userAgent); -} - -function handleBotRequest( - request: Request, - responseStatusCode: number, - responseHeaders: Headers, - remixContext: EntryContext, -) { - return new Promise((resolve, reject) => { - let shellRendered = false; - const { pipe, abort } = renderToPipeableStream( - , - { - onAllReady() { - shellRendered = true; - const body = new PassThrough(); - const stream = createReadableStreamFromReadable(body); - - responseHeaders.set('Content-Type', 'text/html'); - // Set a vary header to avoid caching issues with cookies - responseHeaders.set('Vary', 'Cookie'); - // Set a noindex header to avoid indexing of the site - responseHeaders.set('X-Robots-Tag', 'noindex'); - // Set a document policy header to enable js profiling on the browser - responseHeaders.set('Document-Policy', 'js-profiling'); - - resolve( - new Response(stream, { - headers: responseHeaders, - status: responseStatusCode, - }), - ); - - pipe(body); - }, - onShellError(error: unknown) { - reject(error); - }, - onError(error: unknown) { - responseStatusCode = 500; - // Log streaming rendering errors from inside the shell. Don't log - // errors encountered during initial shell rendering since they'll - // reject and get logged in handleDocumentRequest. - if (shellRendered) { - console.error(error); - } - }, - }, - ); - - setTimeout(abort, ABORT_DELAY); - }); -} - -function handleBrowserRequest( - request: Request, - responseStatusCode: number, - responseHeaders: Headers, - remixContext: EntryContext, -) { - return new Promise((resolve, reject) => { - let shellRendered = false; - const { pipe, abort } = renderToPipeableStream( - , - { - onShellReady() { - shellRendered = true; - const body = new PassThrough(); - const stream = createReadableStreamFromReadable(body); - - responseHeaders.set('Content-Type', 'text/html'); - // Set a vary header to avoid caching issues with cookies - responseHeaders.set('Vary', 'Cookie'); - // Set a noindex header to avoid indexing of the site - responseHeaders.set('X-Robots-Tag', 'noindex'); - // Set a document policy header to enable js profiling on the browser - responseHeaders.set('Document-Policy', 'js-profiling'); - - resolve( - new Response(stream, { - headers: responseHeaders, - status: responseStatusCode, - }), - ); - - pipe(body); - }, - onShellError(error: unknown) { - reject(error); - }, - onError(error: unknown) { - responseStatusCode = 500; - // Log streaming rendering errors from inside the shell. Don't log - // errors encountered during initial shell rendering since they'll - // reject and get logged in handleDocumentRequest. - if (shellRendered) { - console.error(error); - } - }, - }, - ); - - setTimeout(abort, ABORT_DELAY); - }); -} - -export const app = createExpressApp({ - configure: () => { - // customize your express app with additional middleware - //app.use(morgan('tiny')) - }, - getLoadContext: () => { - // return the AppLoadContext - return { env: envSchema.parse(process.env) } as AppLoadContext; - }, - unstable_middleware: true, -}); diff --git a/apps/web/app/features/environment/public-env.tsx b/apps/web/app/features/environment/public-env.tsx deleted file mode 100644 index 963dc2da9..000000000 --- a/apps/web/app/features/environment/public-env.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import type { PublicEnv } from '@technifit/environment/types'; - -declare global { - interface Window { - ENV: PublicEnv; - } -} - -const PublicEnvironment = ({ publicEnvs }: { publicEnvs: PublicEnv }) => { - return ( -