Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
A

ArchForge

> 后端框架
Open source

Modern enterprise platform built with Spring Boot 4

367 stars0 likes1 views
WebsiteGitHub

About

Modern enterprise platform built with Spring Boot 4


What is this repo?

This repository is the backend of the five-repo ArchForge project. It builds two Spring Boot applications from one codebase: the admin (:8080) API consumed by ArchForgeAdmin, and the C-end (:8081) API consumed by ArchForgeWeb.

✨ Features

  • Two apps, one codebase — server-admin (B-end, {code,message,data} envelope) and server-web (C-end, RFC 9457 ProblemDetail), each with its own sa-token realm
  • Contract-first — spec/openapi.yaml owns OpenAPI 3.1 + enums in this repo; CI diffs the live spec against it and blocks breaking changes
  • Java 25 + virtual threads, optional GraalVM native image (~100 ms start)
  • DDD modules guarded by Spring Modulith verification and fail-fast ArchUnit rules
  • Meta-table engine — low-code tables with schema evolution, code generation, and REFERENCE fields
  • ChatAI module — bring your own LLM (OpenAI/Anthropic compatible), streamed over SSE
  • Permission matrix, data scope, db-scheduler clustering, operation/login logs out of the box
  • Developer CLI — ./archforge bootstraps env secrets, docker infra, DB backups, AI skills, MCP

Architecture

System context — how the five sibling repositories fit together:

mermaid
flowchart LR
  subgraph clients["Frontends"]
    A["ArchForgeAdmin
Vue 3 · :8848"]
    W["ArchForgeWeb
Next.js · :3000"]
  end
  subgraph backend["this repo — two Spring Boot apps"]
    SA["server-admin :8080
B-end API"]
    SW["server-web :8081
C-end API"]
    SPEC["spec/
OpenAPI · enums · rules"]
  end
  PG[("PostgreSQL 17")]
  RD[("Redis 7")]

  A -->|"REST /api"| SA
  W -->|"REST + SSE"| SW
  SA --> PG & RD
  SW --> PG & RD
  SPEC -. "openapi.yaml (breaking-change CI gate)" .-> SA
  SPEC -. "generated TS types" .-> A
  SPEC -. "generated TS types" .-> W

Backend module layering — every Java module is prefixed with archforge-:

…

Layering is enforced by tests: controllers never touch repositories, domain modules never depend on server packages, and every rule fails if it accidentally matches zero classes. See ArchitectureTest.

The full story lives in the architecture guide.

Quick start

Prerequisites: Java 25, Docker.

bash
git clone [email protected]:sofn/ArchForge.git && cd ArchForge
./archforge init --write            # .env secrets + postgres/redis containers + Flyway migrate

# Load .env into your shell, then start the admin app:
set -a; source .env; set +a         # Linux/macOS
# Windows cmd:  for /f "usebackq tokens=1,2 delims==" %a in (".env") do set "%a=%b"
# Windows pwsh: Get-Content .env | ? { $_ -match '^([^#=]+)=(.*)$' } | % { [Environment]::SetEnvironmentVariable($Matches[1], $Matches[2]) }
./gradlew :archforge-server-admin:bootRun

Default admin login is admin / admin123 (captcha is on in dev). C-end API:

bash
./gradlew :archforge-server-web:bootRun

Auth and security

  • sa-token 1.45.0, not Spring Security JWT filters.
  • Admin: StpAdminUtil + class-level @SaCheckLogin + write @SaCheckPermission("resource:action").
  • Web: StpWebUtil + WebAuthInterceptor, refresh-token flow with single-use rotation.
  • Login rate limit: 5 requests / minute / IP (@RateLimit).
  • XSS filter sanitizes query/header values and skips multipart uploads.
  • Production must inject DB_PASSWORD, ARCH_FORGE_RSA_PRIVATE_KEY, and storage keys; missing RSA in prod fails fast.

Modules

Module Purpose
archforge-common/archforge-common-{base,error,jpa} shared kernels: utils, ErrorCode framework, JPA conventions
archforge-builtin/archforge-admin-user users, roles, menus, depts, dicts (DDD)
archforge-builtin/archforge-meta-runtime low-code table engine — runtime (definition model, dynamic CRUD, datascope)
archforge-builtin/archforge-meta-designer low-code table engine — design-time only (codegen, DDL, import); never published
archforge-module-cms articles, categories
archforge-module-task task domain
archforge-infrastructure sa-token config, Redis, dynamic datasources, security filters
archforge-server-admin B-end application (:8080)
archforge-server-web C-end application (:8081)
archforge-starters/* cache / lock / redisson / trace starters
archforge-cli ./archforge developer CLI + MCP server
archforge-dependencies version platform (BOM)

Non-Gradle dirs stay unprefixed: docker/, config/, scripts/, .agents/.

Build, test, quality gates

bash
./gradlew build                                    # spotless + compile + all tests
./gradlew test -Ptags=P0,contract                  # only tagged tests
./gradlew build -PexcludeTags=slow                 # skip container-backed integration tests
./gradlew jacocoAggregateReport                    # merged coverage report

What CI enforces on every PR (ci.yml):

Gate Mechanism
Diff coverage ≥ 60% diff-cover on the aggregated JaCoCo report
No breaking API changes oasdiff live spec vs spec/openapi.yaml (on the target branch)
Error codes documented scripts/check-error-codes.py vs docs/specs/error-codes.md
Frontend SDK in sync git diff --exit-code after regenerating schema.d.ts (in Web/Admin repos)
Architecture rules ArchUnit with failOnEmptyShould=true

Developer CLI

bash
./archforge --help
./archforge init --write          # one-time: .env secrets + deps + Flyway migrate
./archforge dev                   # local dev stack (detached; logs/ + run/*.pid)
./archforge up                    # containerized full stack
./archforge up -p allinone        # one container: nginx + both servers + next.js
./archforge status | doctor       # what's running / env health check
./archforge db backup | db restore 
./archforge skills install claude
./archforge mcp                   # MCP stdio server

See archforge-cli/README.md for the full command reference.

The ./archforge wrapper rebuilds the CLI jar when sources changed and fails fast if java is older than JDK 25.

Windows: run archforge.bat instead — same commands (archforge --help, archforge init --write, …). It builds the jar via gradlew.bat on first run and needs java on PATH.

Tech stack

Layer Choice
Runtime Java 25 (preview), Spring Boot 4.1.0, Gradle 9.5.1
Auth sa-token 1.45.0 (StpAdminUtil / StpWebUtil)
Data PostgreSQL 17, Flyway 12.4.0, dynamic-datasource, Redis 7
Observability Micrometer + OpenTelemetry 1.62.0
Storage Local dir or AWS S3 SDK 2.46.x
Style Spotless + Eclipse formatter, JSpecify @NullMarked

Canonical conventions: .agents/skills/archforge-project-standard/standard.md.

License

Apache-2.0

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Javagradlejavamodernrapid

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架