Design Collection
Overview
Canonical current projection of one imported Figma design. design-import
replaces this strict document; Des2Code reads it as screen, region, and concrete
component-occurrence evidence. Design import is independent of code_index
readiness and does not persist an index/profile pin.
Table Definition
| Logical Name | Physical Name | Column Name | Data Type | Primary Key | Relation | Unique | Nullable | Default Value | Remarks |
|---|---|---|---|---|---|---|---|---|---|
| Design | design | _id | string | โฏ | Composite design ID: {project_id}_{file_id}_{node_id} |
||||
| organization_id | number | Tenant owner; positive integer | |||||||
| project_id | number | project:id | Project scope; positive integer | ||||||
| name | string | Design name | |||||||
| type | enum | DesignType, default screen |
|||||||
| based_on | enum | DesignOrigin, default Figma import |
|||||||
| file_id | string | Figma file key | |||||||
| node_id | string | Figma node ID | |||||||
| figma_url | string | Canonical source Figma URL | |||||||
| json_schema_url | string | S3 URL for the imported Figma JSON | |||||||
| visual.metadata.name | string | Display name | |||||||
| visual.metadata.image_url | string | S3 URL for rendered design image | |||||||
| visual.metadata.layout | string | Generated layout description | |||||||
| visual.metadata.component_types | string[] | Non-empty component categories | |||||||
| visual.metadata.color_palette | string[] | Non-empty extracted palette | |||||||
| visual.metadata.typography_style | string | Typography description | |||||||
| semantics.metadata.words | string[] | Non-empty domain/intent vocabulary | |||||||
| semantics.vector_embedding | float[512] | Screen semantic vector | |||||||
| structure.metadata.visible_text | string[] | [] | Visible text from the Figma subtree | ||||||
| structure.metadata.generic_terms | string[] | [] | Project-agnostic structural terms | ||||||
| structure.metadata.text | string | Deterministic screen structure text | |||||||
| structure.metadata.regions | object[] | [] | Bounded regions; each has metadata and vector_embedding |
||||||
| structure.metadata.component_instances | object[] | [] | Concrete Figma component occurrences | ||||||
| structure.vector_embedding | float[512] | Screen structure vector | |||||||
| processing.hash | string | 64-character SHA-256 idempotency fingerprint |
Each regions[] item contains metadata{node_id, role, query_terms, text,
bounds, depth, child/descendant counts, type counts, repeated signatures,
font weights/sizes} plus vector_embedding: float[512].
Each component_instances[] item contains node_id, display/component/
component-set IDs, keys, names and description, properties, bounds, depth,
parent, path, visible text, and summary. Optional Figma library identities are
nullable; node_id and name are required.
Relations
project_idโ PostgreSQLproject.id(logical; backend/application scope checks)- Des2Code SQS
design_idโdesign._idin the same organization/project - No foreign keys are enforced inside DocumentDB.
Indexes
- PRIMARY KEY (
_id) - INDEX
design_scope_catalog(organization_id,project_id,name)
There is no design vector index. Des2Code uses the stored design vectors as queries against code and variation indexes.
Vector Index Options
- Persisted vector dimensions: 512
- Query similarity: cosine
- Design vectors are query inputs; vector indexes live on
codeandcode_variation.
Notes
design-importowns replacements and validates the canonical storage model.file_id,node_id,figma_url,json_schema_url, image metadata, semantic vector, screen structure vector, andprocessing.hashare required.- There is no
index_schema_version, generation context, viewport, visual vector, semantic component-functions list,structuralblock, top-levelquery_terms,figma_node,localized_regions, model/encoder metadata, index pin, or history field. - Region and component-instance evidence is bounded during import. Des2Code searches at most 32 stored region vectors per request.
- Des2Code derives aligned terms in memory from design terms and the current
ready
code_index; it never mutates this document. - Des2Code results are written only as request-scoped S3 artifacts. The backend webhook validates scope/logs status and does not persist a result row.