create-base-stack 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +15 -0
  2. package/bin/index.ts +26 -0
  3. package/package.json +12 -0
  4. package/template/.bun-version +1 -0
  5. package/template/README.md +15 -0
  6. package/template/apps/api/README.md +11 -0
  7. package/template/apps/api/package.json +25 -0
  8. package/template/apps/api/src/index.ts +19 -0
  9. package/template/apps/api/src/lib/rpc.ts +8 -0
  10. package/template/apps/api/src/lib/utils.ts +44 -0
  11. package/template/apps/api/src/middleware/cors.ts +7 -0
  12. package/template/apps/api/src/middleware/error.ts +28 -0
  13. package/template/apps/api/tsconfig.json +28 -0
  14. package/template/apps/api/tsdown.config.ts +6 -0
  15. package/template/apps/app/README.md +73 -0
  16. package/template/apps/app/components.json +22 -0
  17. package/template/apps/app/eslint.config.js +23 -0
  18. package/template/apps/app/index.html +13 -0
  19. package/template/apps/app/package.json +45 -0
  20. package/template/apps/app/public/vite.svg +1 -0
  21. package/template/apps/app/src/assets/react.svg +1 -0
  22. package/template/apps/app/src/components/provider/query-provider.tsx +26 -0
  23. package/template/apps/app/src/components/provider/theme-provider.tsx +73 -0
  24. package/template/apps/app/src/components/ui/button.tsx +62 -0
  25. package/template/apps/app/src/components/ui/card.tsx +92 -0
  26. package/template/apps/app/src/index.css +123 -0
  27. package/template/apps/app/src/lib/api-client.ts +7 -0
  28. package/template/apps/app/src/lib/utils.ts +6 -0
  29. package/template/apps/app/src/main.tsx +37 -0
  30. package/template/apps/app/src/routeTree.gen.ts +59 -0
  31. package/template/apps/app/src/routes/__root.tsx +16 -0
  32. package/template/apps/app/src/routes/index.tsx +69 -0
  33. package/template/apps/app/tsconfig.app.json +30 -0
  34. package/template/apps/app/tsconfig.json +17 -0
  35. package/template/apps/app/tsconfig.node.json +26 -0
  36. package/template/apps/app/vite.config.ts +23 -0
  37. package/template/biome.json +44 -0
  38. package/template/bun.lock +930 -0
  39. package/template/bunfig.toml +2 -0
  40. package/template/lefthook.yml +13 -0
  41. package/template/package.json +29 -0
  42. package/template/packages/shared/README.md +15 -0
  43. package/template/packages/shared/package.json +25 -0
  44. package/template/packages/shared/src/index.ts +2 -0
  45. package/template/packages/shared/src/lib/errors.ts +43 -0
  46. package/template/packages/shared/src/lib/types.ts +24 -0
  47. package/template/packages/shared/tsconfig.json +28 -0
  48. package/template/packages/shared/tsdown.config.ts +5 -0
  49. package/template/turbo.json +77 -0
