The architecture at a glance

Three layers. Crystal-clear boundaries. The middleware layer is the secret — it silently handles everything your backend used to drown in.

┌─────────────────────────────────────────────────────────────────────────────┐ SMART FRAMEWORK — SYSTEM ARCHITECTURE └─────────────────────────────────────────────────────────────────────────────┘ ┌──────────────────────────── FRONTEND LAYER ───────────────────────────────┐ [ Smart UI Libraries ] [ Browser Extension ] [ IDE Extensions ] Components, hooks, Dev overlay, inspect VS Code / JetBrains modular standalone mode, live hot-swap smart completions, units. No bundling. monitoring, debug auth-aware snippets └────────────────────────────────────┬───────────────────────────────────────┘ │ HTTP / WebSocket requests ┌────────────────────────────────────▼───────────────────────────────────────┐ │ SMART MIDDLEWARE LAYER │ │ │ ① Session Validation ② Route Permissions ③ Field Permissions & Session (Admin Panel, incl. nested fields, Binding zero-deploy policy) zero-deploy policy ④ Ghost Protection ⑤ Audit Logging ⑥ Request Shaping Field-level race Full before/after Strip unauthorized condition guard diff, automatic fields before automatic no code required hitting backend Policy source: Admin Control Panel (live, no deployment required) └────────────────────────────────────┬───────────────────────────────────────┘ │ Clean, authorized, safe request ┌────────────────────────────────────▼───────────────────────────────────────┐ │ BACKEND LAYER │ │ │ [ Smart BE Libraries ] [ Smart Packages ] 100% Code Logic Shared domain logic, 100% Business Logic utilities, data access ZERO auth checks ZERO logging code ZERO audit code ZERO race condition handlers ZERO API version handling ZERO permission checks └────────────────────────────────────────────────────────────────────────────┘

Each layer has
one job. Only one.

This is not a convention. It's structural enforcement. The framework makes it impossible for concerns to bleed across layers.

Layer 01
Frontend

The FE layer consists of standalone, hot-swappable component units built with Smart UI Libraries. The Browser Extension provides a live dev overlay. IDE Extensions bring framework awareness directly into your editor.

  • Smart UI Libraries — standalone modular components
  • No monolithic bundles — every unit is independent
  • Hot-swap on change — zero page refresh for end users
  • Browser Extension — dev overlay, inspect, debug
  • IDE Extensions — smart completions, auth-aware snippets
  • Live policy reflection — UI responds to permission changes instantly
🛡️
Layer 02
Smart Middleware

The middleware layer is where Smart Framework's intelligence lives. Every request passes through a six-stage pipeline that handles authentication, authorization, Ghost Protection, and audit logging — automatically, invisibly, without a single line of code from you.

  • User validation + session binding (stage 1)
  • Route-level permission check (stage 2)
  • Field-level permission filtering, incl. nested (stage 3)
  • Record Ghost Protection — field-level (stage 4)
  • Full audit log — before/after diff auto-captured (stage 5)
  • Admin Panel → zero-deployment policy changes (live)
🧠
Layer 03
Backend — Pure Logic

The BE layer receives requests that have already been fully validated, authorized, and sanitized by middleware. It has one job: execute business logic and return a result. That is all it will ever do.

  • 100% Code Logic + Business Logic only
  • Zero authentication or authorization checks — ever
  • Zero logging code — ever
  • Zero race condition handlers — ever
  • Zero API version routing — ever
  • Pure functions — easy to read, test, and maintain

How Smart Auth Weaving
actually works.

Most authentication and authorization frameworks require you to annotate, decorate, or call a guard function. Smart Framework's Smart-Code engine reads your route definitions and the Admin Panel policy store, then automatically weaves authentication, authorization, and safety into the request pipeline. You write nothing.

SMART MIDDLEWARE PIPELINE — request lifecycle
01
Session Validation & Binding

Every inbound request is inspected for a valid JWT. The token is decoded, verified against the secret store, and the resulting identity principal is bound to the request context. Expired, malformed, or missing tokens terminate here with a 401. Your backend code never sees an unauthenticated request.

// Automatically injected — you write nothing
context.principal = await validateAndBindToken(request.headers.authorization)
context.sessionId = await resolveSession(context.principal)
02
Route-Level Permission Check

The Smart-Code engine queries the Admin Control Panel policy store for the current route + HTTP method combination. If the identity principal lacks the required permission, a 403 is returned immediately. Policies are evaluated in real time — no deployment required to update them. No decorator. No guard annotation in your code.

// Policy loaded live from Admin Control Panel
policy = policyStore.get(route, method, context.principal.roles)
if (!policy.allowed) reject(403, 'Forbidden')
03
Field-Level Permission Filtering (incl. Nested)

For write operations, the request body is scanned field-by-field (and recursively into nested objects) against the field-level policy for this principal. Fields the user is not permitted to write are silently stripped from the payload before it ever reaches your backend handler. For reads, the response body is filtered on egress by the same mechanism.

// Nested field filtering — automatic
request.body = filterFields(request.body, policy.allowedFields)
// e.g. order.payment.cardNumber stripped if role !== 'finance'
04
Pass-Through to BE

Once auth policies are enforced, the authenticated, field-filtered request is passed clean to the BE library. Ghost Record Protection is not a Middleware concern — it is a native capability built into the Smart Framework's FE and BE libraries. The FE library tracks field-level fetch snapshots on the client side; the BE library validates incoming writes against concurrent modifications and resolves conflicts at the field level before any data is persisted. Both layers operate automatically with zero developer code required.

