feat(create-turbo): create kitchen-sink

This commit is contained in:
Turbobot 2025-06-19 02:40:01 +08:00 committed by afiqzudinhadi
commit 4625c93980
80 changed files with 11572 additions and 0 deletions

View file

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

12
apps/admin/index.html Normal file
View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Admin | Kitchen Sink</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

27
apps/admin/package.json Normal file
View file

@ -0,0 +1,27 @@
{
"name": "admin",
"version": "0.0.0",
"type": "module",
"private": true,
"scripts": {
"build": "vite build",
"dev": "vite --host 0.0.0.0 --port 3001 --clearScreen false",
"check-types": "tsc --noEmit",
"lint": "eslint src/ --max-warnings 0"
},
"dependencies": {
"@repo/ui": "workspace:*",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"@vitejs/plugin-react": "^4.5.1",
"eslint": "^9.29.0",
"typescript": "5.8.2",
"vite": "^5.4.14"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 KiB

View file

@ -0,0 +1,27 @@
import "./styles.css";
import { CounterButton } from "@repo/ui/counter-button";
import { Link } from "@repo/ui/link";
function App() {
return (
<div className="container">
<h1 className="title">
Admin <br />
<span>Kitchen Sink</span>
</h1>
<CounterButton />
<p className="description">
Built With{" "}
<Link href="https://turborepo.com" newTab>
Turborepo
</Link>
{" & "}
<Link href="https://vitejs.dev/" newTab>
Vite
</Link>
</p>
</div>
);
}
export default App;

View file

@ -0,0 +1,40 @@
.container {
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 1.5rem;
max-width: 100%;
margin: 0 auto;
padding: 0 16px;
text-align: center;
}
.title {
font-size: 3rem;
font-weight: 700;
margin: 0;
}
.title span {
display: inline-block;
background-image: linear-gradient(to right, #3b82f6, #ef4444);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.description {
color: #9ca3af;
font-weight: 500;
}
.description a {
color: #3b82f6;
text-decoration: none;
}
.description a:hover {
text-decoration: underline;
}

14
apps/admin/src/index.css Normal file
View file

@ -0,0 +1,14 @@
html {
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
Segoe UI, Roboto, Helvetica Neue, Arial, sans-serif;
-webkit-text-size-adjust: 100%;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-tap-highlight-color: transparent;
line-height: 1.5;
tab-size: 4;
}
body {
margin: 0;
}

16
apps/admin/src/main.tsx Normal file
View file

@ -0,0 +1,16 @@
import React from "react";
import { createRoot } from "react-dom/client";
import App from "./app";
import "./index.css";
const el = document.getElementById("root");
if (el) {
const root = createRoot(el);
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
} else {
throw new Error("Could not find root element");
}

25
apps/admin/tsconfig.json Normal file
View file

@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}

View file

@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}

12
apps/admin/turbo.json Normal file
View file

@ -0,0 +1,12 @@
{
"extends": [
"//"
],
"tasks": {
"build": {
"outputs": [
"dist/**"
]
}
}
}

View file

@ -0,0 +1,6 @@
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [react()],
});

View file

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

41
apps/api/package.json Normal file
View file

@ -0,0 +1,41 @@
{
"name": "api",
"version": "0.0.0",
"type": "module",
"private": true,
"scripts": {
"start": "node dist/index.js",
"dev": "tsup --watch --onSuccess \"node dist/index.cjs\"",
"build": "tsup",
"check-types": "tsc --noEmit",
"lint": "eslint src/ --max-warnings 0",
"test": "jest --detectOpenHandles"
},
"jest": {
"preset": "@repo/jest-presets/node"
},
"dependencies": {
"@repo/logger": "workspace:*",
"body-parser": "^1.20.3",
"cors": "^2.8.5",
"express": "4.21.2",
"morgan": "^1.10.0"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@repo/eslint-config": "workspace:*",
"@repo/jest-presets": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/body-parser": "^1.19.5",
"@types/cors": "^2.8.17",
"@types/express": "4.17.21",
"@types/morgan": "^1.9.9",
"@types/node": "^22.15.3",
"@types/supertest": "^6.0.2",
"eslint": "^9.29.0",
"jest": "^29.7.0",
"supertest": "^7.1.0",
"tsup": "^8.5.0",
"typescript": "5.8.2"
}
}

View file

@ -0,0 +1,23 @@
import supertest from "supertest";
import { describe, it, expect } from "@jest/globals";
import { createServer } from "../server";
describe("Server", () => {
it("health check returns 200", async () => {
await supertest(createServer())
.get("/status")
.expect(200)
.then((res) => {
expect(res.ok).toBe(true);
});
});
it("message endpoint says hello", async () => {
await supertest(createServer())
.get("/message/jared")
.expect(200)
.then((res) => {
expect(res.body).toEqual({ message: "hello jared" });
});
});
});

9
apps/api/src/index.ts Normal file
View file

