
Platinum Sponsor
CEOACC.COM | Wholesale Social Media Accounts from the Source
Buy Facebook accounts, Wholesale Instagram accounts, Buy Twitter accounts, Buy TikTok accounts, Buy Telegram accounts, Buy Apple IDs, Buy Google Gmail accounts


Last updated: 2026-07-26
If you have not chosen a deployment method yet, start with Deployment Overview and Selection Guide.
This document is for developers who want full control over the build, or who are doing secondary development.
As of v1.4.0 the frontend source lives in the main repository under frontend/, so you only clone one repository. Build output is compiled into the binary via go:embed.
go.mod for the version)corepack enable)git clone https://github.com/dujiao-next/dujiao-next.git
cd dujiao-nextRepository layout:
dujiao-next/
├── cmd/server/ # entry point
├── internal/
│ └── web/ # frontend embedding and SPA route mounting
├── frontend/
│ ├── admin/ # admin panel (Vue 3 + Vite)
│ └── user/ # storefront (Vue 3 + Vite)
├── config.yml.example
└── .goreleaser.yamlThe repository already describes the full build pipeline (frontend build + embedding) in GoReleaser, so a single local command is enough:
goreleaser build --snapshot --single-target --cleanThe output lands in dist/ as a complete binary with embedded frontends. This is the exact same path CI uses for releases.
If you don't have GoReleaser installed, build manually as described below.
# Admin panel: must use fullstack mode, which injects a <base> placeholder
# that the backend replaces at runtime
cd frontend/admin
pnpm install --frozen-lockfile
pnpm run build:fullstack
# Storefront
cd ../user
pnpm install --frozen-lockfile
pnpm run build
cd ../..admin must use build:fullstack
pnpm run build (without :fullstack) produces the standalone-domain variant with base hardcoded to /. Embedded under a custom prefix, it fails to load its static assets. Always use build:fullstack for embedding.
go:embed can only read files inside the package directory, so the frontend output must go under internal/web/dist/:
rm -rf internal/web/dist
mkdir -p internal/web/dist
cp -r frontend/admin/dist internal/web/dist/admin
cp -r frontend/user/dist internal/web/dist/userCGO_ENABLED=0 go build -trimpath -tags release,fullstack \
-ldflags="-s -w" \
-o dujiao-next ./cmd/server-tags fullstack is the key part: without it, the resulting binary contains no frontends and serves only the API.
Cross-compilation example (building a Linux binary on macOS):
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -trimpath -tags release,fullstack \
-ldflags="-s -w" -o dujiao-next-linux-amd64 ./cmd/serverFor secondary development or a custom split-frontend setup:
go build -o dujiao-api ./cmd/serverNeither / nor the admin path will be mounted. You then need to serve the frontend build with Nginx yourself and proxy /api, /uploads, /sitemap.xml, and /robots.txt to this service.
cp config.yml.example config.yml
# edit config.yml for your environmentAt minimum, verify:
server.mode (debug/release)database.driver / database.dsnapp.secret_key / jwt.secret / user_jwt.secretweb.admin_path (admin entry path — change the default /admin)redis, queue, email (enable as needed)⚠️ Critical security note: before going live, change
app.secret_key,jwt.secret, anduser_jwt.secretseparately, use high-entropy strings of at least 32 characters, and keep all three different.Never keep the template defaults; the service will refuse to start. Back up
app.secret_keywith the database because it is required to decrypt sensitive data.
./dujiao-nextDefault listen address: http://0.0.0.0:8080
This line in the startup log confirms the frontends were embedded correctly:
Embedded SPAs: admin (/dj-mgmt-7x9k2), user (/)When the admins table is empty, the system attempts to create a default administrator on first start:
adminStrongly recommended: change it to a strong password right after your first login, under "Admin -> Change Password".
Notes:
DJ_DEFAULT_ADMIN_USERNAMEDJ_DEFAULT_ADMIN_PASSWORDadmin123 anymore; if you lose the random password, run ./dujiao-next admin reset-password --username admin.Forward the whole site to a single port — no per-path splitting required:
server {
listen 443 ssl http2;
server_name shop.example.com;
ssl_certificate /path/to/fullchain.pem;
ssl_certificate_key /path/to/privkey.pem;
client_max_body_size 50m;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}During development you don't need to embed the frontends every time — run three processes and get hot reload:
# Terminal 1: backend (no fullstack tag, SPAs not mounted)
go run ./cmd/server
# Terminal 2: storefront at http://localhost:5173
cd frontend/user && pnpm run dev
# Terminal 3: admin panel at http://localhost:5174
cd frontend/admin && pnpm run devBoth Vite dev servers are preconfigured to proxy /api and /uploads to localhost:8080; the storefront also proxies /sitemap.xml and /robots.txt.
systemd / supervisor to supervise the process (see the systemd unit example in Single Binary Deployment)GET /health