@idealyst/cli 1.0.46 → 1.0.48

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 (111) hide show
  1. package/dist/generators/fullstack.js +61 -3
  2. package/dist/generators/fullstack.js.map +1 -1
  3. package/dist/generators/native.js +12 -0
  4. package/dist/generators/native.js.map +1 -1
  5. package/dist/generators/utils.js +64 -31
  6. package/dist/generators/utils.js.map +1 -1
  7. package/dist/templates/api/README.md +207 -130
  8. package/dist/templates/api/package.json +5 -5
  9. package/dist/templates/api/src/controllers/TestController.ts +0 -0
  10. package/dist/templates/api/src/index.ts +2 -7
  11. package/dist/templates/api/src/lib/crud.ts +150 -0
  12. package/dist/templates/api/src/lib/database.ts +23 -0
  13. package/dist/templates/api/src/router/index.ts +104 -71
  14. package/dist/templates/api/src/routers/test.ts +59 -0
  15. package/dist/templates/api/src/routers/user.example.ts +83 -0
  16. package/dist/templates/api/src/server.ts +1 -1
  17. package/dist/templates/api/tsconfig.json +0 -1
  18. package/dist/templates/database/README.md +115 -1
  19. package/dist/templates/database/package.json +2 -0
  20. package/dist/templates/database/prisma/seed.ts +37 -1
  21. package/dist/templates/database/schema.prisma +11 -1
  22. package/dist/templates/native/index.js +1 -1
  23. package/dist/templates/native/metro.config.js +1 -1
  24. package/dist/templates/native/package.json +4 -0
  25. package/dist/templates/native/src/App.tsx +16 -0
  26. package/dist/templates/native/src/utils/trpc.ts +7 -127
  27. package/dist/templates/native/tsconfig.json +0 -2
  28. package/dist/templates/shared/package.json +8 -3
  29. package/dist/templates/shared/src/components/App.tsx +57 -0
  30. package/dist/templates/shared/src/components/HelloWorld.tsx +276 -86
  31. package/dist/templates/shared/src/components/index.ts +1 -1
  32. package/dist/templates/shared/src/index.ts +6 -2
  33. package/dist/templates/shared/src/trpc/client.ts +39 -0
  34. package/dist/templates/shared/tsconfig.json +1 -1
  35. package/dist/templates/web/README.md +65 -8
  36. package/dist/templates/web/package.json +3 -3
  37. package/dist/templates/web/src/App-with-trpc-and-shared.tsx +10 -6
  38. package/dist/templates/web/src/components/TestDemo.tsx +164 -0
  39. package/dist/templates/web/src/utils/trpc.ts +7 -93
  40. package/dist/templates/web/tsconfig.json +0 -1
  41. package/dist/templates/workspace/.devcontainer/devcontainer.json +4 -9
  42. package/dist/templates/workspace/.devcontainer/docker-compose.yml +1 -2
  43. package/dist/templates/workspace/.devcontainer/setup.sh +1 -1
  44. package/dist/templates/workspace/.env.example +1 -1
  45. package/dist/templates/workspace/Dockerfile +4 -4
  46. package/dist/templates/workspace/docker/nginx/prod.conf +2 -2
  47. package/dist/templates/workspace/docker/nginx.conf +1 -1
  48. package/dist/templates/workspace/docker/prometheus/prometheus.yml +1 -1
  49. package/dist/templates/workspace/docker-compose.yml +4 -5
  50. package/dist/templates/workspace/tsconfig.json +0 -1
  51. package/package.json +1 -1
  52. package/templates/api/README.md +207 -130
  53. package/templates/api/package.json +5 -5
  54. package/templates/api/src/controllers/TestController.ts +0 -0
  55. package/templates/api/src/index.ts +2 -7
  56. package/templates/api/src/lib/crud.ts +150 -0
  57. package/templates/api/src/lib/database.ts +23 -0
  58. package/templates/api/src/router/index.ts +104 -71
  59. package/templates/api/src/routers/test.ts +59 -0
  60. package/templates/api/src/routers/user.example.ts +83 -0
  61. package/templates/api/src/server.ts +1 -1
  62. package/templates/api/tsconfig.json +0 -1
  63. package/templates/database/README.md +115 -1
  64. package/templates/database/package.json +2 -0
  65. package/templates/database/prisma/seed.ts +37 -1
  66. package/templates/database/schema.prisma +11 -1
  67. package/templates/native/index.js +1 -1
  68. package/templates/native/metro.config.js +1 -1
  69. package/templates/native/package.json +4 -0
  70. package/templates/native/src/App.tsx +16 -0
  71. package/templates/native/src/utils/trpc.ts +7 -127
  72. package/templates/native/tsconfig.json +0 -2
  73. package/templates/shared/package.json +8 -3
  74. package/templates/shared/src/components/App.tsx +57 -0
  75. package/templates/shared/src/components/HelloWorld.tsx +276 -86
  76. package/templates/shared/src/components/index.ts +1 -1
  77. package/templates/shared/src/index.ts +6 -2
  78. package/templates/shared/src/trpc/client.ts +39 -0
  79. package/templates/shared/tsconfig.json +1 -1
  80. package/templates/web/README.md +65 -8
  81. package/templates/web/package.json +3 -3
  82. package/templates/web/src/App-with-trpc-and-shared.tsx +10 -6
  83. package/templates/web/src/components/TestDemo.tsx +164 -0
  84. package/templates/web/src/utils/trpc.ts +7 -93
  85. package/templates/web/tsconfig.json +0 -1
  86. package/templates/workspace/.devcontainer/devcontainer.json +4 -9
  87. package/templates/workspace/.devcontainer/docker-compose.yml +1 -2
  88. package/templates/workspace/.devcontainer/setup.sh +1 -1
  89. package/templates/workspace/.env.example +1 -1
  90. package/templates/workspace/Dockerfile +4 -4
  91. package/templates/workspace/docker/nginx/prod.conf +2 -2
  92. package/templates/workspace/docker/nginx.conf +1 -1
  93. package/templates/workspace/docker/prometheus/prometheus.yml +1 -1
  94. package/templates/workspace/docker-compose.yml +4 -5
  95. package/templates/workspace/tsconfig.json +0 -1
  96. package/dist/templates/api/src/controllers/UserController.ts +0 -102
  97. package/dist/templates/api/src/lib/controller.ts +0 -90
  98. package/dist/templates/api/src/lib/middleware.ts +0 -170
  99. package/dist/templates/api/src/middleware/auth.ts +0 -75
  100. package/dist/templates/api/src/middleware/common.ts +0 -103
  101. package/dist/templates/database/.env.example +0 -1
  102. package/dist/templates/native/App.tsx +0 -23
  103. package/dist/templates/native/src/App-with-trpc-and-shared.tsx +0 -12
  104. package/templates/api/src/controllers/UserController.ts +0 -102
  105. package/templates/api/src/lib/controller.ts +0 -90
  106. package/templates/api/src/lib/middleware.ts +0 -170
  107. package/templates/api/src/middleware/auth.ts +0 -75
  108. package/templates/api/src/middleware/common.ts +0 -103
  109. package/templates/database/.env.example +0 -1
  110. package/templates/native/App.tsx +0 -23
  111. package/templates/native/src/App-with-trpc-and-shared.tsx +0 -12