@ -0,0 +1,9 @@
import { log } from "@repo/logger";
import { createServer } from "./server";
const port = process.env.PORT || 5001;
const server = createServer();
server.listen(port, () => {
log(`api running on ${port}`);
});

22
apps/api/src/server.ts Normal file
View file

@ -0,0 +1,22 @@
import { json, urlencoded } from "body-parser";
import express, { type Express } from "express";
import morgan from "morgan";
import cors from "cors";
export const createServer = (): Express => {
const app = express();
app
.disable("x-powered-by")
.use(morgan("dev"))
.use(urlencoded({ extended: true }))
.use(json())
.use(cors())
.get("/message/:name", (req, res) => {
return res.json({ message: `hello ${req.params.name}` });
})
.get("/status", (_, res) => {
return res.json({ ok: true });
});
return app;
};

9
apps/api/tsconfig.json Normal file
View file

@ -0,0 +1,9 @@
{
"extends": "@repo/typescript-config/base.json",
"compilerOptions": {
"lib": ["ES2015"],
"outDir": "./dist"
},
"exclude": ["node_modules"],
"include": ["."]
}

8
apps/api/tsup.config.ts Normal file
View file

@ -0,0 +1,8 @@
import { defineConfig, type Options } from "tsup";
export default defineConfig((options: Options) => ({
entry: ["src/**/*"],
clean: true,
format: ["cjs"],
...options,
}));

9
apps/api/turbo.json Normal file
View file

@ -0,0 +1,9 @@
{
"extends": ["//"],
"tasks": {
"build": {
"env": ["PORT"],
"outputs": ["dist/**"]
}
}
}

5
apps/blog/.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
node_modules
/build
.env
.vercel

38
apps/blog/README.md Normal file
View file

@ -0,0 +1,38 @@
# Remix
This directory is a brief example of a [Remix](https://remix.run/docs) site that can be deployed to Vercel with zero configuration.
To get started, run the Remix cli with this template
```sh
npx create-remix@latest --template vercel/vercel/examples/remix
```
## Deploy Your Own
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/vercel/tree/main/examples/remix&template=remix)
_Live Example: https://remix-run-template.vercel.app_
You can also deploy using the [Vercel CLI](https://vercel.com/docs/cli):
```sh
npm i -g vercel
vercel
```
## Development
To run your Remix app locally, make sure your project's local dependencies are installed:
```sh
npm install
```
Afterwards, start the Remix development server like so:
```sh
npm run dev
```
Open up [http://localhost:5173](http://localhost:5173) and you should be ready to go!

32
apps/blog/app/root.tsx Normal file
View file

@ -0,0 +1,32 @@
import {
Links,
Meta,
Outlet,
Scripts,
ScrollRestoration,
} from "@remix-run/react";
import { Analytics } from "@vercel/analytics/react";
import "./styles.css";
export function Layout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Links />
</head>
<body>
{children}
<ScrollRestoration />
<Scripts />
<Analytics />
</body>
</html>
);
}
export default function App() {
return <Outlet />;
}

View file

@ -0,0 +1,19 @@
import { CounterButton } from "@repo/ui/counter-button";
import { Link } from "@repo/ui/link";
export default function Index() {
return (
<div className="container">
<h1 className="title">
Blog <br />
<span>Kitchen Sink</span>
</h1>
<CounterButton />
<p className="description">
Built With <Link href="https://turborepo.com">Turborepo</Link>
{" & "}
<Link href="https://remix.run/">Remix</Link>
</p>
</div>
);
}

View file

@ -0,0 +1,15 @@
import type { MetaFunction } from "@vercel/remix";
export const config = { runtime: "edge" };
export const meta: MetaFunction = () => [
{ title: "Remix@Edge | New Remix App" },
];
export default function Edge() {
return (
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.4" }}>
<h1>Welcome to Remix@Edge</h1>
</div>
);
}

55
apps/blog/app/styles.css Normal file
View file

