Skip to content

Commit cc2b2bc

Browse files
committed
chore: Remove outdated Copilot instructions and enhance documentation for debugging, fetcher, and SSO integration
- Deleted the outdated Copilot instructions file. - Updated the debugging documentation to provide clearer guidance on using React Scan and fetch logging. - Enhanced the fetcher documentation with improved examples and explanations for type-safe API calls. - Revised the SSO documentation to clarify the process of creating custom SSO providers, including detailed steps and code snippets.
1 parent 68639d9 commit cc2b2bc

File tree

10 files changed

+243
-199
lines changed

10 files changed

+243
-199
lines changed

.cursor/rules/backend/backend.mdc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
description: Rule is for generate backend code with Hono.js
3+
globs:
4+
alwaysApply: false
5+
---
6+
- Use @hono/zod-openapi or zod 3 for schema validation
7+
- Use PostgreSQL with Drizzle ORM
8+
- Use `t.serial().primaryKey()` for all database IDs

.cursor/rules/docs.mdc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
description:
3+
globs: *.mdx,*.md
4+
alwaysApply: false
5+
---
6+
- Use Fumadocs framework
7+
- Write docs in `.mdx` file
8+
- [index.mdx](mdc:apps/docs/content/docs/dev/index.mdx) are the main docs
9+
- Use easy, clear and funny language for documentation to make it accessible to a wide audience (exclude title and deescription)
10+
- Use clear and concise examples to illustrate concepts
11+
- Use `// [!code ++]` to highlight code snippets and `// [!code --]` to hide code snippets
12+
- Don't add h1 tag in markdown
13+
- Don't use emoji on heading
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
description: Rule is for generate frontend code along with Next.js & React
3+
globs:
4+
alwaysApply: false
5+
---
6+
- Use Next.js 15
7+
- Use App Router and Server Components
8+
- Use server actions for form handling and data mutations from Server Components
9+
- Leverage Next.js Image component with proper sizing for core web vitals optimization
10+
- Navigation api is in `vitnode/lib/navigation` file. Avoid using `next/navigation` directly

.cursor/rules/frontend/i18n.mdc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
description: Use while write text on frontend
3+
globs:
4+
alwaysApply: false
5+
---
6+
- Use `next-intl` for internationalization
7+
- Use `t('key')` for translation keys
8+
- Use `getTranslation` function for server component but `useTranslation` for client
9+
- Languages keys should be added in [en.json](mdc:apps/web/src/plugins/core/langs/en.json) file

.cursor/rules/global.mdc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: true
5+
---
6+
VitNode is a comprehensive framework designed to simplify and accelerate application development with Next.js and Hono.js. Built as a monorepo solution managed by Turborepo, VitNode provides a structured environment that makes development faster and less complex. The framework includes an integrated AdminCP and plugin system to extend its core functionality.
7+
8+
- Write ESModule only
9+
- Always use snake_case for file name
10+
- Use pnpm as pacakge manager
11+
- Use zod 3 for schema validation
12+
- Use react-hook-form 7 for forms
13+
- Use Shadcn UI & Tailwind CSS 4 for UI
14+
- Respect Prettier [prettierrc.mjs](mdc:packages/eslint/prettierrc.mjs) and ESLint [eslint.config.mjs](mdc:packages/eslint/eslint.config.mjs)
15+
- Use TypeScript 5, React 19 & Hono.js 4

.github/copilot-instructions.md

Lines changed: 0 additions & 97 deletions
This file was deleted.

apps/docs/content/docs/dev/debugging.mdx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
title: Debugging
3-
description: ddd
3+
description: Master VitNode's powerful debugging features to squash those bugs faster!
44
---
55

66
## React Scan
77

