# Atomic Schema Architecture for Composable Prompt Parts in GPT Image Generation

> Discover the atomic schema architecture for composable prompt parts in GPT image generation. Learn how modular components like Subject, Lighting, and Layout create reusable, programmatic prompts.

- Repository: [苍何/awesome-gpt-image-2](https://github.com/freestylefly/awesome-gpt-image-2)
- Tags: architecture
- Published: 2026-09-02

---

**The atomic schema architecture treats image generation prompts as modular, interchangeable components—specifically Subject, Lighting, Layout, Materials, and Visual Details—that concatenate in a deterministic order to produce reusable, programmatic prompts.**

The freestylefly/awesome-gpt-image-2 repository implements this architecture to decouple prompt construction into independent visual dimensions. By storing each dimension as discrete string tokens in [`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json), the system enables agents, scripts, and UI controls to assemble coherent prompts without grammatical fragmentation.

## What Is the Atomic Schema Architecture?

The atomic schema architecture breaks monolithic text prompts into **independent, reusable pieces** representing distinct visual dimensions. Each piece functions as a string token that can be swapped, randomized, or combined without breaking the overall prompt grammar.

According to the [`README.md`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/README.md) section on atomic schema design, this approach treats prompt construction as a **compositional process** rather than a monolithic string block. The architecture ensures that changing one visual aspect—such as switching from "golden hour" to "neon night" lighting—does not require rewriting the entire prompt structure.

## The Five Core Atomic Components

The schema defines five mandatory categories that cover the complete visual pipeline. Each category stores its vocabulary in [`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json) as an array of descriptive strings.

### Subject

The **Subject** defines what the image depicts. This atomic part anchors the entire prompt and typically includes nouns and descriptive adjectives that establish the primary focal point. Common entries include "a futuristic city," "a portrait of a samurai," or "a classic sports car."

### Lighting

The **Lighting** component controls illumination quality and direction. This dimension determines mood, time of day, and atmospheric depth. Typical values include "golden hour," "studio softbox," "dramatic back-light," and "neon night."

### Layout

The **Layout** atomic part governs spatial arrangement and compositional structure. It specifies camera angles, framing rules, and subject positioning within the canvas. Examples include "center-filled," "rule-of-thirds," "overhead view," and "portrait framing."

### Materials

The **Materials** dimension defines surface qualities, textures, and physical properties. This component adds tactile realism by specifying finishes such as "metallic finish," "velvet fabric," "glossy wood," or "transparent glass."

### Visual Details

The **Visual Details** category contains fine-grained modifiers that refine technical and aesthetic qualities. These include color grading instructions, resolution specifications, and stylistic overlays like "cinematic color grading," "ultra-realistic," "8K resolution," and "depth-of-field."

## Composability and Deterministic Assembly

The atomic schema achieves **composability** by enforcing a deterministic concatenation order. When the prompt engine renders a template—documented in [`docs/templates.md`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/docs/templates.md)—it joins the selected atomic parts in a specific sequence: `subject → lighting → layout → materials → visual details`.

This ordering ensures grammatical coherence while maintaining flexibility. Because each part is stored as a **discrete entry** in the style library, you can programmatically swap any token without syntactic side effects. The engine treats each selection as a simple string join operation, separating components with commas or spaces to create human-readable output.

## Programmatic Implementation

The repository demonstrates this architecture through prompt-generation scripts like [`src/main.jsx`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/src/main.jsx). These implementations read the atomic vocabularies from [`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json) and concatenate them using standard string interpolation.

```javascript
// Example: building a prompt with the atomic schema
import styleLib from '../data/style-library.json';

// Helper to pick a random entry from a category
const pick = (cat) => cat[Math.floor(Math.random() * cat.length)];

// Assemble a prompt
function buildPrompt() {
  const subject   = pick(styleLib.subjects);
  const lighting  = pick(styleLib.lighting);
  const layout    = pick(styleLib.layout);
  const material  = pick(styleLib.materials);
  const details   = pick(styleLib.visualDetails);

  // Join parts – order follows the recommended atomic schema
  return `${subject}, ${lighting}, ${layout}, ${material}, ${details}`;
}

// Sample output
// "a futuristic city, golden hour, rule-of-thirds, glossy glass, ultra‑realistic, 8K resolution"
console.log(buildPrompt());

```

The underlying data structure in [`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json) organizes these tokens as categorized arrays:

```json
// Excerpt from data/style-library.json (illustrative)
{
  "subjects": [
    "a portrait of a samurai",
    "a classic sports car",
    "a futuristic city"
  ],
  "lighting": [
    "golden hour",
    "studio softbox",
    "neon night"
  ],
  "layout": [
    "center‑filled",
    "rule‑of‑thirds",
    "overhead view"
  ],
  "materials": [
    "metallic finish",
    "velvet fabric",
    "transparent glass"
  ],
  "visualDetails": [
    "cinematic color grading",
    "ultra‑realistic",
    "8K resolution",
    "depth‑of‑field"
  ]
}

```

## Repository Structure and Key Files

Understanding the atomic schema requires familiarity with four critical files in the freestylefly/awesome-gpt-image-2 repository:

- **[`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json)** — Stores the atomic vocabularies for each prompt part as categorized string arrays. This file serves as the single source of truth for available tokens.

- **[`docs/templates.md`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/docs/templates.md)** — Documents how atomic parts combine into ready-to-use templates. This file specifies the deterministic ordering logic and provides examples of complete prompt assemblies.

- **[`src/main.jsx`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/src/main.jsx)** (or equivalent generation scripts) — Contains the implementation logic that reads the style library and executes the concatenation routine. This file demonstrates the programmatic interface for building prompts.

- **[`README.md`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/README.md)** — Contains the high-level design rationale for the atomic schema, explaining the architectural philosophy behind modular prompt construction.

## Summary

- The atomic schema architecture divides image generation prompts into five independent dimensions: Subject, Lighting, Layout, Materials, and Visual Details.
- Each dimension stores its vocabulary in [`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json) as discrete string tokens that can be programmatically selected and swapped.
- The system concatenates tokens in a deterministic order—subject first, followed by lighting, layout, materials, and visual details—to ensure grammatical coherence.
- Templates defined in [`docs/templates.md`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/docs/templates.md) standardize the assembly process, enabling agents and scripts to generate batches of prompts without manual string manipulation.
- The architecture supports large-scale automation by treating prompts as composable data structures rather than monolithic text blocks.

## Frequently Asked Questions

### What is the atomic schema architecture in awesome-gpt-image-2?

The atomic schema architecture is a modular design pattern that deconstructs image generation prompts into five independent components—Subject, Lighting, Layout, Materials, and Visual Details. Each component acts as a reusable token stored in [`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json), allowing programmatic assembly of grammatically correct prompts through deterministic concatenation.

### How does the deterministic ordering work in the atomic schema?

The schema enforces a specific concatenation sequence: Subject → Lighting → Layout → Materials → Visual Details. When the prompt builder function in [`src/main.jsx`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/src/main.jsx) executes, it retrieves one token from each category and joins them with comma separators. This fixed ordering ensures that modifiers logically follow their subjects and lighting conditions precede material descriptions, maintaining natural language flow.

### Can I add custom atomic parts to the schema?

Yes. Because the architecture stores all vocabulary in [`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json), you can extend any category by adding new string entries to the appropriate JSON array. The prompt builder dynamically reads these arrays, so new entries immediately become available for random selection or manual assignment without requiring changes to the concatenation logic.

### What file contains the vocabulary for prompt components?

The [`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json) file contains the complete atomic vocabulary. This JSON structure organizes tokens into five top-level keys—`subjects`, `lighting`, `layout`, `materials`, and `visualDetails`—each holding an array of descriptive strings that the generation scripts reference during prompt construction.