Skip to content

Commit 3f2d5cf

Browse files
committed
chore: init
1 parent b3d35fb commit 3f2d5cf

80 files changed

Lines changed: 7935 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/web/.cta.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"projectName": "web",
3+
"mode": "file-router",
4+
"typescript": true,
5+
"packageManager": "npm",
6+
"includeExamples": false,
7+
"tailwind": true,
8+
"addOnOptions": {},
9+
"envVarValues": {},
10+
"git": false,
11+
"install": true,
12+
"routerOnly": false,
13+
"version": 1,
14+
"framework": "react",
15+
"chosenAddOns": [
16+
"cloudflare",
17+
"shadcn"
18+
]
19+
}

apps/web/.cursorrules

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# shadcn instructions
2+
3+
Use the latest version of Shadcn to install new components, like this command to add a button component:
4+
5+
```bash
6+
pnpm dlx shadcn@latest add button
7+
```

apps/web/.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
node_modules
2+
.DS_Store
3+
dist
4+
dist-ssr
5+
*.local
6+
.env
7+
.nitro
8+
.tanstack
9+
.wrangler
10+
.output
11+
.vinxi
12+
__unconfig*
13+
todos.json

apps/web/.vscode/settings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"files.watcherExclude": {
3+
"**/routeTree.gen.ts": true
4+
},
5+
"search.exclude": {
6+
"**/routeTree.gen.ts": true
7+
},
8+
"files.readonlyInclude": {
9+
"**/routeTree.gen.ts": true
10+
}
11+
}

