Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/docs/tests_plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 1. Introduction

This document outlines the testing strategy for the VitNode framework. The goal is to ensure the reliability, functionality, and performance of the core framework (`packages/vitnode`), the web application (`apps/web`), and associated plugins. We will utilize Vitest for unit and integration testing and Playwright for end-to-end testing.
This document outlines the testing strategy for the VitNode framework. The goal is to ensure the reliability, functionality, and performance of the core framework (`packages/vitnode`), the web application (`apps/docs`), and associated plugins. We will utilize Vitest for unit and integration testing and Playwright for end-to-end testing.

## 2. Goals

Expand All @@ -24,13 +24,13 @@ This document outlines the testing strategy for the VitNode framework. The goal
### 4.1. Unit Tests (Vitest)

**Scope:** Test individual functions, components, and utilities in isolation.
**Location:** Primarily within `packages/vitnode` and utility directories in `apps/web`.
**Location:** Primarily within `packages/vitnode` and utility directories in `apps/docs`.

**Areas to Cover:**

- **Core Utilities:** Functions in `packages/vitnode/src/lib`, helpers, etc.
- **API Helpers:** Route building, validation logic using `@hono/zod-openapi`.
- **UI Components:** Basic rendering tests, prop validation for components in `packages/vitnode/src/components` and `apps/web/src/components`.
- **UI Components:** Basic rendering tests, prop validation for components in `packages/vitnode/src/components` and `apps/docs/src/components`.
- **Configuration Loading:** Ensure `vitnode.config.ts` is loaded and parsed correctly.
- **Internationalization (i18n):** Test translation loading and formatting utilities.

Expand All @@ -42,15 +42,15 @@ This document outlines the testing strategy for the VitNode framework. The goal
**Areas to Cover:**

- **API Endpoints:** Test request handling, validation, middleware execution, and response generation for Hono.js routes defined in `packages/vitnode/src/api`. Example: [`testRoute`](packages/vitnode/src/api/modules/users/routes/test.route.ts).
- **Server Actions:** Test form submissions, data mutations, and interactions with the database within `apps/web`.
- **Server Actions:** Test form submissions, data mutations, and interactions with the database within `apps/docs`.
- **Database Interactions:** Verify Drizzle ORM queries, schema interactions, and data integrity (using a test database).
- **Authentication Logic:** Test credential verification, session creation/validation (including durations), email verification, password reset, and SSO provider interactions (Google, GitHub, Facebook).
- **Plugin Integration:** Test how core systems interact with plugin-provided extensions (routes, hooks, etc.).

### 4.3. End-to-End Tests (Playwright)

**Scope:** Simulate real user scenarios by interacting with the application through a browser.
**Location:** A dedicated `e2e` or `tests` directory at the root or within `apps/web`.
**Location:** A dedicated `e2e` or `tests` directory at the root or within `apps/docs`.