@@ -1,127 +1,7 @@
1
- import { createTRPCReact } from '@trpc/react-query';
2
- import { createTRPCProxyClient, httpBatchLink } from '@trpc/client';
3
-
4
- // Import your API types here when you have an API project
5
- // Example: import type { AppRouter } from '@your-workspace/api';
6
-
7
- // For now, we'll use a generic type that you can replace
8
- type AppRouter = any;
9
-
10
- // Create the tRPC React hooks
11
- export const trpc = createTRPCReact<AppRouter>();
12
-
13
- // Create a vanilla client (for use outside of React components)
14
- export const trpcClient = createTRPCProxyClient<AppRouter>({
15
- links: [
16
- httpBatchLink({
17
- url: 'http://localhost:3000/trpc', // Update this to match your API URL
18
- // Optional: Add headers for authentication
19
- // headers() {
20
- // return {
21
- // authorization: getAuthToken(),
22
- // };
23
- // },
24
- }),
25
- ],
26
- });
27
-
28
- /*
29
- Usage Examples for React Native:
30
-
31
- 1. First, install the required dependencies:
32
- yarn add @trpc/client @trpc/react-query @tanstack/react-query
33
-
34
- 2. Replace the AppRouter type import above with your actual API router:
35
- import type { AppRouter } from '@your-workspace/api';
36
-
37
- 3. Set up the tRPC provider in your App component:
38
-
39
- ```tsx
40
- import React from 'react';
41
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
42
- import { httpBatchLink } from '@trpc/client';
43
- import { trpc } from './src/utils/trpc';
44
-
45
- const queryClient = new QueryClient();
46
-
47
- const trpcClient = trpc.createClient({
48
- links: [
49
- httpBatchLink({
50
- url: 'http://localhost:3000/trpc', // Use your computer's IP for device testing
51
- // For device testing, you might need: 'http://192.168.1.xxx:3000/trpc'
52
- }),
53
- ],
54
- });
55
-
56
- function App() {
57
- return (
58
- <trpc.Provider client={trpcClient} queryClient={queryClient}>
59
- <QueryClientProvider client={queryClient}>
60
- // Your app components
61
- </QueryClientProvider>
62
- </trpc.Provider>
63
- );
64
- }
65
-
66
- export default App;
67
- ```
68
-
69
- 4. Use tRPC in your React Native components:
70
-
71
- ```tsx
72
- import React from 'react';
73
- import { View, Text, ScrollView, TouchableOpacity } from 'react-native';
74
- import { trpc } from '../utils/trpc';
75
-
76
- function UsersList() {
77
- const { data: users, isLoading, refetch } = trpc.users.getAll.useQuery();
78
- const createUser = trpc.users.create.useMutation({
79
- onSuccess: () => {
80
- refetch(); // Refresh the list after creating
81
- },
82
- });
83
-
84
- if (isLoading) {
85
- return (
86
- <View>
87
- <Text>Loading...</Text>
88
- </View>
89
- );
90
- }
91
-
92
- return (
93
- <ScrollView>
94
- {users?.map(user => (
95
- <View key={user.id}>
96
- <Text>{user.name}</Text>
97
- <Text>{user.email}</Text>
98
- </View>
99
- ))}
100
- <TouchableOpacity
101
- onPress={() => createUser.mutate({
102
- email: 'test@example.com',
103
- name: 'Test User'
104
- })}
105
- >
106
- <Text>Create User</Text>
107
- </TouchableOpacity>
108
- </ScrollView>
109
- );
110
- }
111
- ```
112
-
113
- 5. For device testing, make sure to:
114
- - Use your computer's IP address instead of localhost
115
- - Ensure your API server is accessible from the device
116
- - Consider using ngrok for external testing
117
-
118
- 6. Error handling example:
119
-
120
- ```tsx
121
- const { data, error, isLoading } = trpc.users.getAll.useQuery();
122
-
123
- if (error) {
124
- return <Text>Error: {error.message}</Text>;
125
- }
126
- ```
127
- */
1
+ // Import tRPC client utilities from shared package
2
+ export {
3
+ trpc,
4
+ createTRPCClient,
5
+ createVanillaTRPCClient
6
+ } from '@{{workspaceScope}}/shared';
7
+ export type { TRPCClientConfig, AppRouter } from '@{{workspaceScope}}/shared';
@@ -7,12 +7,10 @@
7
7
  "isolatedModules": true,