apps/web/README.md

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
Welcome to your new TanStack Start app!
2+
3+
# Getting Started
4+
5+
To run this application:
6+
7+
```bash
8+
npm install
9+
npm run dev
10+
```
11+
12+
# Building For Production
13+
14+
To build this application for production:
15+
16+
```bash
17+
npm run build
18+
```
19+
20+
## Testing
21+
22+
This project uses [Vitest](https://vitest.dev/) for testing. You can run the tests with:
23+
24+
```bash
25+
npm run test
26+
```
27+
28+
## Styling
29+
30+
This project uses [Tailwind CSS](https://tailwindcss.com/) for styling.
31+
32+
### Removing Tailwind CSS
33+
34+
If you prefer not to use Tailwind CSS:
35+
36+
1. Remove the demo pages in `src/routes/demo/`
37+
2. Replace the Tailwind import in `src/styles.css` with your own styles
38+
3. Remove `tailwindcss()` from the plugins array in `vite.config.ts`
39+
4. Uninstall the packages: `npm install @tailwindcss/vite tailwindcss -D`
40+
41+
42+
## Deploy to Cloudflare Workers
43+
44+
This project uses the Cloudflare Vite plugin (configured in `vite.config.ts`) and `wrangler.jsonc`:
45+
46+
1. Install Wrangler: `npm install -g wrangler`
47+
2. Authenticate: `wrangler login`
48+
3. Deploy: `npx wrangler deploy`
49+
50+
For production env vars, run `wrangler secret put MY_VAR` for each secret listed in `.env.example`. Public (non-secret) vars go in `wrangler.jsonc` under `vars`.
51+
52+
KV, D1, R2, and Durable Object bindings are configured in `wrangler.jsonc` — see https://developers.cloudflare.com/workers/wrangler/configuration/.
53+
54+
55+
## Shadcn
56+
57+
Add components using the latest version of [Shadcn](https://ui.shadcn.com/).
58+
59+
```bash
60+
pnpm dlx shadcn@latest add button
61+
```
62+
63+
64+
65+
## Routing
66+
67+
This project uses [TanStack Router](https://tanstack.com/router) with file-based routing. Routes are managed as files in `src/routes`.
68+
69+
### Adding A Route
70+
71+
To add a new route to your application just add a new file in the `./src/routes` directory.
72+
73+
TanStack will automatically generate the content of the route file for you.
74+
75+
Now that you have two routes you can use a `Link` component to navigate between them.
76+
77+
### Adding Links
78+
79+
To use SPA (Single Page Application) navigation you will need to import the `Link` component from `@tanstack/react-router`.
80+
81+
```tsx
82+
import { Link } from "@tanstack/react-router";
83+
```
84+
85+
Then anywhere in your JSX you can use it like so:
86+
87+
```tsx
88+
<Link to="/about">About</Link>
89+
```
90+
91+
This will create a link that will navigate to the `/about` route.
92+
93+
More information on the `Link` component can be found in the [Link documentation](https://tanstack.com/router/v1/docs/framework/react/api/router/linkComponent).
94+
95+
### Using A Layout
96+
97+
In the File Based Routing setup the layout is located in `src/routes/__root.tsx`. Anything you add to the root route will appear in all the routes. The route content will appear in the JSX where you render `{children}` in the `shellComponent`.
98+
99+
Here is an example layout that includes a header:
100+
101+
```tsx
102+
import { HeadContent, Scripts, createRootRoute } from '@tanstack/react-router'
103+
104+
export const Route = createRootRoute({
105+
head: () => ({
106+
meta: [
107+
{ charSet: 'utf-8' },
108+
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
109+
{ title: 'My App' },
110+
],
111+
}),
112+
shellComponent: ({ children }) => (
113+
<html lang="en">
114+
<head>
115+
<HeadContent />
116+
</head>
117+
<body>
118+
<header>
119+
<nav>
120+
<Link to="/">Home</Link>
121+
<Link to="/about">About</Link>
122+
</nav>
123+
</header>
124+
{children}
125+
<Scripts />
126+
</body>
127+
</html>
128+
),
129+
})
130+
```
131+
132+
More information on layouts can be found in the [Layouts documentation](https://tanstack.com/router/latest/docs/framework/react/guide/routing-concepts#layouts).
133+
134+
## Server Functions
135+
136+
TanStack Start provides server functions that allow you to write server-side code that seamlessly integrates with your client components.
137+
138+
```tsx
139+
import { createServerFn } from '@tanstack/react-start'
140+
141+
const getServerTime = createServerFn({
142+
method: 'GET',
143+
}).handler(async () => {
144+
return new Date().toISOString()
145+
})
146+
147+
// Use in a component
148+
function MyComponent() {
149+
const [time, setTime] = useState('')
150+
151+
useEffect(() => {
152+
getServerTime().then(setTime)
153+
}, [])
154+
155+
return <div>Server time: {time}</div>
156+
}
157+
```
158+
159+
## API Routes
160+
161+
You can create API routes by using the `server` property in your route definitions:
162+
163+
```tsx
164+
import { createFileRoute } from '@tanstack/react-router'
165+
import { json } from '@tanstack/react-start'
166+
167+
export const Route = createFileRoute('/api/hello')({
168+
server: {
169+
handlers: {
170+
GET: () => json({ message: 'Hello, World!' }),
171+
},
172+
},
173+
})
174+
```
175+
176+
## Data Fetching
177+
178+
There are multiple ways to fetch data in your application. You can use TanStack Query to fetch data from a server. But you can also use the `loader` functionality built into TanStack Router to load the data for a route before it's rendered.
179+
180+
For example:
181+
182+
```tsx
183+
import { createFileRoute } from '@tanstack/react-router'
184+
185+
export const Route = createFileRoute('/people')({
186+
loader: async () => {
187+
const response = await fetch('https://swapi.dev/api/people')
188+
return response.json()
189+
},
190+
component: PeopleComponent,
191+
})
192+
193+
function PeopleComponent() {
194+
const data = Route.useLoaderData()
195+
return (
196+
<ul>
197+
{data.results.map((person) => (
198+
<li key={person.name}>{person.name}</li>
199+
))}
200+
</ul>
201+
)
202+
}
203+
```
204+
205+
Loaders simplify your data fetching logic dramatically. Check out more information in the [Loader documentation](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#loader-parameters).
206+
207+
# Demo files
208+
209+
Files prefixed with `demo` can be safely deleted. They are there to provide a starting point for you to play around with the features you've installed.
210+
211+
# Learn More
212+
213+
You can learn more about all of the offerings from TanStack in the [TanStack documentation](https://tanstack.com).
214+
215+
For TanStack Start specific documentation, visit [TanStack Start](https://tanstack.com/start).

apps/web/components.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "https://ui.shadcn.com/schema.json",
3+
"style": "new-york",
4+
"rsc": false,
5+
"tsx": true,
6+
"tailwind": {
7+
"config": "",
8+
"css": "src/styles.css",
9+
"baseColor": "zinc",
10+
"cssVariables": true,
11+
"prefix": ""
12+
},
13+
"aliases": {
14+
"components": "#/components",
15+
"utils": "#/lib/utils",
16+
"ui": "#/components/ui",
17+
"lib": "#/lib",
18+
"hooks": "#/hooks"
19+
},
20+
"iconLibrary": "lucide"
21+
}

apps/web/package.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"name": "@opencut/web",
3+
"private": true,
4+
"type": "module",
5+
"imports": {
6+
"#/*": "./src/*"
7+
},
8+
"scripts": {
9+
"dev": "vite dev --port 5173",
10+
"build": "vite build",
11+
"preview": "vite preview",
12+
"test": "vitest run",
13+
"deploy": "bun run build && wrangler deploy"
14+
},
15+
"dependencies": {
16+
"@base-ui/react": "^1.4.1",
17+
"@cloudflare/vite-plugin": "^1.26.0",
18+
"@hookform/resolvers": "^5.2.2",
19+
"@tailwindcss/vite": "^4.1.18",
20+
"@tanstack/react-devtools": "latest",
21+
"@tanstack/react-router": "latest",
22+
"@tanstack/react-router-devtools": "latest",
23+
"@tanstack/react-router-ssr-query": "latest",
24+
"@tanstack/react-start": "latest",
25+
"@tanstack/router-plugin": "^1.132.0",
26+
"class-variance-authority": "^0.7.1",
27+
"clsx": "^2.1.1",
28+
"cmdk": "^1.1.1",
29+
"date-fns": "^4.1.0",
30+
"embla-carousel-react": "^8.6.0",
31+
"input-otp": "^1.4.2",
32+
"lucide-react": "^1.14.0",
33+
"next-themes": "^0.4.6",
34+
"radix-ui": "^1.4.3",
35+
"react": "^19.2.0",
36+
"react-day-picker": "^10.0.0",
37+
"react-dom": "^19.2.0",
38+
"react-hook-form": "^7.75.0",
39+
"react-resizable-panels": "^4",
40+
"recharts": "3.8.0",
41+
"sonner": "^2.0.7",
42+
"tailwind-merge": "^3.0.2",
43+
"tailwindcss": "^4.1.18",
44+
"tw-animate-css": "^1.3.6",
45+
"vaul": "^1.1.2",
46+
"zod": "^4.4.3"
47+
},
48+
"devDependencies": {
49+
"@tailwindcss/typography": "^0.5.16",
50+
"@tanstack/devtools-vite": "latest",
51+
"@testing-library/dom": "^10.4.1",
52+
"@testing-library/react": "^16.3.0",
53+
"@types/node": "^22.10.2",
54+
"@types/react": "^19.2.0",
55+
"@types/react-dom": "^19.2.0",
56+
"@vitejs/plugin-react": "^6.0.1",
57+
"jsdom": "^28.1.0",
58+
"typescript": "^6.0.2",
59+
"vite": "^8.0.0",
60+
"vitest": "^4.1.5",
61+
"wrangler": "^4.70.0"
62+
},
63+
"pnpm": {
64+
"onlyBuiltDependencies": [
65+
"esbuild",
66+
"lightningcss"
67+
]
68+
}
69+
}

apps/web/public/favicon.ico

3.78 KB
Binary file not shown.

apps/web/public/logo192.png

5.22 KB
Loading

apps/web/public/logo512.png

9.44 KB
Loading

0 commit comments

Comments
 (0)