@@ -0,0 +1,2 @@
1
+ [install]
2
+ linker = "isolated"
@@ -0,0 +1,13 @@
1
+ pre-commit:
2
+ parallel: true
3
+ commands:
4
+ biome-check:
5
+ glob: "**/*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}"
6
+ run: bunx biome check --write --no-errors-on-unmatched --files-ignore-unknown=true {staged_files}
7
+ stage_fixed: true
8
+
9
+ pre-push:
10
+ parallel: true
11
+ commands:
12
+ full-validate:
13
+ run: bun run prepush
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@base",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "packageManager": "bun@1.3.4",
6
+ "workspaces": [
7
+ "apps/*",
8
+ "packages/*"
9
+ ],
10
+ "scripts": {
11
+ "build": "turbo run build",
12
+ "dev": "dotenvx run -- bun turbo run dev",
13
+ "test": "turbo run test",
14
+ "format": "bunx biome format --write",
15
+ "lint": "bunx biome lint --write",
16
+ "check": "bunx biome check --write",
17
+ "prepush": "bun run format && bun run lint && bun run check"
18
+ },
19
+ "devDependencies": {
20
+ "@biomejs/biome": "2.3.10",
21
+ "@dotenvx/dotenvx": "^1.51.4",
22
+ "@types/bun": "latest",
23
+ "lefthook": "^2.0.13",
24
+ "turbo": "^2.7.2"
25
+ },
26
+ "peerDependencies": {
27
+ "typescript": "^5"
28
+ }
29
+ }
@@ -0,0 +1,15 @@
1
+ # @base/shared
2
+
3
+ To install dependencies:
4
+
5
+ ```bash
6
+ bun install
7
+ ```
8
+
9
+ To run:
10
+
11
+ ```bash
12
+ bun run index.ts
13
+ ```
14
+
15
+ This project was created using `bun init` in bun v1.3.4. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@base/shared",
3
+ "private": true,
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.mts",
8
+ "default": "./dist/index.mjs"
9
+ }
10
+ },
11
+ "scripts": {
12
+ "build": "tsdown"
13
+ },
14
+ "devDependencies": {
15
+ "@types/bun": "latest",
16
+ "tsdown": "^0.19.0-beta.1"
17
+ },
18
+ "peerDependencies": {
19
+ "typescript": "^5.9.3"
20
+ },
21
+ "dependencies": {
22
+ "http-status-codes": "^2.3.0",
23
+ "zod": "^4.3.4"
24
+ }
25
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./lib/errors.ts";
2
+ export * from "./lib/types.ts";
@@ -0,0 +1,43 @@
1
+ import { StatusCodes } from "http-status-codes";
2
+ import type { ZodIssue } from "zod/v3";
3
+
4
+ export class BadRequestError extends Error {
5
+ status: number;
6
+
7
+ constructor(message = "Bad request", cause: ZodIssue[]) {
8
+ super(message);
9
+ this.name = "BadRequestError";
10
+ this.cause = cause.toString();
11
+ this.status = StatusCodes.BAD_REQUEST;
12
+ }
13
+ }
14
+
15
+ export class ConflictError extends Error {
16
+ status: number;
17
+
18
+ constructor(message = "Resource already exists") {
19
+ super(message);
20
+ this.name = "ConflictError";
21
+ this.status = StatusCodes.CONFLICT;
22
+ }
23
+ }
24
+
25
+ export class NotFoundError extends Error {
26
+ status: number;
27
+
28
+ constructor(message = "Resource not found") {
29
+ super(message);
30
+ this.name = "NotFoundError";
31
+ this.status = StatusCodes.NOT_FOUND;
32
+ }
33
+ }
34
+
35
+ export class UnauthorizedError extends Error {
36
+ status: number;
37
+
38
+ constructor(message = "Unauthorized access") {
39
+ super(message);
40
+ this.name = "UnauthorizedError";
41
+ this.status = StatusCodes.UNAUTHORIZED;
42
+ }
43
+ }
@@ -0,0 +1,24 @@
1
+ import type { StatusCodes } from "http-status-codes";
2
+
3
+ export type ApiResponseStatus = "success" | "error";
4
+
5
+ export type StatusCode = StatusCodes;
6
+
7
+ export type ApiResponseMetadata = Record<string, any>;
8
+
9
+ export interface ApiResponse {
10
+ status: ApiResponseStatus;
11
+ code: StatusCode;
12
+ message: string;
13
+ metadata?: ApiResponseMetadata;
14
+ }
15
+
16
+ export interface SuccessResponse<T> extends ApiResponse {
17
+ status: "success";
18
+ data: T;
19
+ }
20
+
21
+ export interface ErrorResponse<T> extends ApiResponse {
22
+ status: "error";
23
+ errors: T;
24
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": ["ESNext"],
4
+ "target": "ESNext",
5
+ "module": "Preserve",
6
+ "moduleDetection": "force",
7
+ "allowJs": true,
8
+ "moduleResolution": "bundler",
9
+ "allowImportingTsExtensions": true,
10
+ "verbatimModuleSyntax": true,
11
+ "noEmit": true,
12
+ "strict": true,
13
+ "skipLibCheck": true,
14
+ "noFallthroughCasesInSwitch": true,
15
+ "noUncheckedIndexedAccess": true,
16
+ "noImplicitOverride": true,
17
+ "noUnusedLocals": false,
18
+ "noUnusedParameters": false,
19
+ "noPropertyAccessFromIndexSignature": false,
20
+ "baseUrl": "src",
21
+ "rootDir": "src",
22
+ "paths": {
23
+ "@/*": ["*"]
24
+ }
25
+ },
26
+ "include": ["src/**/*"],
27
+ "exclude": ["node_modules", "dist"]
28
+ }
@@ -0,0 +1,5 @@
1
+ import { defineConfig } from "tsdown";
2
+
3
+ export default defineConfig({
4
+ dts: true,
5
+ });
@@ -0,0 +1,77 @@
1
+ {
2
+ "$schema": "https://turborepo.com/schema.json",
3
+ "ui": "tui",
4
+ "tasks": {
5
+ "build": {
6
+ "dependsOn": ["^build"],
7
+ "inputs": [
8
+ "src/**/*.ts",
9
+ "src/**/*.tsx",
10
+ "src/**/*.js",
11
+ "src/**/*.jsx",
12
+ "src/**/*.json",
13
+ "tsconfig.json",
14
+ "tsconfig.*.json",
15
+ "package.json",
16
+ "bun.lock",
17
+ "index.html"
18
+ ],
19
+ "outputs": ["dist/**", ".turbo/**"],
20
+ "env": ["NODE_ENV", "DATABASE_URL", "PORT", "VITE_*"]
21
+ },
22
+ "dev": {
23
+ "cache": false,
24
+ "persistent": true,
25
+ "inputs": [
26
+ "src/**/*.ts",
27
+ "src/**/*.tsx",
28
+ "src/**/*.js",
29
+ "src/**/*.jsx",
30
+ "tsconfig.json",
31
+ "tsconfig.*.json",
32
+ "package.json"
33
+ ],
34
+ "env": ["NODE_ENV", "PORT", "DATABASE_URL", "VITE_*"]
35
+ },
36
+ "test": {
37
+ "dependsOn": ["^build"],
38
+ "inputs": [
39
+ "src/**/*.ts",
40
+ "src/**/*.tsx",
41
+ "src/**/*.js",
42
+ "src/**/*.jsx",
43
+ "test/**/*.ts",
44
+ "test/**/*.tsx",
45
+ "test/**/*.js",
46
+ "test/**/*.jsx",
47
+ "__tests__/**/*.ts",
48
+ "__tests__/**/*.tsx",
49
+ "**/*.test.ts",
50
+ "**/*.test.tsx",
51
+ "**/*.spec.ts",
52
+ "**/*.spec.tsx",
53
+ "jest.config.*",
54
+ "vitest.config.*",
55
+ "package.json",
56
+ "tsconfig.json",
57
+ "tsconfig.*.json"
58
+ ],
59
+ "outputs": ["coverage/**", ".nyc_output/**", "test-results/**"],
60
+ "env": ["NODE_ENV", "CI", "VITE_*"]
61
+ }
62
+ },
63
+ "globalDependencies": [
64
+ ".gitignore",
65
+ "turbo.json",
66
+ "package.json",
67
+ "bun.lock",
68
+ "tsconfig.json"
69
+ ],
70
+ "globalEnv": [
71
+ "NODE_ENV",
72
+ "CI",
73
+ "TURBO_TOKEN",
74
+ "TURBO_TEAM",
75
+ "TURBO_REMOTE_ONLY"
76
+ ]
77
+ }