SELISEdigitalplatforms/blocks-os
소개
Core console for SELISE Blocks: projects, environments, services, people, usage and logs-and-tracing.
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalBlocks OS
ASP.NET Core + React (Vite, TypeScript) application: Genesis-backed API, background worker, and a SPA built into server/Api/wwwroot so Kestrel can serve the UI and backend from one host. Node/npm are used for the client toolchain (install, dev server, production build).
Project structure
blocks-os/
├── client/ # React + Vite + TypeScript
│ ├── app/ # Application source
│ │ ├── cross-modules/ # Feature areas (idp, ai, communication, devops, identifier,
│ │ │ # lmt, localization, secrets, storage, utilities)
│ │ ├── routes/, pages/ # Route modules and pages
│ │ ├── layouts/, components/ # Shell UI, shared components
│ │ ├── hooks/, lib/, services/, providers/
│ │ ├── main.tsx, router.tsx
│ │ └── …
│ ├── public/ # Static assets
│ ├── index.html
│ ├── vite.config.ts # build.outDir → ../server/Api/wwwroot; `BLOCKS_*` env prefix
│ ├── package.json
│ └── .env.example # Copy to .env (see below)
├── server/
│ ├── Api/ # Web host (Kestrel, Genesis, controllers, static SPA)
│ │ ├── Controllers/ # HTTP API (attribute routes; `api` prefix via convention)
│ │ ├── wwwroot/ # Vite output (generated; do not edit by hand)
│ │ ├── Program.cs
│ │ ├── Api.csproj
│ │ └── GlobalApiRoutePrefixConvention.cs
│ ├── Worker/ # Background worker (message consumers, …)
│ ├── LmtManagedServiceWorker/ # Managed-service worker for logs, metrics and traces
│ ├── Cloud.DomainService/
│ ├── Cloud.LmtService/
│ ├── Configuration.DomainService/
│ ├── Identifier.DomainService/
│ ├── Secrets.DomainService/
│ ├── XUnitTest/ # Unit tests
│ └── BlocksOS.sln # Solution: Api, domain libraries, Workers, XUnitTest
├── e2e/ # Playwright end-to-end tests (see e2e/README.md)
├── scripts/ # CI helper scripts (report converters)
├── run.sh # Build/run helpers (Unix/macOS; see below)
├── run.ps1 # Same role on Windows (PowerShell; see below)
├── LICENSE
└── README.md
Prerequisites
- .NET 10 SDK (
TargetFrameworkisnet10.0inserver/Directory.Build.props) - Node.js LTS (for
npm install,npm run dev,npm run build) - Docker with Docker Compose (for local backing services; see below)
Local infrastructure
To run Blocks OS locally, clone blocks-infra and bring up its Docker Compose stack (for example docker compose up -d, using the compose file and options described in that repository). Start that stack before or alongside the API and Worker from this repo so local dependencies (databases, queues, and so on) are available.
How to run
Both run.sh (Bash) and run.ps1 (PowerShell) live at the repo root. They require an option; calling them with no recognized flags prints usage and exits.
Ports: both scripts assume API port 5000. run.sh also uses 4000 for npm run dev when you pass -f (see run.sh). server/Api/Properties/launchSettings.json may differ for IDE launches; use the URL your process prints.
Options (same flags, different invocation)
| Option | Role |
|---|---|
-a, --all |
Install/build client, sync client/dist → server/Api/wwwroot, then start API and Worker |
-b, --backend |
Run API only (dotnet run on server/Api/Api.csproj) |
-w, --worker |
Run Worker only (server/Worker/Worker.csproj) |
-f, --frontend |
Vite dev server: npm run dev in client/ (run.sh installs dependencies only if node_modules is missing; run.ps1 runs npm install every time) |
-k, --kill-port |
Stop whatever is listening on the API port (5000) |
-n, --npm args… |
Run npm in client/ (e.g. run test, run build) |
-tf, --test-fe |
Frontend unit tests in client/ (build as a TS gate, then vitest; SKIP_BUILD=1 skips the build) |
-te, --test-e2e |
End-to-end tests in e2e/ (Playwright; starts the API itself, needs e2e/.env.e2e) |
-tb, --test-be |
Backend unit tests: dotnet clean → build → test on server/BlocksOS.sln |
-ta, --test-all |
FE unit → BE unit → E2E, stopping at the first failure |
-h, --help |
Show usage |
Windows only (run.ps1): -d / --dotnet args… runs dotnet from the repo root (for example restore, build, or test commands).
Unix / macOS (run.sh)
./run.sh -a # full stack (build + API + Worker in this shell)
./run.sh -b # API only (frees port 5000 first)
./run.sh -f # Vite dev server
./run.sh -n run test # npm in client/
./run.sh -tf # frontend unit tests
./run.sh -tb # backend unit tests
./run.sh -te # e2e tests
./run.sh -ta # everything
run.sh syncs the built SPA with rsync (dist/ → wwwroot/). For -a, the API and Worker run as background jobs in the same terminal; Ctrl+C runs the script’s cleanup trap.
Windows (run.ps1)
.\run.ps1 -a # build + start API and Worker in separate windows
.\run.ps1 -b # API only (restore + free port 5000 first)
.\run.ps1 -f # Vite dev server
.\run.ps1 -n run test # npm in client/
.\run.ps1 -d test server/XUnitTest/XUnitTest.csproj
.\run.ps1 -tf # frontend unit tests
.\run.ps1 -tb # backend unit tests
.\run.ps1 -te # e2e tests
.\run.ps1 -ta # everything
run.ps1 syncs dist → wwwroot with robocopy. It runs dotnet restore on the Api and Worker projects before -b, -w, and -a. With -a, two extra PowerShell windows open (one for the API, one for the Worker); press Enter in the original window to stop those processes.
Without the scripts
If the client is already built into wwwroot:
dotnet run --project server/Api/Api.csproj
Client environment (BLOCKS_*)
Vite exposes env vars prefixed with BLOCKS_ (see client/vite.config.ts). Copy client/.env.example → client/.env and set values as needed:
BLOCKS_OS_BASE_URL: base URL of this service; when set it also enables the Vite dev proxy (client/vite.config.ts).BLOCKS_IAM_BASE_URL,BLOCKS_IAM_CLIENT_ID,BLOCKS_IAM_CALLBACK_URL: IAM endpoint and OIDC client for the sign-in flow.BLOCKS_<SERVICE>_BASE_URL/_CALLBACK_URL/_CLIENT_ID: per-service URLs and OIDC client ids for the sibling Blocks apps the console links to (data, logic, monitor, release, studio, utilities, localization, agents).BLOCKS_X_BLOCKS_KEY,BLOCKS_GOOGLE_SITE_KEY,BLOCKS_CONSTRUCT_URL,BLOCKS_GITHUB_SSO_CLIENT_ID,BLOCKS_BASE_DOMAIN: tenant key, captcha site key, construct URL, GitHub SSO client id and base domain used across the UI.
The full key list with comments is in client/.env.example.
Rebuild the client (npm run build in client/ or ./run.sh -a / .\run.ps1 -a) after changing env for production bundles.
Production / publish
Build the client, then publish the API (ensure wwwroot contains the built SPA if you want the UI in the output):
(cd client && npm install && npm run build)
dotnet publish server/Api/Api.csproj -c Release -o ./publish
No Node process is required on the server at runtime.
Tests
Run from the repository root:
# backend unit tests (xUnit); the solution is server/BlocksOS.sln
dotnet test server/XUnitTest/XUnitTest.csproj
# frontend unit tests (Vitest)
npm --prefix client run test
# end-to-end tests (Playwright); needs a reachable app and e2e/.env.e2e,
# see e2e/README.md for setup and target modes
npm --prefix e2e run test
Coverage:
dotnet test server/XUnitTest/XUnitTest.csproj --collect:"XPlat Code Coverage"
npm --prefix client run test:coverage
Deployment
Deployment to the dev host is driven entirely by GitHub Actions from .github/workflows/cicd-inception.yml, the single entry point for the inception branch. Security scanning (SAST, SCA, DAST and secret scanning) runs in parallel on GitHub-hosted runners and publishes to the dedicated portals; only the build and deploy step (inception-deploy.yml) runs on the self-hosted dev host, where it syncs inception, builds the client into server/Api/wwwroot, publishes the Api and Worker projects and restarts their systemd services. There is no deploy script in the repository, and this is not a general-purpose installer.
API and routing
- Controllers live under
server/Api/Controllers/(e.g. authentication, IAM, MFA, mail, storage, traces, projects). Route templates omit theapisegment in code;GlobalApiRoutePrefixConventioninProgram.csadds theapiprefix for attribute-routed controllers. /apiis reserved for the HTTP API in the integrated setup; keep client-side routes from colliding with API paths.
Identity & Access client routes
The client's identity administration section is labelled Identity & Access in the sidebar and is served under the /app/:itemId/iam/ prefix:
| Route | Page |
|---|---|
/app/:itemId/iam/settings |
Auth, IAM, Signup and Organization configuration tabs |
/app/:itemId/iam/users |
Users list |
/app/:itemId/iam/user-detail/:id |
User detail |
/app/:itemId/iam/organizations |
Organizations list |
/app/:itemId/iam/organization-detail/:orgId |
Organization detail |
/app/:itemId/iam/roles, /app/:itemId/iam/role-detail/:id |
Roles |
/app/:itemId/iam/permissions, /app/:itemId/iam/permission-detail/:id |
Permissions |
Users and Organizations management is owned by this client and calls the existing IAM backend APIs unchanged. The section previously used the /app/:itemId/idp/ prefix; those paths now redirect to their /iam/ equivalent.
Version endpoint
GET /api/versionreturns the running API assembly version. No authentication is required.Response body:
{ "version": "1.0.0.0" }The value is read from the running assembly (
Assembly.GetExecutingAssembly().GetName().Version), so it reflects whatever version the deployed build was stamped with.
Environment database placement
The API and workers use SeliseBlocks.Genesis.OS 4.2.2. New environments retain separate database names. OS stores the chosen connection in Tenant.DbConnectionString: prod uses DatabaseConnectionString, dev uses DevDatabaseConnectionString, and the other supported environments use OtherDatabaseConnectionString. Blank optional connections fall back to main; malformed configured connections reject the entire creation request before provisioning begins.
Keep RootDatabaseName (normally BlocksRootDb) on main. Tenant records, project membership and assets stay there; provisioning templates remain in main's BlocksConfiguration. Environment repositories and default configuration are written using the new tenant's stored connection. Existing tenants are not moved when secrets change.
For on-premises vaults, optional secret keys are BlocksSecret__DevDatabaseConnectionString and BlocksSecret__OtherDatabaseConnectionString; Azure vault names omit the prefix. Leave these blank until all participating consumers are ready. Restart APIs and workers after changing startup secrets. Migration messages retain their owner's tenant context through Genesis's message envelope; migration repositories resolve collections for each operation.
Normal builds use NuGet. For a sibling Genesis checkout, opt in with -p:UseLocalGenesis=true or an ignored server/Directory.Build.local.props. Set the flag to false to validate the published package.
Run dotnet test server/XUnitTest/XUnitTest.csproj -c Release with local MongoDB available. Placement tests cover selection/fallback/rejection, root versus provisioning destinations, and shared repository isolation. Before rollout, also verify provisioning and CRUD against three independent MongoDB deployments; local database tests alone do not establish cross-cluster connectivity.
Contributing and security
- Contribution conventions and workflow: CONTRIBUTING.md
- Reporting a vulnerability: SECURITY.md
- Community standards: CODE_OF_CONDUCT.md
License
See LICENSE.
관련 프로젝트 살펴보기
불러오는 중…