**Areas to Cover:**

Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"cSpell.words": ["sonner", "vitnode"],
"cSpell.words": ["fumadocs", "sonner", "vitnode"],
"github.copilot.chat.commitMessageGeneration.instructions": [
{
"text": "Follow the Conventional Commits format strictly for commit messages. Use the structure below:\n\n```\n<type>[optional scope]: <gitmoji> <description>\n```\n\nGuidelines:\n\n1. **Type and Scope**: Choose an appropriate type (e.g., `feat`, `fix`, `refactor`, `docs`) and optional scope to describe the affected module or feature.\n\n2. **Gitmoji**: Include a relevant `gitmoji` that best represents the nature of the change.\n\n3. **Description**: Write a concise, informative description in the header; use backticks if referencing code or specific terms.\n\nCommit messages should be clear, informative, and professional, aiding readability and project tracking."
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions apps/docs/content/docs/ui/dropdown-menu.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ title: Dropdown Menu
description: A dropdown menu component for building interactive menus in your application.
---

## Preview

<Preview name="dropdown-menu" />

## Usage

```ts
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions apps/docs/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import eslintVitNode from '@vitnode/eslint-config/eslint';

export default [
...eslintVitNode,
{
ignores: ['.source'],
},
];
10 changes: 10 additions & 0 deletions apps/docs/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/// <reference types="next-intl" />

import type core from './src/locales/@vitnode/core/en.json';
import type blog from './src/locales/@vitnode/blog/en.json';

declare module 'next-intl' {
interface AppConfig {
Messages: typeof core & typeof blog;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ CREATE TABLE "core_logs" (
"type" "coreLogsType" NOT NULL,
"content" text NOT NULL,
"createdAt" timestamp DEFAULT now() NOT NULL,
"ipAddress" varchar(45) NOT NULL
"ipAddress" varchar(45) NOT NULL,
"method" varchar(10) DEFAULT 'GET' NOT NULL,
"path" text DEFAULT 'localhost' NOT NULL,
"userAgent" text,
"statusCode" integer DEFAULT 500 NOT NULL,
"userId" bigint
);
--> statement-breakpoint
ALTER TABLE "core_logs" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
Expand Down Expand Up @@ -178,6 +183,7 @@ ALTER TABLE "core_admin_permissions" ADD CONSTRAINT "core_admin_permissions_user
ALTER TABLE "core_admin_sessions" ADD CONSTRAINT "core_admin_sessions_userId_core_users_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."core_users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "core_admin_sessions" ADD CONSTRAINT "core_admin_sessions_deviceId_core_sessions_known_devices_id_fk" FOREIGN KEY ("deviceId") REFERENCES "public"."core_sessions_known_devices"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "core_languages_words" ADD CONSTRAINT "core_languages_words_languageCode_core_languages_code_fk" FOREIGN KEY ("languageCode") REFERENCES "public"."core_languages"("code") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "core_logs" ADD CONSTRAINT "core_logs_userId_core_users_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."core_users"("id") ON DELETE set null ON UPDATE cascade;--> statement-breakpoint
ALTER TABLE "core_moderators_permissions" ADD CONSTRAINT "core_moderators_permissions_roleId_core_roles_id_fk" FOREIGN KEY ("roleId") REFERENCES "public"."core_roles"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "core_moderators_permissions" ADD CONSTRAINT "core_moderators_permissions_userId_core_users_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."core_users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "core_sessions" ADD CONSTRAINT "core_sessions_userId_core_users_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."core_users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "960a9871-cd4a-4144-bc0a-af0717f397a7",
"id": "77ac3265-847d-4978-a374-6d31424be57a",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
Expand Down Expand Up @@ -480,10 +480,57 @@
"type": "varchar(45)",
"primaryKey": false,
"notNull": true
},
"method": {
"name": "method",
"type": "varchar(10)",
"primaryKey": false,
"notNull": true,
"default": "'GET'"
},
"path": {
"name": "path",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'localhost'"
},
"userAgent": {
"name": "userAgent",
"type": "text",
"primaryKey": false,
"notNull": false
},
"statusCode": {
"name": "statusCode",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 500
},
"userId": {
"name": "userId",
"type": "bigint",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"foreignKeys": {
"core_logs_userId_core_users_id_fk": {
"name": "core_logs_userId_core_users_id_fk",
"tableFrom": "core_logs",
"tableTo": "core_users",
"columnsFrom": [
"userId"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "cascade"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
Expand Down
13 changes: 13 additions & 0 deletions apps/docs/migrations/meta/_journal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "7",
"dialect": "postgresql",
"entries": [
{
"idx": 0,
"version": "7",
"when": 1751481853472,
"tag": "0000_rapid_nick_fury",
"breakpoints": true
}
]
}
14 changes: 0 additions & 14 deletions apps/docs/next.config.mjs

This file was deleted.

11 changes: 4 additions & 7 deletions apps/web/next.config.ts → apps/docs/next.config.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import type { NextConfig } from 'next';
import { createMDX } from 'fumadocs-mdx/next';
import { vitNodeNextConfig } from '@vitnode/core/config/next.config';

const withMDX = createMDX();

const nextConfig: NextConfig = {
/* config options here */
// logging: {
// fetches: {
// fullUrl: true,
// },
// },
experimental: {
inlineCss: true,
reactCompiler: true,
},
};

export default vitNodeNextConfig(nextConfig);
export default withMDX(vitNodeNextConfig(nextConfig));
47 changes: 37 additions & 10 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,63 @@
{
"name": "docs",
"version": "1.2.0-canary.26",
"type": "module",
"private": true,
"scripts": {
"drizzle-kit": "drizzle-kit",
"db:push": "drizzle-kit push",
"db:migrate": "drizzle-kit up && drizzle-kit generate && drizzle-kit migrate",
"dev": "vitnode init && next dev --turbopack",
"dev:email": "email dev",
"build": "next build --turbopack",
"dev": "next dev --port 3001 --turbopack",
"start": "next start --port 3001",
"start": "next start",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test:e2e": "playwright test",
"test:e2e:ui": "playwright test --ui",
"test:e2e:debug": "playwright test --debug",
"test:e2e:report": "playwright show-report",
"postinstall": "fumadocs-mdx"
},
"dependencies": {
"@hono/zod-openapi": "^0.19.8",
"@hono/zod-validator": "^0.7.0",
"@vitnode/blog": "workspace:*",
"@vitnode/core": "workspace:*",
"babel-plugin-react-compiler": "19.1.0-rc.2",
"fumadocs-core": "^15.5.5",
"fumadocs-mdx": "^11.6.9",
"fumadocs-ui": "^15.5.5",
"drizzle-kit": "^0.31.3",
"drizzle-orm": "^0.44.2",
"fumadocs-core": "^15.6.0",
"fumadocs-mdx": "^11.6.10",
"fumadocs-ui": "^15.6.0",
"hono": "^4.8.3",
"lucide-react": "^0.517.0",
"motion": "^12.19.1",
"motion": "^12.20.1",
"next": "^15.3.4",
"next-intl": "^4.3.1",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-use": "^17.6.0"
"react-hook-form": "^7.58.1",
"react-use": "^17.6.0",
"sonner": "^2.0.5",
"zod": "^3.25.67"
},
"devDependencies": {
"@playwright/test": "^1.53.1",
"@tailwindcss/postcss": "^4.1.11",
"@types/mdx": "^2.0.13",
"@types/node": "^24",
"@types/react": "^19.1",
"@types/react-dom": "^19.1",
"@types/node": "^24.0.7",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@vitnode/eslint-config": "workspace:*",
"class-variance-authority": "^0.7.1",
"dotenv": "^16.6.0",
"eslint": "^9.29.0",
"postcss": "^8.5.6",
"react-email": "^4.0.17",
"shiki": "^3.7.0",
"tailwindcss": "^4.1.11",
"tw-animate-css": "^1.3.4",
"typescript": "^5.8.3"
}
}
File renamed without changes.
5 changes: 4 additions & 1 deletion apps/docs/postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
export default {
/** @type {import('postcss-load-config').Config} */
const config = {
plugins: {
'@tailwindcss/postcss': {},
},
};

export default config;
2 changes: 1 addition & 1 deletion apps/docs/source.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineDocs, defineConfig } from 'fumadocs-mdx/config';
import { defineConfig, defineDocs } from 'fumadocs-mdx/config';

export const docs = defineDocs({
dir: 'content/docs',
Expand Down
7 changes: 0 additions & 7 deletions apps/docs/src/app/(home)/layout.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

// Source: https://github.com/fuma-nama/fumadocs/blob/dev/apps/docs/app/docs/%5B...slug%5D/page.client.tsx

import { ChevronDown } from 'fumadocs-ui/internal/icons';
import { ExternalLinkIcon, MessageCircleIcon } from 'lucide-react';
import { cva } from 'class-variance-authority';
import { buttonVariants } from 'fumadocs-ui/components/ui/button';
import {
Popover,
PopoverContent,
PopoverTrigger,
} from 'fumadocs-ui/components/ui/popover';
import { ChevronDown } from 'fumadocs-ui/internal/icons';
import { cn } from 'fumadocs-ui/utils/cn';
import { buttonVariants } from 'fumadocs-ui/components/ui/button';
import { ExternalLinkIcon, MessageCircleIcon } from 'lucide-react';
import React from 'react';

const optionVariants = cva(
'text-sm p-2 rounded-lg inline-flex items-center gap-2 hover:text-fd-accent-foreground hover:bg-fd-accent [&_svg]:size-4',
);

export function ViewOptions(props: { markdownUrl: string; githubUrl: string }) {
export function ViewOptions(props: { githubUrl: string; markdownUrl: string }) {
const markdownUrl = new URL(props.markdownUrl, 'https://vitnode.com/');
const q = `Read ${markdownUrl}, I want to ask questions about it.`;

Expand Down Expand Up @@ -64,9 +64,9 @@ export function ViewOptions(props: { markdownUrl: string; githubUrl: string }) {
href: gpt,
icon: (
<svg
fill="currentColor"
role="img"
viewBox="0 0 24 24"
fill="currentColor"
xmlns="http://www.w3.org/2000/svg"
>
<title>OpenAI</title>
Expand Down Expand Up @@ -96,11 +96,11 @@ export function ViewOptions(props: { markdownUrl: string; githubUrl: string }) {
},
].map(item => (
<a
key={item.href}
className={cn(optionVariants())}
href={item.href}
key={item.href}
rel="noreferrer noopener"
target="_blank"
className={cn(optionVariants())}
>
{item.icon}
{item.title}
Expand Down
Loading