Kiến trúc & Nền tảng kỹ thuật

Mô tả về độ trưởng thành kỹ thuật và các quyết định thiết kế của nền tảng BCanvas — không phải hướng dẫn triển khai.

Tài liệu kỹ thuật · Cập nhật 2026 · Dành cho CTO & kiến trúc sư hệ thống

Một codebase, hai môi trường triển khai

BCanvas là nền tảng single-codebase, dual-deployment. Cùng một source code biên dịch thành hai sản phẩm độc lập.

Cloud — Multi-tenant Web Application

Database cô lập theo tenant, tenant resolution theo context propagation trên mỗi request. Một deployment phục vụ N tổ chức.

  • Phân tách DB vật lý theo tenant
  • Namespace session theo tenant slug
  • Module enable/disable per tenant
  • Tenant provisioning atomic + distributed lock
Desktop — Native Windows Application

Không cần Python runtime, không external dependencies. Single executable, hoạt động hoàn toàn offline.

  • File ~250–350 MB, chạy trên mọi Windows hiện đại
  • First launch: wizard chọn data folder + init DB
  • Update = file mới, data persist qua sidecar reference
  • Multi-user qua partition model trên shared drive

Đây không phải web wrapper với chế độ dự phòng. Cả hai deployment target đều là first-class, tính năng đồng đều, scaling model độc lập.

Ba lớp cô lập độc lập

Mỗi lớp hoạt động độc lập. Breach một lớp không đồng nghĩa breach toàn bộ.

Lớp 1
Source Code
Module-level enable/disable per tenant

Module được bật/tắt theo từng tenant qua configuration. Source code của module có trên server không đồng nghĩa tenant có thể thấy nó — phải được enable explicitly. Tenant không thể enumerate module configuration của tenant khác.

Lớp 2
Database
Phân tách database vật lý

Database của mỗi tenant là một file SQLite riêng biệt trên persistent volume. Toàn bộ DB path resolution được scoped theo tenant tại request level — không có shared application database cho runtime data. Truy cập chéo DB giữa tenant là không thể về kiến trúc nếu không vi phạm path resolver.

Lớp 3
Session
Namespace session per tenant slug

Session storage được namespace theo tenant slug. Session của Tenant A đã authenticated, active trên cùng browser, không thể access storage namespace của Tenant B — kể cả khi thao tác ở cấp tab. Tenant provisioning là atomic, có reserved-slug blocklist và distributed lock table ngăn concurrent-create races.

Agent là first-class entity — không phải tích hợp

Lớp agentic là capability native của nền tảng. Agent có persistent state, tool access, scheduling và notification routing.

Orchestration phân cấp

Lead agent điều phối và delegate cho specialist sub-agents, mỗi sub-agent được scoped vào subset of tools và data. Mô hình mirror cách một management team vận hành: lead agent phối hợp, specialist agent thực thi trong domain.

Tool surface modular, role-gated

Mỗi analytical module có thể expose typed tools cho agent — query operations, data mutations, output publishing. Tool surface của lead agent là union của tất cả module tools được enable cho tenant đó, resolved at runtime và cached.

Scheduling in-process

Single cron runner xử lý tất cả scheduled agent triggers, data sync jobs và indexing tasks. Không có external job queue để vận hành — đủ capable cho current scale profile mà không thêm operational complexity.

Data Index & Curator sub-agent

Data Index là AI-generated metadata layer trên tất cả tenant data sources. Curator sub-agent hoạt động như pure routing layer — convert natural language questions thành source retrieval calls trước khi hand off cho reasoning agent. Indexing incremental, triggered bởi data mutations — không phải scheduled batch.

Provider-agnostic, tier-structured

AI stack không bị gắn chặt với một vendor. Ba capability tier map sang provider-model pairing được cấu hình per tenant.

Tier High
Phân tích nặng

Sử dụng cho các analytical task phức tạp: báo cáo tài chính sâu, phát hiện anomaly đa biến, tổng hợp insight cross-module. Provider/model cấu hình per tenant — hoán đổi không cần code release.

Tier Mid
Xử lý trung bình

Routing, classification, tóm tắt nhanh, Q&A trên structured data. Balance giữa cost và capability — phù hợp cho high-frequency operational tasks.

Tier Low
Tác vụ nhẹ

Formatting, label extraction, simple transformation. Tối ưu chi phí cho các tasks không cần suy luận phức tạp — có thể chạy với latency thấp nhất và cost tối thiểu.

Quyết định kỹ thuật AI

Streaming tự động chọn

Tự động kích hoạt streaming khi response vượt per-provider token threshold. Streaming response được convert về cùng output shape với non-streaming path — caller không thấy sự khác biệt.

Prompt caching mặc định

Active by default trên supported providers. Giảm cả latency và cost trên repeated analytical patterns — đặc biệt có giá trị với các reporting workflows chạy định kỳ.