8-
In VitNode we implemented the [React Scan](https://react-scan.com/) feature that will show you re-rendering components in real-time. This feature will help you to optimize your React application.
8+
Ever wondered which components are secretly re-rendering and slowing down your app? Say hello to [React Scan](https://react-scan.com/)! This awesome feature shows you component re-renders in real-time, helping you catch performance bottlenecks before they catch you.
99

10-
To enable **React Scan**, you need to pass `debug` props in `RootLayout` component:
10+
Want to become a performance detective? Here's how to enable **React Scan**:
1111

1212
```tsx title="src/app/[locale]/layout.tsx"
1313
export default function LocaleLayout({
@@ -30,9 +30,11 @@ export default function LocaleLayout({
3030
}
3131
```
3232

33-
## Fetching logs
33+
Just add that magical `debug` prop, and you're ready to hunt down those unnecessary re-renders! 🎯
3434

35-
[Next.js has a build-in fetch cache](https://nextjs.org/docs/app/building-your-application/data-fetching/fetching) that will cache the fetch requests. You can enable the fetch logs by passing the `logging` object in the `next.config.ts` file:
35+
## Fetch Detective
36+
37+
Want to know exactly what's happening with your API calls? Next.js has your back with its built-in fetch cache system. Let's make it spill all the secrets by enabling fetch logging:
3638

3739
```ts title="next.config.ts"
3840
import type { NextConfig } from 'next';
@@ -54,4 +56,6 @@ const nextConfig: NextConfig = {
5456
export default vitNodeNextConfig(nextConfig);
5557
```
5658

57-
You can read more about it in the [official documentation](https://nextjs.org/docs/app/api-reference/config/next-config-js/logging#fetching).
59+
With `fullUrl: true`, you'll see every fetch request in its full glory! 🎉
60+
61+
Want to dive deeper into the fetch logging rabbit hole? Check out the [official Next.js logging docs](https://nextjs.org/docs/app/api-reference/config/next-config-js/logging#fetching) for more cool tricks!

apps/docs/content/docs/dev/fetcher.mdx

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,81 @@
11
---
22
title: Fetcher
3-
description: Fetch data with type-safe API
3+
description: Type-safe API data fetching with RPC-style interface
44
---
55

6-
Our fetcher has RPC (Remote Procedure Call) style API. It allows you to call any API endpoint with type-safe API.
6+
The VitNode fetcher provides a type-safe RPC (Remote Procedure Call) style interface for making API requests. It simplifies data fetching by providing strong typing and a consistent API across your application.
77

88
<Callout type="warn" emoji="⚠️" title="Server-side only">
9-
The `fetcher()` function is only server-side. You cannot use it on the
10-
client-side.
9+
The `fetcher()` function can only be used on the server-side. Client-side
10+
usage is not supported.
1111
</Callout>
1212

13-
## Usage
13+
## Getting Started
1414

15-
To use the `fetcher()` function, you need to import it from the `vitnode/lib/fetcher` module. You also need to import the module you want to use.
16-
17-
More about modules can be found in the [Modules](/docs/dev/modules) section.
15+
First, import the required dependencies:
1816

1917
```ts
2018
import { fetcher } from 'vitnode/lib/fetcher';
2119
import { usersModule } from 'vitnode/api/modules/users/users.module';
2220
```
2321

22+
Make your first API call:
23+
2424
```ts
25-
const res = await fetcher(usersModule, {
25+
const response = await fetcher(usersModule, {
2626
path: '/session',
2727
method: 'get',
2828
module: 'users',
2929
});
30-
```
3130

32-
The response from `fetcher()` is compatible with the standard `fetch` Response API. Here are common way to work with the response:
33-
34-
```ts
35-
// Basic response handling
36-
if (res.ok) {
37-
const data = await res.json();
38-
console.log(data);
31+
// Handle the response
32+
if (response.ok) {
33+
const data = await response.json();
34+
console.log('Session data:', data);
3935
}
4036
```
4137

42-
### Options
38+
The fetcher returns a standard Response object, just like the native `fetch` API. This makes it familiar and easy to work with.
39+
40+
## Advanced Features
4341

44-
You can pass the `options` object to modify the `fetch` function. For example we can pass `cache` option to enable the cache from `next`:
42+
### Caching Responses
43+
44+
You can leverage Next.js caching by passing cache options:
4545

4646
```ts
47-
const res = await fetcher(usersModule, {
47+
const response = await fetcher(usersModule, {
4848
path: '/session',
4949
method: 'get',
5050
module: 'users',
51-
// [!code ++]
5251
options: {
5352
// [!code ++]
54-
cache: 'force-cache',
55-
// [!code ++]
53+
cache: 'force-cache', // Uses Next.js cache
5654
},
5755
});
5856
```
5957

60-
### Handle set-cookies
58+
### Cookie Management
6159

62-
React Server Components cannot handle `set-cookies` headers from the server. To handle
63-
this, you need to pass the `allowSaveCookies` param to the `fetcher()` function. This will allow the cookies to be saved in the response.
60+
When working with authentication or sessions, you might need to handle cookies. React Server Components have special considerations for cookie handling:
6461

65-
<Callout type="warn" emoji="⚠️" title="Server-side only">
66-
The `allowSaveCookies` param works only when your request has method different
67-
from `get` and response status has 2xx.
62+
<Callout type="info" title="Cookie Handling">
63+
Cookie saving is only supported for requests that return a 2xx status code.
6864
</Callout>
6965

66+
Here's how to enable cookie handling for a sign-in request:
67+
7068
```ts
71-
const res = await fetcher(usersModule, {
69+
const response = await fetcher(usersModule, {
7270
path: '/sign_in',
7371
method: 'post',
7472
module: 'users',
7573
// [!code ++]
7674
allowSaveCookies: true,
7775
args: {
7876
body: {
79-
email: '',
80-
password: '',
77+
email: 'user@example.com',
78+
password: '********',
8179
},
8280
},
8381
});

0 commit comments

Comments
 (0)