@ -0,0 +1,55 @@
html {
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
Segoe UI, Roboto, Helvetica Neue, Arial, sans-serif;
-webkit-text-size-adjust: 100%;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-tap-highlight-color: transparent;
line-height: 1.5;
tab-size: 4;
}
body {
margin: 0;
}
.container {
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 1.5rem;
max-width: 100%;
margin: 0 auto;
padding: 0 16px;
text-align: center;
}
.title {
font-size: 3rem;
font-weight: 700;
margin: 0;
}
.title span {
display: inline-block;
background-image: linear-gradient(to right, #3b82f6, #ef4444);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.description {
color: #9ca3af;
font-weight: 500;
}
.description a {
color: #3b82f6;
text-decoration: none;
}
.description a:hover {
text-decoration: underline;
}

View file

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

40
apps/blog/package.json Normal file
View file

@ -0,0 +1,40 @@
{
"name": "blog",
"version": "0.0.0",
"private": true,
"sideEffects": false,
"type": "module",
"scripts": {
"build": "remix vite:build",
"dev": "remix vite:dev",
"check-types": "tsc --noEmit",
"lint": "eslint app/ --max-warnings 0"
},
"dependencies": {
"@remix-run/node": "^2.15.2",
"@remix-run/react": "^2.15.2",
"@remix-run/server-runtime": "^2.15.2",
"@repo/ui": "workspace:*",
"@vercel/analytics": "^1.5.0",
"@vercel/remix": "2.16.6",
"isbot": "^5.1.23",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@remix-run/dev": "^2.15.2",
"@repo/eslint-config": "workspace:*",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"@typescript-eslint/eslint-plugin": "^8.34.0",
"@typescript-eslint/parser": "^8.34.0",
"autoprefixer": "^10.4.20",
"eslint": "^9.29.0",
"typescript": "5.8.2",
"vite": "^5.4.14",
"vite-tsconfig-paths": "4.2.1"
},
"engines": {
"node": ">=18.0.0"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

25
apps/blog/tsconfig.json Normal file
View file

@ -0,0 +1,25 @@
{
"include": ["**/*.ts", "**/*.tsx"],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2022"],
"types": ["@vercel/remix", "vite/client"],
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"module": "ESNext",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"target": "ES2022",
"strict": true,
"allowJs": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"paths": {
"~/*": ["./app/*"]
},
// Vite takes care of building everything, not tsc.
"noEmit": true
}
}

11
apps/blog/vite.config.ts Normal file
View file

@ -0,0 +1,11 @@
import { vitePlugin as remix } from "@remix-run/dev";
import { installGlobals } from "@remix-run/node";
import { defineConfig } from "vite";
import { vercelPreset } from "@vercel/remix/vite";
import tsconfigPaths from "vite-tsconfig-paths";
installGlobals();
export default defineConfig({
plugins: [remix({ presets: [vercelPreset()] }), tsconfigPaths()],
});

View file

@ -0,0 +1,4 @@
import { config } from "@repo/eslint-config/next";
/** @type {import("eslint").Linter.Config} */
export default config;

5
apps/storefront/next-env.d.ts vendored Normal file
View file

@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

View file

@ -0,0 +1,12 @@
import { NextConfig } from "next";
const nextConfig: NextConfig = {
typescript: {
ignoreBuildErrors: true,
},
eslint: {
ignoreDuringBuilds: true,
},
};
export default nextConfig;

View file

@ -0,0 +1,30 @@
{
"name": "storefront",
"version": "0.0.0",
"type": "module",
"private": true,
"scripts": {
"build": "next build",
"dev": "next dev -p 3002",
"lint": "next lint",
"check-types": "tsc --noEmit",
"start": "next start"
},
"dependencies": {
"@repo/logger": "workspace:*",
"@repo/ui": "workspace:*",
"next": "^15.3.0",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@next/eslint-plugin-next": "^15.3.0",
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/node": "^22.15.3",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"eslint": "^9.29.0",
"typescript": "5.8.2"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -0,0 +1,13 @@
import "./styles.css";
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}

View file

@ -0,0 +1,31 @@
import { log } from "@repo/logger";
import { Link } from "@repo/ui/link";
import { CounterButton } from "@repo/ui/counter-button";
export const metadata = {
title: "Store | Kitchen Sink",
};
export default function Store() {
log("Hey! This is the Store page.");
return (
<div className="container">
<h1 className="title">
Store <br />
<span>Kitchen Sink</span>
</h1>
<CounterButton />
<p className="description">
Built With{" "}
<Link href="https://turborepo.com" newTab>
Turborepo
</Link>
{" & "}
<Link href="https://nextjs.org/" newTab>
Next.js
</Link>
</p>
</div>
);
}

View file

@ -0,0 +1,55 @@
html {
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
Segoe UI, Roboto, Helvetica Neue, Arial, sans-serif;
-webkit-text-size-adjust: 100%;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-tap-highlight-color: transparent;
line-height: 1.5;
tab-size: 4;
}
body {
margin: 0;
}
.container {
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 1.5rem;
max-width: 100%;
margin: 0 auto;
padding: 0 16px;
text-align: center;
}
.title {
font-size: 3rem;
font-weight: 700;
margin: 0;
}
.title span {
display: inline-block;
background-image: linear-gradient(to right, #3b82f6, #ef4444);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.description {
color: #9ca3af;
font-weight: 500;
}
.description a {
color: #3b82f6;
text-decoration: none;
}
.description a:hover {
text-decoration: underline;
}

View file

@ -0,0 +1,13 @@
{
"exclude": ["node_modules"],
"extends": "@repo/typescript-config/nextjs.json",
"compilerOptions": {
"outDir": "dist",
"plugins": [
{
"name": "next"
}
]
},
"include": ["src", "next.config.ts", "next-env.d.ts", ".next/types/**/*.ts"]
}

View file

@ -0,0 +1,13 @@
{
"extends": [
"//"
],
"tasks": {
"build": {
"outputs": [
".next/**",
"!.next/cache/**"
]
}
}
}