Skip to content
Closed
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
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

## Verification

<!-- List the commands or checks you ran. For example: cd backend && go test ./..., cd frontend && pnpm check, cd frontend && pnpm build. -->
<!-- List the commands or checks you ran. For example: pnpm check, pnpm test, pnpm build. -->

- [ ] Not run; reason:

Expand Down
30 changes: 22 additions & 8 deletions .github/workflows/frontend-quality.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
name: Frontend Quality
name: Workspace Quality

on:
push:
branches:
- main
- dev
paths:
- "backend/**"
- "frontend/**"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- "turbo.json"
- "scripts/sync-version.mjs"
- "VERSION"
- ".github/workflows/frontend-quality.yml"
Expand All @@ -15,7 +20,12 @@ on:
- main
- dev
paths:
- "backend/**"
- "frontend/**"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- "turbo.json"
- "scripts/sync-version.mjs"
- "VERSION"
- ".github/workflows/frontend-quality.yml"
Expand All @@ -26,11 +36,8 @@ permissions:

jobs:
quality:
name: Biome and TypeScript
name: Frontend and backend checks
runs-on: ubuntu-24.04
defaults:
run:
working-directory: frontend

steps:
- name: Checkout
Expand All @@ -40,17 +47,24 @@ jobs:
uses: pnpm/action-setup@v4
with:
version: 10.17.0
run_install: false

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm
cache-dependency-path: frontend/pnpm-lock.yaml

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: backend/go.mod
cache-dependency-path: backend/go.sum

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run frontend checks
- name: Run workspace checks
run: pnpm check

- name: Run workspace tests
run: pnpm test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ web_modules/
.cache
.parcel-cache

# Turborepo cache
.turbo/

# Next.js build output
.next
out
Expand Down
16 changes: 8 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ Thank you for contributing to DEEIX Chat.

## Development Setup

Backend:
Install all workspace dependencies:

```bash
cd backend
go test ./...
pnpm install
```

Frontend:
Run the shared quality and test pipelines:

```bash
cd frontend
pnpm install
pnpm lint
pnpm check
pnpm test
pnpm build
```

Use `pnpm dev`, `pnpm dev:web`, or `pnpm dev:api` for local development.

Use the example configuration files for local development. Do not commit local secrets or production credentials.

## Pull Request Guidelines
Expand Down Expand Up @@ -107,7 +107,7 @@ Core expectations:
- keep API access inside `shared/api` or feature-level API modules
- do not hard-code provider-private model behavior in the frontend
- keep authentication tokens aligned with the existing session model
- run `pnpm lint`, and run `pnpm build` for routing, dependency, or Next.js changes
- run `pnpm --filter @deeix/web lint`, and run `pnpm build` for routing, dependency, or Next.js changes

## Code Style

Expand Down
18 changes: 11 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

FROM node:24-bookworm-slim AS frontend-builder

WORKDIR /src/frontend
WORKDIR /src

ENV PNPM_HOME=/pnpm
ENV PATH=$PNPM_HOME:$PATH
Expand All @@ -12,17 +12,21 @@ ENV NEXT_PUBLIC_API_BASE_URL=${NEXT_PUBLIC_API_BASE_URL}

COPY VERSION /src/VERSION
COPY scripts /src/scripts
COPY frontend/package.json frontend/pnpm-lock.yaml ./
COPY frontend/scripts ./scripts
COPY frontend/public/pwa ./public/pwa
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY frontend/package.json ./frontend/package.json
COPY backend/package.json ./backend/package.json
COPY frontend/scripts ./frontend/scripts
COPY frontend/public/pwa ./frontend/public/pwa

RUN corepack enable
RUN npm install --global pnpm@10.17.0

RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store \
pnpm config set store-dir /pnpm/store \
&& pnpm install --frozen-lockfile
&& pnpm install --frozen-lockfile --filter @deeix/web...

COPY frontend ./frontend

COPY frontend ./
WORKDIR /src/frontend

# 如果你的 Next 版本支持,可以在 next.config 里开启 turbopack build filesystem cache
RUN --mount=type=cache,id=next-cache,target=/src/frontend/.next/cache \
Expand Down
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,22 +130,21 @@ cp config.example.yaml config.yaml

Adjust `database.postgres.dsn`, `database.redis.*`, and public URLs in `config.yaml` for your local environment.

2. Start the backend:
2. Install workspace dependencies and prepare the frontend environment:

```bash
cd backend
make run
pnpm install
cp frontend/.env.example frontend/.env.local
```

3. Start the frontend:
3. Start the frontend and backend together:

```bash
cd frontend
pnpm install
cp .env.example .env.local
pnpm dev
```

Use `pnpm dev:web` or `pnpm dev:api` to start only one workspace.

The frontend uses `NEXT_PUBLIC_API_BASE_URL` for API requests. For local development, confirm that `frontend/.env.local` contains:

```env
Expand Down Expand Up @@ -268,9 +267,8 @@ Use this mode when the frontend and backend are served from different public ori
2. Build and publish the frontend.

```bash
cd frontend
pnpm install
NEXT_PUBLIC_API_BASE_URL=https://api.example.com pnpm build
NEXT_PUBLIC_API_BASE_URL=https://api.example.com pnpm --filter @deeix/web build
```

The static output is `frontend/out`. Serve it with Nginx, CDN, object storage, or any static web server. To let the Go backend serve the frontend, place `frontend/out` under `server.frontend_dist_dir`; the Docker image defaults to `/app/frontend/out`.
Expand Down
16 changes: 7 additions & 9 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,22 +130,21 @@ cp config.example.yaml config.yaml

根据本机环境调整 `config.yaml` 中的 `database.postgres.dsn`、`database.redis.*` 和公开访问地址。

2. 启动后端
2. 安装工作区依赖并准备前端环境

```bash
cd backend
make run
pnpm install
cp frontend/.env.example frontend/.env.local
```

3. 启动前端
3. 同时启动前端和后端

```bash
cd frontend
pnpm install
cp .env.example .env.local
pnpm dev
```

只启动单个工作区时,使用 `pnpm dev:web` 或 `pnpm dev:api`。

前端请求后端使用 `NEXT_PUBLIC_API_BASE_URL`。本地开发时确认 `frontend/.env.local` 中包含:

```env
Expand Down Expand Up @@ -268,9 +267,8 @@ docker compose -f docker/docling/docker-compose.yml up -d --build
2. 构建并发布前端。

```bash
cd frontend
pnpm install
NEXT_PUBLIC_API_BASE_URL=https://api.example.com pnpm build
NEXT_PUBLIC_API_BASE_URL=https://api.example.com pnpm --filter @deeix/web build
```

静态产物在 `frontend/out`,可由 Nginx、CDN、对象存储或任意静态服务托管。如需由 Go 后端托管前端,把 `frontend/out` 放到 `server.frontend_dist_dir` 指向的目录;Docker 镜像默认是 `/app/frontend/out`。
Expand Down
2 changes: 1 addition & 1 deletion backend/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -18601,4 +18601,4 @@
"in": "header"
}
}
}
}
2 changes: 1 addition & 1 deletion backend/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5468,7 +5468,7 @@ info:
contact: {}
description: DEEIX Chat 后端 API 文档
title: DEEIX Chat API
version: 0.3.2
version: "0.3.2"
paths:
/admin/announcements:
get:
Expand Down
12 changes: 12 additions & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@deeix/api",
"version": "0.3.2",
"private": true,
"scripts": {
"build": "make build",
"check": "make check-version && go vet ./...",
"clean": "rm -rf ../.cache/deeix-chat",
"dev": "make run",
"test": "make test"
}
}
8 changes: 8 additions & 0 deletions backend/turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": ["//"],
"tasks": {
"build": {
"cache": false
}
}
}
23 changes: 4 additions & 19 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
{
"name": "deeix-chat",
"name": "@deeix/web",
"version": "0.3.2",
"private": true,
"packageManager": "pnpm@10.17.0",
"pnpm": {
"overrides": {
"@babel/core": "7.29.7",
"brace-expansion@1": "1.1.15",
"brace-expansion@5": "5.0.6",
"dompurify": "3.4.11",
"flatted": "3.4.2",
"js-yaml": "4.2.0",
"mermaid": "11.15.0",
"minimatch@3": "3.1.5",
"picomatch": "4.0.4",
"postcss": "8.5.10",
"uuid": "11.1.1"
}
},
"scripts": {
"postinstall": "pnpm sync:icons && pnpm sync:pwa-assets",
"sync:version": "node ../scripts/sync-version.mjs frontend",
Expand All @@ -34,14 +18,15 @@
"typecheck": "tsc --noEmit --pretty false",
"check": "pnpm lint && pnpm typecheck",
"lint": "biome lint .",
"lint:fix": "biome lint --write ."
"lint:fix": "biome lint --write .",
"clean": "rm -rf .next out"
},
"dependencies": {
"@base-ui/react": "^1.4.1",
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@lobehub/icons-static-svg": "^1.90.0",
"@lobehub/icons-static-svg": "1.90.0",
"@radix-ui/react-avatar": "^1.1.11",
"@radix-ui/react-collapsible": "^1.1.12",
"@radix-ui/react-dialog": "^1.1.15",
Expand Down
34 changes: 34 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "@deeix/chat-monorepo",
"version": "0.3.2",
"private": true,
"packageManager": "pnpm@10.17.0",
"scripts": {
"build": "turbo run build",
"check": "turbo run check",
"clean": "turbo run clean",
"dev": "turbo run dev",
"dev:api": "turbo run dev --filter=@deeix/api",
"dev:web": "turbo run dev --filter=@deeix/web",
"test": "turbo run test",
"verify": "turbo run check test build"
},
"devDependencies": {
"turbo": "2.10.5"
},
"pnpm": {
"overrides": {
"@babel/core": "7.29.7",
"brace-expansion@1": "1.1.15",
"brace-expansion@5": "5.0.6",
"dompurify": "3.4.11",
"flatted": "3.4.2",
"js-yaml": "4.2.0",
"mermaid": "11.15.0",
"minimatch@3": "3.1.5",
"picomatch": "4.0.4",
"postcss": "8.5.10",
"uuid": "11.1.1"
}
}
}
Loading
Loading