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: bun run check, bun run test, bun run build. -->

- [ ] Not run; reason:

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

on:
push:
branches:
- main
- dev
paths:
- "backend/**"
- "frontend/**"
- "package.json"
- "bun.lock"
- "turbo.json"
- "scripts/sync-version.mjs"
- "VERSION"
- ".github/workflows/frontend-quality.yml"
Expand All @@ -15,7 +19,11 @@ on:
- main
- dev
paths:
- "backend/**"
- "frontend/**"
- "package.json"
- "bun.lock"
- "turbo.json"
- "scripts/sync-version.mjs"
- "VERSION"
- ".github/workflows/frontend-quality.yml"
Expand All @@ -26,31 +34,29 @@ 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
uses: actions/checkout@v4

- name: Set up pnpm
uses: pnpm/action-setup@v4
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
version: 10.17.0
run_install: false
bun-version: 1.3.14

- name: Set up Node.js
uses: actions/setup-node@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
node-version: 24
cache: pnpm
cache-dependency-path: frontend/pnpm-lock.yaml
go-version-file: backend/go.mod
cache-dependency-path: backend/go.sum

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

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

- name: Run workspace tests
run: bun run test
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
Expand Down Expand Up @@ -93,6 +92,9 @@ web_modules/
.cache
.parcel-cache

# Turborepo cache
.turbo/

# Next.js build output
.next
out
Expand Down
18 changes: 9 additions & 9 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 ./...
bun install
```

Frontend:
Run the shared quality and test pipelines:

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

Use `bun run dev`, `bun run dev:web`, or `bun run 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 `bun run lint`, and run `bun run build` for routing, dependency, or Next.js changes

## Code Style

Expand Down
26 changes: 12 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
# syntax=docker/dockerfile:1

FROM node:24-bookworm-slim AS frontend-builder
FROM oven/bun:1.3.14-debian AS frontend-builder

WORKDIR /src/frontend

ENV PNPM_HOME=/pnpm
ENV PATH=$PNPM_HOME:$PATH
WORKDIR /src

ARG NEXT_PUBLIC_API_BASE_URL=""
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 bun.lock ./
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 --mount=type=cache,id=bun-cache,target=/root/.bun/install/cache \
bun install --frozen-lockfile --filter @deeix/web

RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store \
pnpm config set store-dir /pnpm/store \
&& pnpm install --frozen-lockfile
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 \
pnpm build
bun run build


FROM golang:1.26-bookworm AS backend-builder
Expand Down
20 changes: 9 additions & 11 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
bun 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
bun run dev
```

Use `bun run dev:web` or `bun run 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
bun install
NEXT_PUBLIC_API_BASE_URL=https://api.example.com bun run --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
20 changes: 9 additions & 11 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
bun install
cp frontend/.env.example frontend/.env.local
```

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

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

只启动单个工作区时,使用 `bun run dev:web` 或 `bun run 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
bun install
NEXT_PUBLIC_API_BASE_URL=https://api.example.com bun run --filter @deeix/web build
```

静态产物在 `frontend/out`,可由 Nginx、CDN、对象存储或任意静态服务托管。如需由 Go 后端托管前端,把 `frontend/out` 放到 `server.frontend_dist_dir` 指向的目录;Docker 镜像默认是 `/app/frontend/out`。
Expand Down
4 changes: 2 additions & 2 deletions backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ LDFLAGS := -X github.com/DEEIX-AI/DEEIX-Chat/backend/internal/shared/buildinfo.V
SWAG := $(shell command -v swag 2>/dev/null || echo "$(shell go env GOPATH)/bin/swag")

sync-version:
node ../scripts/sync-version.mjs backend
bun ../scripts/sync-version.mjs backend

check-version:
node ../scripts/sync-version.mjs --check backend
bun ../scripts/sync-version.mjs --check backend

build: check-version
mkdir -p ../.cache/deeix-chat
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
}
}
}
Loading
Loading