8
8
  "jsx": "react-native",
9
9
  "lib": ["es2017"],
10
- "moduleResolution": "node",
11
10
  "noEmit": true,
12
11
  "strict": true,
13
12
  "target": "esnext",
14
13
  "skipLibCheck": true,
15
- "resolveJsonModule": true,
16
14
  "baseUrl": "./",
17
15
  "paths": {
18
16
  "@/*": ["./src/*"]
@@ -18,10 +18,13 @@
18
18
  "test:coverage": "jest --coverage",
19
19
  "type-check": "tsc --noEmit"
20
20
  },
21
- "dependencies": {},
22
21
  "peerDependencies": {
23
22
  "@idealyst/components": "^1.0.21",
24
23
  "@idealyst/theme": "^1.0.21",
24
+ "@tanstack/react-query": "^5.83.0",
25
+ "@trpc/client": "^11.5.1",
26
+ "@trpc/react-query": "^11.5.1",
27
+ "@trpc/server": "^11.5.1",
25
28
  "react": "^19.1.0",
26
29
  "react-native": "^0.80.1"
27
30
  },
@@ -33,11 +36,13 @@
33
36
  "devDependencies": {
34
37
  "@idealyst/components": "^1.0.21",
35
38
  "@idealyst/theme": "^1.0.21",
39
+ "@tanstack/react-query": "^5.83.0",
40
+ "@trpc/client": "^11.5.1",
41
+ "@trpc/react-query": "^11.5.1",
42
+ "@trpc/server": "^11.5.1",
36
43
  "@types/jest": "^29.5.12",
37
44
  "@types/react": "^19.1.0",
38
45
  "jest": "^29.7.0",
39
- "react": "^19.1.0",
40
- "react-native": "^0.80.1",
41
46
  "ts-jest": "^29.1.2",
42
47
  "typescript": "^5.0.0"
43
48
  },
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
3
+ import { trpc, createTRPCClient } from '../trpc/client';
4
+ import { HelloWorld } from './HelloWorld';
5
+
6
+ interface AppProps {
7
+ apiUrl?: string;
8
+ queryClient?: QueryClient;
9
+ headers?: () => Record<string, string>;
10
+ // HelloWorld component props
11
+ name?: string;
12
+ platform?: "web" | "mobile";
13
+ projectName?: string;
14
+ }
15
+
16
+ // Default query client instance
17
+ const defaultQueryClient = new QueryClient({
18
+ defaultOptions: {
19
+ queries: {
20
+ staleTime: 1000 * 60 * 5, // 5 minutes
21
+ cacheTime: 1000 * 60 * 10, // 10 minutes
22
+ },
23
+ },
24
+ });
25
+
26
+ /**
27
+ * Unified App component that sets up tRPC and React Query providers
28
+ * and includes the HelloWorld component directly
29
+ */
30
+ export const App: React.FC<AppProps> = ({
31
+ apiUrl = 'http://localhost:3000/trpc',
32
+ queryClient = defaultQueryClient,
33
+ headers,
34
+ name,
35
+ platform = "web",
36
+ projectName
37
+ }) => {
38
+ // Create tRPC client with the provided configuration
39
+ const trpcClient = createTRPCClient({
40
+ apiUrl,
41
+ headers,
42
+ });
43
+
44
+ return (
45
+ <trpc.Provider client={trpcClient} queryClient={queryClient}>
46
+ <QueryClientProvider client={queryClient}>
47
+ <HelloWorld
48
+ name={name}
49
+ platform={platform}
50
+ projectName={projectName}
51
+ />
52
+ </QueryClientProvider>
53
+ </trpc.Provider>
54
+ );
55
+ };
56
+
57
+ export default App;
@@ -1,116 +1,306 @@
1
- import React from 'react';
2
- import { View, Text, Card, Screen } from '@idealyst/components';
1
+ import { Button, Card, Input, Screen, Text, View } from "@idealyst/components";
2
+ import { useState } from "react";
3
+ import { trpc } from "../trpc/client";
3
4
 