// Middleware only passes the clean, auth-checked request
// Ghost Protection runs in the BE library — not here
next(request) // → BE library handles the rest
05
Audit Logging — Before/After Diff

After the handler executes, the middleware captures the response, computes a precise before/after field-level diff, and writes it to the audit store with the principal identity, timestamp, session ID, and route. Full, searchable, tamper-evident audit trail — zero code in your handlers, zero configuration per endpoint.

// Automatic audit — nothing to configure
auditStore.write({ principal, route, sessionId, timestamp,
before: snapshot.before, after: response.body, diff: fieldDiff(before, after) })
06
Egress Field Filtering

On the response path, the same field-level policy engine runs in reverse. Any response fields the current principal is not permitted to read are stripped before the response is serialized and returned. This applies to deeply nested structures — no manual projection needed in your query code.

// Response filtered on egress — automatic
response.body = filterResponseFields(response.body, policy.readableFields, context.principal)
Zero-Deployment Policy Changes: The Admin Control Panel writes policies to a live policy store. The Smart-Code engine polls this store with sub-second latency. Adding a new permission rule, restricting a field, or revoking a role's route access takes effect immediately — no code change, no pull request, no deployment, no downtime.

What your backend code
actually looks like.

Side-by-side: a real mutation handler in a traditional Node.js/Express stack versus the same handler in Smart Framework. Same business outcome. Radically different signal-to-noise.

createInvoice.js — Traditional Express 72 LINES
// Every single concern mixed together. // Auth, validation, logging, logic — all one blob. router.post('/invoices', async (req, res) => { // ── AUTH ── (copy-paste from every other route) const token = req.headers.authorization?.split(' ')[1] if (!token) return res.status(401).json({ error: 'No token' }) let user try { user = jwt.verify(token, process.env.JWT_SECRET) } catch { return res.status(401).json({ error: 'Invalid token' }) } // ── PERMISSIONS ── (also copy-paste) const perms = await db.query( `SELECT permissions FROM roles WHERE id = $1`, [user.roleId] ) if (!perms.rows[0]?.permissions.includes('invoices:create')) { return res.status(403).json({ error: 'Forbidden' }) } // Field-level check (often forgotten) if (req.body.discount && !perms.rows[0]?.permissions.includes('invoices:create:discount')) { return res.status(403).json({ error: 'Cannot set discount' }) } // ── VALIDATION ── (yet more boilerplate) const { customerId, lineItems, discount, dueDate } = req.body if (!customerId || !lineItems?.length) { return res.status(400).json({ error: 'Missing fields' }) } // ── ACTUAL BUSINESS LOGIC ── (4 lines out of 72) const total = lineItems.reduce((sum, item) => sum + (item.qty * item.unitPrice), 0) const finalAmount = total - (discount ?? 0) const invoice = await db.query( `INSERT INTO invoices (...) VALUES (...) RETURNING *`, [customerId, finalAmount, dueDate, user.id] ) // ── AUDIT LOG ── (always manual) await db.query( `INSERT INTO audit_log (user_id, action, payload, created_at) VALUES ($1, $2, $3, NOW())`, [user.id, 'CREATE_INVOICE', JSON.stringify(invoice.rows[0])] ) res.json(invoice.rows[0]) })
createInvoice.handler.ts — Smart Framework (Sample) 12 LINES
// Nothing but business logic. // Auth, permissions, audit — all handled by middleware. export async function createInvoice( input: CreateInvoiceInput, context: SmartContext ): Promise<Invoice> { // ── BUSINESS LOGIC. ALL OF IT. ── const total = input.lineItems.reduce( (sum, item) => sum + (item.qty * item.unitPrice), 0 ) const finalAmount = total - (input.discount ?? 0) return context.db.invoices().create({ customerId: input.customerId, amount: finalAmount, dueDate: input.dueDate, createdBy: context.principal.id }) } // That's it. // ✓ Auth validated (middleware stage 1) // ✓ 'invoices:create' permission checked (stage 2) // ✓ 'discount' field permission enforced (stage 3) // ✓ Ghost Protection active (stage 4) // ✓ Full audit log written (stage 5) // ✓ Response field-filtered on egress (stage 6)

Why this architecture
scales with you.

🔒
Security by Architecture

Auth is not a library you call — it's a layer you can't skip. Every request passes through the same pipeline regardless of which handler runs. A developer cannot accidentally skip auth on a new endpoint because the framework never gives them a chance to write it.

🧩
True Separation of Concerns

Backend code reads exactly like a domain model: entities, operations, and rules. No cross-cutting concerns. This isn't enforced by convention or code review — it's enforced by the framework making it structurally impossible to add auth code to a BE handler.

Zero-Deploy Policy Velocity

New route added by a dev at 2pm. PM wants to restrict a field for junior users at 2:05pm. Admin updates the policy in the Control Panel. Done. No pull request. No review cycle. No deployment pipeline. Effective immediately.

🔬
Pure Functions = Perfect Tests

A handler that contains only business logic is trivially unit-testable. No mocking of auth middleware, no JWT fixtures, no permission stubs. Pass input, assert output. Test coverage for your actual logic goes from painful to effortless.

Explore Features → Get Started