Ẩn danh là platform concern

Toàn bộ AI I/O đi qua anonymizer mask các sensitive terms được configure trước khi request rời platform, unmask trong response. Modules không implement masking riêng — đây là responsibility của infrastructure.

Audit log mỗi AI call

Usage được log per call: provider, model, token counts, masked I/O. Cung cấp audit trail đầy đủ và cost accounting foundation — truy vết được mọi lần gọi AI theo tenant, module và thời gian.

SQLite — lựa chọn có chủ đích

Workload của nền tảng là read-heavy analytical queries trên tens of thousands of rows per tenant — không phải high-concurrency write operations.

SQLite, không phải PostgreSQL

Per-tenant file model cho strong isolation, trivial backup (file copy), và khả năng chạy identically trên cloud server lẫn local laptop — đây là dual-deployment guarantee. Không có shared state nào cần coordinate giữa các tenant.

Journal mode: TRUNCATE, không phải WAL

Lý do không phải WAL: WAL mode tạo sidecar files mà cloud-sync agents (Google Drive, OneDrive) sync độc lập và out-of-order — gây silent corruption. TRUNCATE giữ journal trong main file. Đây là non-negotiable constraint với bất kỳ khách hàng nào chạy shared data_root trên synced folder.

Multi-user desktop: Partition model

Mỗi user viết vào database file riêng. Shared read database được rebuild bằng cách merge tất cả partitions khi mở. Cho phép concurrent desktop use trên shared drive mà không cần network database server.

File thực thi Windows tự chứa hoàn toàn

Pipeline tự động biên dịch Python application thành Windows executable — không cần interpreter trên máy end-user.

▸ STEP 1 Dependency analysis + static compilation to native code ▸ STEP 2 Asset bundling: config · markdown resources · AI playbooks · static files ▸ STEP 3 Data seeding — demo state baked into executable, hydrated on first launch ▸ STEP 4 Post-build smoke testing: 25 package import checks before packaging ▸ STEP 5 Final packaging via LZMA compression → single distributable file ✓ OUTPUT ~250–350 MB single file Non-technical user runs on any modern Windows · No setup required

Data seeding cho phép developer bake demo state vào executable — customer nhận file và đã có sẵn dữ liệu mẫu thực tế. Zero-friction customer handoff.

Tối giản round-trip, tối ưu cache

Trên deployment xuyên đại dương (cloud-to-Vietnam), mỗi round-trip không cần thiết đều visible với người dùng.

HTTP compression

Trên tất cả responses, với configurable minimum size threshold để tránh overhead cho small payloads.

Per-tenant TTL cache

Hot, idempotent DB reads được cache: theme tokens, module registry, file modification times. Cache invalidated tại write site — TTL chỉ là safety net.

Cache headers chiến lược

Long-lived headers cho versioned static assets. Short-lived cho per-tenant branding. No-cache cho manifests — đúng từng loại asset.

Service worker scoped

Scoped strictly vào static asset path — không bao giờ intercept module pages hoặc tenant data routes. Tránh stale cache bugs cho dynamic content.

Eager module preload at boot

Tất cả module UI files được import tại startup — user click đầu tiên không phải trả cold-load cost. Perceived performance tốt hơn đáng kể trên connection chậm.

Context async boundary

Context propagation qua async boundaries được xử lý ở infrastructure level — AI calls trong background workers luôn resolve đúng tenant context, bất kể async runtime scheduling.

Vài ngày, không phải vài tháng

Analytical module mới được xây qua quy trình expert-agent collaboration. Domain expertise và engineering execution song song — không tuần tự.

Domain Expert định nghĩa

Bài toán phân tích, input data shape và expected output (reports, ratios, narratives).

AI Agent scaffold

AI-augmented development agent scaffold module skeleton, implement data pipeline, build report layout, wire AI analytical layer.

Expert review & iterate

Expert review domain accuracy — không phải implementation details. Expert không chờ engineer. Engineer không đoán requirements một mình.

Test trên real data

Module được test với real customer data trong isolated worktree trước khi promote lên platform production.

Mỗi customer's modules là independent forks. Thay đổi financial analysis module của customer A không bao giờ được inherit bởi customer B's version của cùng module đó. Đây là giải pháp cho "lowest common denominator" problem của shared BI template systems.

Những gì chúng tôi không công bố tại đây

Các lựa chọn cụ thể trong compilation pipeline, exact context propagation implementation, AI prompt architecture, và module scaffold patterns là proprietary. Nếu bạn đang đánh giá BCanvas cho enterprise deployment và cần deeper technical assurance, liên hệ trực tiếp với chúng tôi.

Liên hệ đánh giá kỹ thuật

Đánh giá kỹ thuật BCanvas cho tổ chức của bạn

Chúng tôi sẵn sàng cung cấp technical brief, security documentation và demo môi trường staging theo yêu cầu.