4
5
  interface HelloWorldProps {
5
6
  name?: string;
6
- platform?: 'web' | 'mobile';
7
+ platform?: "web" | "mobile";
7
8
  projectName?: string;
8
9
  }
9
10
 
10
- export const HelloWorld: React.FC<HelloWorldProps> = ({
11
- name = 'World',
12
- platform = 'web',
13
- projectName = 'Your Project'
14
- }) => {
15
- const platformEmoji = platform === 'mobile' ? '📱' : '🌐';
16
- const platformText = platform === 'mobile'
17
- ? 'Your mobile development environment is ready. This shared component works seamlessly across mobile and web platforms.'
18
- : 'Your web development environment is ready. This shared component works seamlessly across web and mobile platforms.';
11
+ export const HelloWorld = ({
12
+ name = "World",
13
+ platform = "web",
14
+ projectName = "Your Project",
15
+ }: HelloWorldProps) => {
16
+ const [newTestName, setNewTestName] = useState("");
17
+ const [newTestMessage, setNewTestMessage] = useState("");
18
+
19
+ // Use tRPC hooks directly
20
+ const tests = trpc.test.getAll.useQuery({});
21
+ const createTestMutation = trpc.test.create.useMutation({
22
+ onSuccess: () => {
23
+ tests.refetch();
24
+ setNewTestName("");
25
+ setNewTestMessage("");
26
+ },
27
+ });
28
+ const deleteTestMutation = trpc.test.delete.useMutation({
29
+ onSuccess: () => {
30
+ tests.refetch();
31
+ },
32
+ });
33
+
34
+ const handleCreateTest = async () => {
35
+ if (!newTestName || !newTestMessage) return;
36
+
37
+ await createTestMutation.mutateAsync({
38
+ name: newTestName,
39
+ message: newTestMessage,
40
+ status: "active",
41
+ });
42
+ };
43
+
44
+ const handleDeleteTest = async (id: string) => {
45
+ await deleteTestMutation.mutateAsync({ id });
46
+ };
47
+
48
+ const platformEmoji = platform === "mobile" ? "📱" : "🌐";
49
+ const platformText =
50
+ platform === "mobile"
51
+ ? "Your mobile development environment is ready. This shared component works seamlessly across mobile and web platforms."
52
+ : "Your web development environment is ready. This shared component works seamlessly across web and mobile platforms.";
19
53
 
20
54
  return (
21
55
  <Screen style={{ flex: 1, padding: 20 }}>
22
- <View style={{ maxWidth: 600, alignSelf: 'center' }}>
23
- <Text size="xlarge" weight="bold" style={{
24
- marginBottom: 16,
25
- textAlign: 'center',
26
- color: '#1e293b'
27
- }}>
28
- Welcome to {projectName}! {platformEmoji}
56
+ <View style={{ maxWidth: 600, alignSelf: "center" }}>
57
+ <Text
58
+ size="xlarge"
59
+ weight="bold"
60
+ style={{
61
+ marginBottom: 16,
62
+ textAlign: "center",
63
+ color: "#1e293b",
64
+ }}
65
+ >
66
+ Welcome to {projectName}! {platformEmoji}
29
67
  </Text>
30
-
31
- <Text size="large" style={{
32
- marginBottom: 32,
33
- textAlign: 'center',
34
- color: '#64748b',
68
+
69
+ <Text
70
+ size="large"
71
+ style={{
72
+ marginBottom: 32,
73
+ textAlign: "center",
74
+ color: "#64748b",
35
75
  lineHeight: 24,
36
- paddingHorizontal: 16
37
- }}>
38
- {platformText}
76
+ paddingHorizontal: 16,
77
+ }}
78
+ >
79
+ {platformText}
39
80
  </Text>
40
81
  {/* Framework Branding Card */}
41
82
  <Card variant="elevated" padding="large" intent="primary">
42
- <View style={{ alignItems: 'center' }}>
83
+ <View style={{ alignItems: "center" }}>
43
84
  <Text style={{ fontSize: 32, marginBottom: 16 }}>🚀</Text>
44
- <Text size="xlarge" weight="bold" style={{ marginBottom: 8, textAlign: 'center' }}>
85
+ <Text
86
+ size="xlarge"
87
+ weight="bold"
88
+ style={{ marginBottom: 8, textAlign: "center" }}
89
+ >
45
90
  Idealyst Framework
46
91
  </Text>
47
- <Text size="medium" style={{ marginBottom: 16, textAlign: 'center' }}>
92
+ <Text
93
+ size="medium"
94
+ style={{ marginBottom: 16, textAlign: "center" }}
95
+ >
48
96
  Hello, {name}! Welcome to your cross-platform workspace.
49
97
  </Text>
50
-
51
- {/* Technology Tags */}
52
- <View style={{ flexDirection: 'row', flexWrap: 'wrap', justifyContent: 'center', gap: 8 }}>
53
- <Card variant="filled" padding="small" style={{ backgroundColor: 'rgba(255, 255, 255, 0.2)' }}>
54
- <Text size="small" weight="semibold">React</Text>
55
- </Card>
56
- <Card variant="filled" padding="small" style={{ backgroundColor: 'rgba(255, 255, 255, 0.2)' }}>
57
- <Text size="small" weight="semibold">TypeScript</Text>
58
- </Card>
59
- <Card variant="filled" padding="small" style={{ backgroundColor: 'rgba(255, 255, 255, 0.2)' }}>
60
- <Text size="small" weight="semibold">Cross-Platform</Text>
61
- </Card>
62
- </View>
63
- </View>
64
- </Card>
65
98
 
66
- {/* Quick Start Guide Card */}
67
- <Card variant="outlined" padding="large" style={{ marginTop: 16 }}>
68
- <Text size="large" weight="bold" style={{ marginBottom: 16 }}>
69
- 🎯 Quick Start Guide
70
- </Text>
99
+ {/* Technology Tags */}
100
+ <View
101
+ style={{
102
+ flexDirection: "row",
103
+ flexWrap: "wrap",
104
+ justifyContent: "center",
105
+ gap: 8,
106
+ }}
107
+ >
108
+ <Card
109
+ variant="filled"
110
+ padding="small"
111
+ style={{ backgroundColor: "rgba(255, 255, 255, 0.2)" }}
112
+ >
113
+ <Text size="small" weight="semibold">
114
+ React
115
+ </Text>
116
+ </Card>
117
+ <Card
118
+ variant="filled"
119
+ padding="small"
120
+ style={{ backgroundColor: "rgba(255, 255, 255, 0.2)" }}
121
+ >
122
+ <Text size="small" weight="semibold">
123
+ TypeScript
124
+ </Text>
125
+ </Card>
126
+ <Card
127
+ variant="filled"
128
+ padding="small"
129
+ style={{ backgroundColor: "rgba(255, 255, 255, 0.2)" }}
130
+ >
131
+ <Text size="small" weight="semibold">
132
+ Cross-Platform
133
+ </Text>
134
+ </Card>
135
+ </View>
136
+ </View>
137
+ </Card>
71
138
 
72
- <View style={{ marginBottom: 16 }}>
73
- <Text size="medium" weight="semibold" style={{ marginBottom: 8 }}>
74
- Your Workspace Overview:
75
- </Text>
76
- <Text size="small" style={{ marginBottom: 4 }}>
77
- • <Text weight="semibold">packages/web/</Text> - React web application
139
+ {/* Quick Start Guide Card */}
140
+ <Card variant="outlined" padding="large" style={{ marginTop: 16 }}>
141
+ <Text size="large" weight="bold" style={{ marginBottom: 16 }}>
142
+ 🎯 Quick Start Guide
78
143
  </Text>
79
- <Text size="small" style={{ marginBottom: 4 }}>
80
- • <Text weight="semibold">packages/mobile/</Text> - React Native mobile app
81
- </Text>
82
- <Text size="small" style={{ marginBottom: 4 }}>
83
- • <Text weight="semibold">packages/shared/</Text> - Cross-platform components
84
- </Text>
85
- <Text size="small" style={{ marginBottom: 4 }}>
86
- • <Text weight="semibold">packages/api/</Text> - tRPC API server
87
- </Text>
88
- </View>
89
144
 
90
- <View style={{ marginBottom: 16 }}>
91
- <Text size="medium" weight="semibold" style={{ marginBottom: 8 }}>
92
- Try Editing:
93
- </Text>
94
- <Text size="small" style={{ marginBottom: 4 }}>
95
- 1. Edit this component in <Text weight="semibold">packages/shared/src/components/HelloWorld.tsx</Text>
96
- </Text>
97
- <Text size="small" style={{ marginBottom: 4 }}>
98
- 2. Watch changes appear in both web and mobile apps instantly!
99
- </Text>
100
- <Text size="small" style={{ marginBottom: 4 }}>
101
- 3. Run <Text weight="semibold">yarn dev</Text> to start all development servers
102
- </Text>
103
- </View>
145
+ <View style={{ marginBottom: 16 }}>
146
+ <Text size="medium" weight="semibold" style={{ marginBottom: 8 }}>
147
+ Your Workspace Overview:
148
+ </Text>
149
+ <Text size="small" style={{ marginBottom: 4 }}>
150
+ <Text weight="semibold">packages/web/</Text> - React web
151
+ application
152
+ </Text>
153
+ <Text size="small" style={{ marginBottom: 4 }}>
154
+ • <Text weight="semibold">packages/mobile/</Text> - React Native
155
+ mobile app
156
+ </Text>
157
+ <Text size="small" style={{ marginBottom: 4 }}>
158
+ • <Text weight="semibold">packages/shared/</Text> - Cross-platform
159
+ components
160
+ </Text>
161
+ <Text size="small" style={{ marginBottom: 4 }}>
162
+ • <Text weight="semibold">packages/api/</Text> - tRPC API server
163
+ </Text>
164
+ </View>
165
+
166
+ <View style={{ marginBottom: 16 }}>
167
+ <Text size="medium" weight="semibold" style={{ marginBottom: 8 }}>
168
+ Try Editing:
169
+ </Text>
170
+ <Text size="small" style={{ marginBottom: 4 }}>
171
+ 1. Edit this component in{" "}
172
+ <Text weight="semibold">
173
+ packages/shared/src/components/HelloWorld.tsx
174
+ </Text>
175
+ </Text>
176
+ <Text size="small" style={{ marginBottom: 4 }}>
177
+ 2. Watch changes appear in both web and mobile apps instantly!
178
+ </Text>
179
+ <Text size="small" style={{ marginBottom: 4 }}>
180
+ 3. Run <Text weight="semibold">yarn dev</Text> to start all
181
+ development servers
182
+ </Text>
183
+ </View>
184
+
185
+ <Card variant="filled" intent="success" padding="medium">
186
+ <Text size="small" weight="semibold" style={{ marginBottom: 4 }}>
187
+ ✨ Framework Features:
188
+ </Text>
189
+ <Text size="small">
190
+ Shared components • Type safety • Hot reload • Cross-platform
191
+ compatibility
192
+ </Text>
193
+ </Card>
194
+ </Card>
104
195
 
105
- <Card variant="filled" intent="success" padding="medium">
106
- <Text size="small" weight="semibold" style={{ marginBottom: 4 }}>
107
- Framework Features:
196
+ {/* API Testing Section */}
197
+ <Card variant="outlined" padding="large" style={{ marginTop: 16 }}>
198
+ <Text size="large" weight="bold" style={{ marginBottom: 16 }}>
199
+ 🚀 API Demo - Database Integration
108
200
  </Text>
109
- <Text size="small">
110
- Shared components Type safety Hot reload • Cross-platform compatibility
201
+ <Text size="medium" style={{ marginBottom: 16, color: "#64748b" }}>
202
+ Test your full-stack integration! This section demonstrates
203
+ real-time database operations.
111
204
  </Text>
205
+
206
+ {/* Create New Test Form */}
207
+ <Card
208
+ variant="filled"
209
+ padding="medium"
210
+ style={{ marginBottom: 16, backgroundColor: "#f8fafc" }}
211
+ >
212
+ <Text size="medium" weight="semibold" style={{ marginBottom: 12 }}>
213
+ Create New Test Entry
214
+ </Text>
215
+
216
+ <View style={{ gap: 12 }}>
217
+ <Input
218
+ placeholder="Test name"
219
+ value={newTestName}
220
+ onChangeText={setNewTestName}
221
+ />
222
+ <Input
223
+ placeholder="Test message"
224
+ value={newTestMessage}
225
+ onChangeText={setNewTestMessage}
226
+ />
227
+ <Button
228
+ onPress={handleCreateTest}
229
+ disabled={
230
+ !newTestName ||
231
+ !newTestMessage ||
232
+ createTestMutation.isLoading
233
+ }
234
+ style={{ alignSelf: "flex-start" }}
235
+ >
236
+ {createTestMutation.isLoading ? "Creating..." : "Create Test"}
237
+ </Button>
238
+ </View>
239
+ </Card>
240
+
241
+ {/* Tests List */}
242
+ <View>
243
+ <Text size="medium" weight="semibold" style={{ marginBottom: 12 }}>
244
+ Database Records ({tests.data?.length || 0})
245
+ </Text>
246
+
247
+ {tests.isLoading ? (
248
+ <Card variant="outlined" padding="medium">
249
+ <Text size="small" style={{ color: "#64748b" }}>
250
+ Loading tests...
251
+ </Text>
252
+ </Card>
253
+ ) : tests.data?.length === 0 ? (
254
+ <Card variant="outlined" padding="medium">
255
+ <Text size="small" style={{ color: "#64748b" }}>
256
+ No tests found. Create one above!
257
+ </Text>
258
+ </Card>
259
+ ) : (
260
+ <View style={{ gap: 8 }}>
261
+ {tests.data?.map((test: any) => (
262
+ <Card key={test.id} variant="outlined" padding="medium">
263
+ <View
264
+ style={{
265
+ flexDirection: "row",
266
+ justifyContent: "space-between",
267
+ alignItems: "center",
268
+ }}
269
+ >
270
+ <View style={{ flex: 1 }}>
271
+ <Text
272
+ size="small"
273
+ weight="semibold"
274
+ style={{ marginBottom: 4 }}
275
+ >
276
+ {test.name}
277
+ </Text>
278
+ <Text
279
+ size="small"
280
+ style={{ color: "#64748b", marginBottom: 4 }}
281
+ >
282
+ {test.message}
283
+ </Text>
284
+ <Text size="small" style={{ color: "#10b981" }}>
285
+ Status: {test.status} •{" "}
286
+ {new Date(test.createdAt).toLocaleDateString()}
287
+ </Text>
288
+ </View>
289
+ <Button
290
+ variant="destructive"
291
+ size="small"
292
+ onPress={() => handleDeleteTest(test.id)}
293
+ disabled={deleteTestMutation.isLoading}
294
+ >
295
+ Delete
296
+ </Button>
297
+ </View>
298
+ </Card>
299
+ ))}
300
+ </View>
301
+ )}
302
+ </View>
112
303
  </Card>
113
- </Card>
114
304
  </View>
115
305
  </Screen>
116
306
  );
@@ -1 +1 @@
1
- export { HelloWorld } from './HelloWorld';
1
+ export { App } from './App';
@@ -1,5 +1,9 @@
1
- // Export the HelloWorld component
2
- export { HelloWorld } from './components';
1
+ // Export the unified App component
2
+ export { App } from './components';
3
+
4
+ // Export tRPC client utilities
5
+ export { trpc, createTRPCClient, createVanillaTRPCClient } from './trpc/client';
6
+ export type { TRPCClientConfig, AppRouter } from './trpc/client';
3
7
 
4
8
  // Simple type for the HelloWorld component props
5
9
  export interface HelloWorldProps {