Feature/Use fastify instead of express (#1)

- Replaced Apollo Server with Mercurius for GraphQL API
- Updated resolvers to use Mercurius-compatible GraphQL implementation
- Migrated from Express to Fastify for server framework
- Improved error handling with GraphQL error extensions
- Added Zod for environment variable validation
- Updated Prisma schema and migrations
- Configured CORS and WebSocket subscriptions
- Simplified GraphQL schema and resolver structure
- Enhanced type safety and code organization
- Replaced Apollo Server with Mercurius for GraphQL API
- Updated resolvers to use Mercurius-compatible GraphQL implementation
- Migrated from Express to Fastify for server framework
- Improved error handling with GraphQL error extensions
- Added Zod for environment variable validation
- Updated Prisma schema and migrations
- Configured CORS and WebSocket subscriptions
- Simplified GraphQL schema and resolver structure
- Enhanced type safety and code organization

Reviewed-on: #1
Co-authored-by: Jusemon <juansmm@outlook.com>
Co-committed-by: Jusemon <juansmm@outlook.com>
This commit is contained in:
Juan Sebastián Montoya 2025-03-06 19:15:56 -05:00 committed by Juan Sebastián Montoya
parent b4e5a04126
commit 6214b503bc
47 changed files with 4968 additions and 5424 deletions

View file

@ -1,32 +1,24 @@
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import turboPlugin from "eslint-plugin-turbo";
import tseslint from "typescript-eslint";
import onlyWarn from "eslint-plugin-only-warn";
import js from '@eslint/js';
import turboPlugin from 'eslint-plugin-turbo';
import tseslint from 'typescript-eslint';
/**
* A shared ESLint configuration for the repository.
*
* @type {import("eslint").Linter.Config}
* @type {import("eslint").Linter.Config[]}
* */
export const config = [
js.configs.recommended,
eslintConfigPrettier,
...tseslint.configs.recommended,
{
plugins: {
turbo: turboPlugin,
},
rules: {
"turbo/no-undeclared-env-vars": "warn",
'turbo/no-undeclared-env-vars': 'warn',
},
},
{
plugins: {
onlyWarn,
},
},
{
ignores: ["dist/**"],
ignores: ['dist/**'],
},
];

View file

@ -1,49 +0,0 @@
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import tseslint from "typescript-eslint";
import pluginReactHooks from "eslint-plugin-react-hooks";
import pluginReact from "eslint-plugin-react";
import globals from "globals";
import pluginNext from "@next/eslint-plugin-next";
import { config as baseConfig } from "./base.js";
/**
* A custom ESLint configuration for libraries that use Next.js.
*
* @type {import("eslint").Linter.Config}
* */
export const nextJsConfig = [
...baseConfig,
js.configs.recommended,
eslintConfigPrettier,
...tseslint.configs.recommended,
{
...pluginReact.configs.flat.recommended,
languageOptions: {
...pluginReact.configs.flat.recommended.languageOptions,
globals: {
...globals.serviceworker,
},
},
},
{
plugins: {
"@next/next": pluginNext,
},
rules: {
...pluginNext.configs.recommended.rules,
...pluginNext.configs["core-web-vitals"].rules,
},
},
{
plugins: {
"react-hooks": pluginReactHooks,
},
settings: { react: { version: "detect" } },
rules: {
...pluginReactHooks.configs.recommended.rules,
// React scope no longer necessary with new JSX transform.
"react/react-in-jsx-scope": "off",
},
},
];

View file

@ -5,19 +5,14 @@
"private": true,
"exports": {
"./base": "./base.js",
"./next-js": "./next.js",
"./react-internal": "./react-internal.js"
"./solid-js": "./solid.js"
},
"devDependencies": {
"@eslint/js": "^9.21.0",
"@next/eslint-plugin-next": "^15.2.1",
"@typescript-eslint/parser": "^8.26.0",
"eslint": "^9.21.0",
"eslint-config-prettier": "^10.0.2",
"eslint-plugin-only-warn": "^1.1.0",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-solid": "^0.14.5",
"eslint-plugin-turbo": "^2.4.4",
"globals": "^16.0.0",
"typescript": "^5.8.2",
"typescript-eslint": "^8.26.0"
}

View file

@ -1,39 +0,0 @@
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import tseslint from "typescript-eslint";
import pluginReactHooks from "eslint-plugin-react-hooks";
import pluginReact from "eslint-plugin-react";
import globals from "globals";
import { config as baseConfig } from "./base.js";
/**
* A custom ESLint configuration for libraries that use React.
*
* @type {import("eslint").Linter.Config} */
export const config = [
...baseConfig,
js.configs.recommended,
eslintConfigPrettier,
...tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
{
languageOptions: {
...pluginReact.configs.flat.recommended.languageOptions,
globals: {
...globals.serviceworker,
...globals.browser,
},
},
},
{
plugins: {
"react-hooks": pluginReactHooks,
},
settings: { react: { version: "detect" } },
rules: {
...pluginReactHooks.configs.recommended.rules,
// React scope no longer necessary with new JSX transform.
"react/react-in-jsx-scope": "off",
},
},
];

View file

@ -0,0 +1,23 @@
import js from '@eslint/js';
import solid from 'eslint-plugin-solid/configs/typescript';
import * as tsParser from '@typescript-eslint/parser';
import { config as baseConfig } from './base.js';
/**
* A custom ESLint configuration for libraries that use Solid.
*
* @type {import("eslint").Linter.Config[]} */
export const config = [
...baseConfig,
js.configs.recommended,
{
files: ['**/*.{ts,tsx}'],
...solid,
languageOptions: {
parser: tsParser,
parserOptions: {
project: 'tsconfig.json',
},
},
},
];

View file

@ -1,12 +0,0 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./base.json",
"compilerOptions": {
"plugins": [{ "name": "next" }],
"module": "ESNext",
"moduleResolution": "Bundler",
"allowJs": true,
"jsx": "preserve",
"noEmit": true
}
}

