This guide helps you get Shadmin running locally in 5 minutes.
| Tool | Minimum Version | Notes |
|---|---|---|
| Go | 1.25+ | Download |
| Node.js | 18+ | Download |
| pnpm | 9+ | npm install -g pnpm (npm also works) |
git clone https://github.com/ahaodev/shadmin.git
cd shadminThe backend embeds the frontend build output via web/web.go, so you must install dependencies and build the frontend first, otherwise Go compilation will fail:
cd web
pnpm install # Install frontend dependencies
pnpm run build # Build frontend, outputs to web/dist/
cd ..go run .On first startup, Shadmin will automatically:
- Generate a
.envconfig file from.env.example - Create a SQLite database (
.database/data.db) - Run database migrations
- Initialize the default admin account
- Scan and register API resources
Once started, the server listens at http://localhost:55667, serving both the API and the frontend.
If you need to develop the frontend, start the frontend dev server separately:
cd web
pnpm devThe dev server runs at http://localhost:5173 and proxies /api requests to the backend at :55667.
Open http://localhost:55667 (or http://localhost:5173 in dev mode) and log in with the default credentials:
| Field | Default |
|---|---|
| Username | admin |
| Password | 123456 |
Default credentials are configured in
.env(ADMIN_USERNAME/ADMIN_PASSWORD). Change them in production.
After starting the backend, visit http://localhost:55667/swagger/index.html to view the auto-generated API docs.
Core settings in the .env file:
# Database — defaults to SQLite, switchable to PostgreSQL or MySQL
DB_TYPE=sqlite
# PostgreSQL: postgres://user:password@localhost:5432/dbname?sslmode=disable
# MySQL: user:password@tcp(localhost:3306)/dbname?parseTime=true&loc=Local&charset=utf8mb4
DB_DSN=
# Authentication tokens
ACCESS_TOKEN_EXPIRY_MINUTE=180
REFRESH_TOKEN_EXPIRY_MINUTE=1440
ACCESS_TOKEN_SECRET=default-access-secret # Must change in production
REFRESH_TOKEN_SECRET=default-refresh-secret # Must change in production
# File storage — defaults to local disk, switchable to MinIO/S3
STORAGE_TYPE=disk
STORAGE_BASE_PATH=./uploadsSee .env.example for the full configuration reference.
Make sure you've built the frontend (pnpm install && pnpm run build), then:
go build -o shadmin .
./shadminThe frontend is embedded in the binary — no separate frontend deployment needed.
# Build the image
docker build -t shadmin .
# Run (default SQLite)
docker run -d --name shadmin -p 55667:55667 shadmin
# Mount volumes for persistence (recommended)
docker run -d --name shadmin \
-p 55667:55667 \
-v ./database:/app/database \
-v ./uploads:/app/uploads \
-v ./logs:/app/logs \
shadminVisit http://localhost:55667 after startup.
Port 55667 already in use
# Change PORT in .env
PORT=:8080Go version too old
go version # Requires 1.25+pnpm not installed
npm install -g pnpmFrontend dependency installation fails
cd web
rm -rf node_modules pnpm-lock.yaml
pnpm install- Architecture Overview — Understand Shadmin's layered design
- Development Guide — Add new feature modules
- Deployment Guide — Production deployment