Skip to content

Commit aa07327

Browse files
committed
new react router 7
1 parent 2c81db2 commit aa07327

File tree

500 files changed

+13022
-50727
lines changed

Some content is hidden

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

500 files changed

+13022
-50727
lines changed

.eslintrc.cjs

-22
This file was deleted.

.gitignore

-6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ dist
44
dist-ssr
55
*.local
66

7-
# Remix
8-
.cache
9-
build
10-
public/build
11-
.env
12-
137
# misc
148
db.json
159
preferences.json

.vscode/settings.json

-3
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// React Router generated types for route:
2+
// root.tsx
3+
4+
import type * as T from "react-router/route-module"
5+
6+
7+
8+
type Module = typeof import("../root.js")
9+
10+
export type Info = {
11+
parents: [],
12+
id: "root"
13+
file: "root.tsx"
14+
path: ""
15+
params: {} & { [key: string]: string | undefined }
16+
module: Module
17+
loaderData: T.CreateLoaderData<Module>
18+
actionData: T.CreateActionData<Module>
19+
}
20+
21+
export namespace Route {
22+
export type LinkDescriptors = T.LinkDescriptors
23+
export type LinksFunction = () => LinkDescriptors
24+
25+
export type MetaArgs = T.CreateMetaArgs<Info>
26+
export type MetaDescriptors = T.MetaDescriptors
27+
export type MetaFunction = (args: MetaArgs) => MetaDescriptors
28+
29+
export type HeadersArgs = T.HeadersArgs
30+
export type HeadersFunction = (args: HeadersArgs) => Headers | HeadersInit
31+
32+
export type LoaderArgs = T.CreateServerLoaderArgs<Info>
33+
export type ClientLoaderArgs = T.CreateClientLoaderArgs<Info>
34+
export type ActionArgs = T.CreateServerActionArgs<Info>
35+
export type ClientActionArgs = T.CreateClientActionArgs<Info>
36+
37+
export type HydrateFallbackProps = T.CreateHydrateFallbackProps<Info>
38+
export type ComponentProps = T.CreateComponentProps<Info>
39+
export type ErrorBoundaryProps = T.CreateErrorBoundaryProps<Info>
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// React Router generated types for route:
2+
// routes/home.tsx
3+
4+
import type * as T from "react-router/route-module"
5+
6+
import type { Info as Parent0 } from "../../+types/root.js"
7+
8+
type Module = typeof import("../home.js")
9+
10+
export type Info = {
11+
parents: [Parent0],
12+
id: "routes/home"
13+
file: "routes/home.tsx"
14+
path: "undefined"
15+
params: {} & { [key: string]: string | undefined }
16+
module: Module
17+
loaderData: T.CreateLoaderData<Module>
18+
actionData: T.CreateActionData<Module>
19+
}
20+
21+
export namespace Route {
22+
export type LinkDescriptors = T.LinkDescriptors
23+
export type LinksFunction = () => LinkDescriptors
24+
25+
export type MetaArgs = T.CreateMetaArgs<Info>
26+
export type MetaDescriptors = T.MetaDescriptors
27+
export type MetaFunction = (args: MetaArgs) => MetaDescriptors
28+
29+
export type HeadersArgs = T.HeadersArgs
30+
export type HeadersFunction = (args: HeadersArgs) => Headers | HeadersInit
31+
32+
export type LoaderArgs = T.CreateServerLoaderArgs<Info>
33+
export type ClientLoaderArgs = T.CreateClientLoaderArgs<Info>
34+
export type ActionArgs = T.CreateServerActionArgs<Info>
35+
export type ClientActionArgs = T.CreateClientActionArgs<Info>
36+
37+
export type HydrateFallbackProps = T.CreateHydrateFallbackProps<Info>
38+
export type ComponentProps = T.CreateComponentProps<Info>
39+
export type ErrorBoundaryProps = T.CreateErrorBoundaryProps<Info>
40+
}

app-react-router-framework/README.md

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Welcome to React Router!
2+
3+
A modern, production-ready template for building full-stack React applications using React Router.
4+
5+
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/remix-run/react-router-templates/tree/main/default)
6+
7+
## Features
8+
9+
- 🚀 Server-side rendering
10+
- ⚡️ Hot Module Replacement (HMR)
11+
- 📦 Asset bundling and optimization
12+
- 🔄 Data loading and mutations
13+
- 🔒 TypeScript by default
14+
- 🎉 TailwindCSS for styling
15+
- 📖 [React Router docs](https://reactrouter.com/)
16+
17+
## Getting Started
18+
19+
### Installation
20+
21+
Install the dependencies:
22+
23+
```bash
24+
npm install
25+
```
26+
27+
### Development
28+
29+
Start the development server with HMR:
30+
31+
```bash
32+
npm run dev
33+
```
34+
35+
Your application will be available at `http://localhost:5173`.
36+
37+
## Building for Production
38+
39+
Create a production build:
40+
41+
```bash
42+
npm run build
43+
```
44+
45+
## Deployment
46+
47+
### Docker Deployment
48+
49+
This template includes three Dockerfiles optimized for different package managers:
50+
51+
- `Dockerfile` - for npm
52+
- `Dockerfile.pnpm` - for pnpm
53+
- `Dockerfile.bun` - for bun
54+
55+
To build and run using Docker:
56+
57+
```bash
58+
# For npm
59+
docker build -t my-app .
60+
61+
# For pnpm
62+
docker build -f Dockerfile.pnpm -t my-app .
63+
64+
# For bun
65+
docker build -f Dockerfile.bun -t my-app .
66+
67+
# Run the container
68+
docker run -p 3000:3000 my-app
69+
```
70+
71+
The containerized application can be deployed to any platform that supports Docker, including:
72+
73+
- AWS ECS
74+
- Google Cloud Run
75+
- Azure Container Apps
76+
- Digital Ocean App Platform
77+
- Fly.io
78+
- Railway
79+
80+
### DIY Deployment
81+
82+
If you're familiar with deploying Node applications, the built-in app server is production-ready.
83+
84+
Make sure to deploy the output of `npm run build`
85+
86+
```
87+
├── package.json
88+
├── package-lock.json (or pnpm-lock.yaml, or bun.lockb)
89+
├── build/
90+
│ ├── client/ # Static assets
91+
│ └── server/ # Server-side code
92+
```
93+
94+
## Styling
95+
96+
This template comes with [Tailwind CSS](https://tailwindcss.com/) already configured for a simple default starting experience. You can use whatever CSS framework you prefer.
97+
98+
---
99+
100+
Built with ❤️ using React Router.
+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import {
2+
isRouteErrorResponse,
3+
Links,
4+
Meta,
5+
Outlet,
6+
Scripts,
7+
ScrollRestoration,
8+
} from "react-router";
9+
10+
import type { Route } from "./+types/root";
11+
12+
export function Layout({ children }: { children: React.ReactNode }) {
13+
return (
14+
<html lang="en">
15+
<head>
16+
<meta charSet="utf-8" />
17+
<meta name="viewport" content="width=device-width, initial-scale=1" />
18+
<Meta />
19+
<Links />
20+
</head>
21+
<body>
22+
{children}
23+
<ScrollRestoration />
24+
<Scripts />
25+
</body>
26+
</html>
27+
);
28+
}
29+
30+
export default function App() {
31+
return <Outlet />;
32+
}
33+
34+
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
35+
let message = "Oops!";
36+
let details = "An unexpected error occurred.";
37+
let stack: string | undefined;
38+
39+
if (isRouteErrorResponse(error)) {
40+
message = error.status === 404 ? "404" : "Error";
41+
details =
42+
error.status === 404
43+
? "The requested page could not be found."
44+
: error.statusText || details;
45+
} else if (import.meta.env.DEV && error && error instanceof Error) {
46+
details = error.message;
47+
stack = error.stack;
48+
}
49+
50+
return (
51+
<main className="pt-16 p-4 container mx-auto">
52+
<h1>{message}</h1>
53+
<p>{details}</p>
54+
{stack && (
55+
<pre className="w-full p-4 overflow-x-auto">
56+
<code>{stack}</code>
57+
</pre>
58+
)}
59+
</main>
60+
);
61+
}
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { type RouteConfig, index } from "@react-router/dev/routes";
2+
3+
export default [index("routes/home.tsx")] satisfies RouteConfig;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function Home() {
2+
return <div>App Home Page</div>;
3+
}

0 commit comments

Comments
 (0)