View file

@ -2,6 +2,8 @@
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./base.json",
"compilerOptions": {
"jsx": "react-jsx"
}
"jsx": "preserve",
"jsxImportSource": "solid-js"
},
"exclude": ["node_modules", "dist"]
}

View file

@ -1,4 +1,4 @@
import { config } from "@repo/eslint-config/react-internal";
import { config } from '@repo/eslint-config/solid-js';
/** @type {import("eslint").Linter.Config} */
export default config;

View file

@ -14,14 +14,9 @@
"@repo/eslint-config": "*",
"@repo/typescript-config": "*",
"@turbo/gen": "^2.4.4",
"@types/node": "^22.13.9",
"@types/react": "19.0.10",
"@types/react-dom": "19.0.4",
"eslint": "^9.21.0",
"typescript": "5.8.2"
"eslint": "^9.21.0"
},
"dependencies": {
"react": "^19.0.0",
"react-dom": "^19.0.0"
"solid-js": "^1.9.5"
}
}

View file

@ -1,9 +1,9 @@
"use client";
'use client';
import { ReactNode } from "react";
import { JSX } from 'solid-js/jsx-runtime';
interface ButtonProps {
children: ReactNode;
children: JSX.Element;
className?: string;
appName: string;
}
@ -11,7 +11,7 @@ interface ButtonProps {
export const Button = ({ children, className, appName }: ButtonProps) => {
return (
<button
className={className}
class={className}
onClick={() => alert(`Hello from your ${appName} app!`)}
>
{children}

View file

@ -1,4 +1,4 @@
import { type JSX } from "react";
import { type JSX } from 'solid-js/jsx-runtime';
export function Card({
className,
@ -8,15 +8,15 @@ export function Card({
}: {
className?: string;
title: string;
children: React.ReactNode;
children: JSX.Element;
href: string;
}): JSX.Element {
return (
<a
className={className}
class={className}
href={`${href}?utm_source=create-turbo&utm_medium=basic&utm_campaign=create-turbo"`}
rel="noopener noreferrer"
target="_blank"
rel='noopener noreferrer'
target='_blank'
>
<h2>
{title} <span>-&gt;</span>

View file

@ -1,11 +1,11 @@
import { type JSX } from "react";
import { type JSX } from 'solid-js/jsx-runtime';
export function Code({
children,
className,
}: {
children: React.ReactNode;
children: JSX.Element;
className?: string;
}): JSX.Element {
return <code className={className}>{children}</code>;
return <code class={className}>{children}</code>;
}

View file

@ -1,8 +1,7 @@
{
"extends": "@repo/typescript-config/react-library.json",
"extends": "@repo/typescript-config/solid.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
"include": ["src"]
}

View file

@ -1,27 +1,27 @@
import type { PlopTypes } from "@turbo/gen";
import type { PlopTypes } from '@turbo/gen';
// Learn more about Turborepo Generators at https://turbo.build/repo/docs/core-concepts/monorepos/code-generation
export default function generator(plop: PlopTypes.NodePlopAPI): void {
// A simple generator to add a new React component to the internal UI library
plop.setGenerator("react-component", {
description: "Adds a new react component",
plop.setGenerator('solid-component', {
description: 'Adds a new solid component',
prompts: [
{
type: "input",
name: "name",
message: "What is the name of the component?",
type: 'input',
name: 'name',
message: 'What is the name of the component?',
},
],
actions: [
{
type: "add",
path: "src/{{kebabCase name}}.tsx",
templateFile: "templates/component.hbs",
type: 'add',
path: 'src/{{kebabCase name}}.tsx',
templateFile: 'templates/component.hbs',
},
{
type: "append",
path: "package.json",
type: 'append',
path: 'package.json',
pattern: /"exports": {(?<insertion>)/g,
template: ' "./{{kebabCase name}}": "./src/{{kebabCase name}}.tsx",',
},

View file

@ -1,4 +1,4 @@
export const {{ pascalCase name }} = ({ children }: { children: React.ReactNode }) => {
export const {{ pascalCase name }} = ({ children }: { children: JSX.Element }) => {
return (
<div>
<h1>{{ pascalCase name }} Component</h1>