-
Notifications
You must be signed in to change notification settings - Fork 2
Development
- .NET 10 SDK
- Node.js 20+
- pnpm — version 10.22.0 enforced
- Docker (for integration tests with Testcontainers)
git clone https://github.com/tse-wei-chen/hs-sql-agent.git
cd hs-sql-agent
git submodule update --init --recursivecp backend/src/ToolBox/appsettings.Example.json backend/src/ToolBox/appsettings.jsonEdit appsettings.json to configure your database connection and secrets.
dotnet run --project backend/src/ToolBoxThe backend runs at http://localhost:8080.
# Run all tests
dotnet test backend/src/UnitTest/SqlAgent.Test/SqlAgent.Test.csproj
dotnet test backend/src/UnitTest/Admin.Test/Admin.Test.csproj
# Run a single test (xUnit v3)
dotnet test backend/src/UnitTest/SqlAgent.Test/SqlAgent.Test.csproj --filter "FullyQualifiedName~SqliteStrategyTests"Note: SqlAgent tests require Docker for Testcontainers (spins real containers for Postgres, MySQL, SQL Server, Oracle, FireBird). SQLite tests use in-memory SQLite (no container needed).
The solution file uses the .slnx format (not classic .sln):
backend/hs-sql-agent.slnx
Central package management is in backend/Directory.Packages.props. All NuGet package versions are defined there.
cd frontend
pnpm installpnpm devThe frontend dev server runs at http://localhost:3000 with API proxy at /api/** → http://localhost:8080/api/**.
pnpm generate # Static build to dist/ (used in Docker)pnpm test # Vitest with happy-dom| Convention | Detail |
|---|---|
| Source dir |
app/ (not default root) |
| Aliases |
@ and ~ → frontend/app/
|
| SSR | Disabled (ssr: false) |
| UI Library | shadcn-vue (style: nova, base: reka) |
| Styling | Tailwind CSS 4 |
| Forms | VeeValidate |
| HTTP | Xior (axios-like) |
docker compose up -dThe Dockerfile is a multi-stage build:
-
frontend-builder: Node 24 Alpine,
pnpm generate→dist/ -
backend-builder: .NET SDK 10.0, copies frontend
dist/→wwwroot/, publishesToolBox.dll -
runtime: ASP.NET 10.0 runtime, exposes 8080, runs
ToolBox.dll
- Tabs for most files
-
4-space indentation for
.csfiles -
2-space indentation for
.vue/.ts/.yml - See
.editorconfigat the project root
| Project | Framework | Type | Requires Docker |
|---|---|---|---|
| Admin.Test | xUnit v3+Moq | Unit tests | ❌ |
| SqlAgent.Test | xUnit v3 | Integration tests | ✅ (except SQLite) |
Code coverage exclusions (in Directory.Build.props):
[*]*.Models.***/Modules/SqlKata.Service/**/*
The backend reads configuration from appsettings.json + environment variables. Docker Compose overrides via environment variables:
| Variable | Description |
|---|---|
HMAC_KEY |
MCP HMAC secret key (32+ bytes) |
JWT_KEY |
JWT signing key (32+ bytes) |
JWT_ISS |
JWT issuer |
JWT_AUD |
JWT audience |
JWT_ACCESS_TOKEN_EXPIRATION_MINUTES |
Access token TTL |
JWT_REFRESH_TOKEN_EXPIRATION_DAYS |
Refresh token TTL |
RATE_LIMITING_PERMIT_LIMIT |
Max requests per window |
RATE_LIMITING_WINDOW_SECONDS |
Rate limit window |
RATE_LIMITING_QUEUE_LIMIT |
Queue size for rate limiter |
SqlConfig__Provider |
Global database provider fallback |
SqlConfig__ConnectionString |
Global database connection string fallback |
hs-sql-agent — GitHub | Apache License 2.0