System Design Cheatsheet & Metaprompt for AI-Assisted Software Development

A universal framework and AI metaprompt for building applications from idea to scale. Includes cheatsheets, interview processes, and architecture blueprints for AI-assisted development.

JUMP TO CHEATSHEET MD

JUMP TO METAPROMPT MD

Author's note:

Prompt I use in helping me to plan and create software. Originally intended to just keep the alpha to myself, but I suppose the ordinary person isn't hard working enough to make use of it.

Might as well show it to the public to those who need it.

This prompt has not been tested extensively, but I've used it enough to vet its reliability.

Use Table of Contents to get to Markdown sections and copy.


CHEATSHEET

The General App Development Cheatsheet: From Idea to Scale

This guide provides a universal framework for developers to build, deploy, and maintain any application. It breaks down the process into logical stages with key questions, common patterns, and best practices.

Phase 1: The Blueprint - Strategy & Planning

Every great application starts with a clear plan. Rushing this stage leads to building the wrong thing.

StepKey Questions to AnswerCommon Outputs & Tools
1. Define the "Why"What problem does this app solve? Who is the target user? What is the core value proposition?A one-sentence mission statement. User personas. A list of "pain points" to be solved.
2. Scope the MVPWhat is the absolute minimum set of features needed to solve the core problem for the first users?User Stories: "As a [user type], I want to [perform an action], so that I can [achieve a goal]." A prioritized feature list.
3. Identify ConstraintsWhat is the budget? What is the timeline? What is the expected scale (100 users or 1 million users)?A project timeline, budget outline, and initial performance/scalability targets.
4. Choose the Tech StackBased on the requirements, team expertise, and ecosystem, what technologies will you use? (Frontend, Backend, Database)A list of chosen technologies. Justify why each was selected (e.g., "We chose Python/Django for rapid backend development").

Phase 2: The Foundation - System Architecture

Design a high-level structure for your application. This is your system's blueprint.

ConceptKey DecisionWhen to Choose Which
Application StructureMonolith vs. MicroservicesMonolith: All code in one single, deployable unit. Use when: You're a small team, building an MVP, or the domain is not complex. It's simpler to start. Microservices: App is broken into small, independent services. Use when: You have a large team, complex domains, or need to scale different parts of the app independently.
Data StorageSQL (Relational) vs. NoSQL (Non-Relational)SQL (e.g., PostgreSQL, MySQL): Your data is structured, and relationships are critical (e.g., users and their orders). Choose for data integrity and consistency. NoSQL (e.g., MongoDB, DynamoDB): Your data is unstructured or semi-structured, and you need high scalability and flexibility (e.g., user preferences, IoT data).
Core PatternClient-Server ModelAlmost all modern apps use this. • Client (Frontend): The user interface (Web browser, mobile app). Responsible for presentation and user interaction. • Server (Backend): The "brain." Responsible for business logic, data processing, and communicating with the database.

Phase 3: The Build - Development & Implementation

This is where you write the code, following best practices to ensure quality and maintainability.

AreaBest Practice / Common PatternDescription
API DesignREST (Representational State Transfer)A standard way to design APIs. Use nouns for endpoints (/users, /products) and HTTP verbs for actions (GET, POST, DELETE). Return data in a consistent format like JSON.
AuthenticationJWT (JSON Web Tokens)A stateless and secure way to verify who a user is. After logging in, the client receives a token and sends it with every subsequent request to prove its identity.
Code QualityVersion Control (e.g., Git)Track every change to your codebase. Use branches for new features to keep the main codebase stable.
Background ProcessingJob Queues (e.g., RabbitMQ, Redis Queue)For tasks that shouldn't block the user (e.g., sending a confirmation email, processing a video). The API adds a "job" to a queue, and a separate "worker" process picks it up and executes it.

Phase 4: The Launch - Testing & Deployment

Getting your application from your computer to the world, reliably and automatically.

StageKey ConceptTools & Process
1. TestingThe Testing PyramidUnit Tests: Test small, individual pieces of code in isolation. (Fast & Cheap) • Integration Tests: Test how different pieces work together. (Slower) • End-to-End Tests: Test the entire application flow from a user's perspective. (Slowest & Most Expensive)
2. DeploymentCI/CD (Continuous Integration / Continuous Deployment)An automated pipeline that builds, tests, and deploys your code whenever changes are pushed. This reduces human error and speeds up releases. (e.g., GitHub Actions, Jenkins).
3. InfrastructureCloud Providers & IaCHost your application on a cloud platform (AWS, Google Cloud, Azure) for scalability and reliability. Infrastructure as Code (IaC): Define your servers, databases, and networks in code (e.g., Terraform, CloudFormation) for reproducible and version-controlled environments.

Phase 5: The Long Game - Operations & Maintenance

Your app is live. Now the real work begins: keeping it running, healthy, and secure.

PillarCore ActivityKey Metrics & Tools
1. MonitoringObserve System Health (The "Is it working?")Track performance to find issues before users do. • Latency: How long do requests take? (e.g., P95, P99) • Traffic: How many requests are you serving? • Errors: What percentage of requests are failing?
2. LoggingRecord Events (The "What happened?")Collect and centralize application logs to debug issues. When an error occurs, logs are the first place to look to understand the cause. Use structured logging (JSON) for easy searching.
3. ScalingHandling More LoadVertical Scaling: Add more power (CPU, RAM) to your existing server. (Easy but has limits). • Horizontal Scaling: Add more servers. (More complex but highly scalable). Your architecture must be stateless to do this effectively.
4. SecurityProtecting Your App & UsersRegularly update dependencies to patch vulnerabilities. Protect against common attacks (e.g., SQL Injection, XSS). Secure user data and manage access credentials carefully.

CHEATSHEET Markdown

# The General App Development Cheatsheet: From Idea to Scale

This guide provides a universal framework for developers to build, deploy, and maintain any application. It breaks down the process into logical stages with key questions, common patterns, and best practices.

## Phase 1: The Blueprint - Strategy & Planning

Every great application starts with a clear plan. Rushing this stage leads to building the wrong thing.

| Step | Key Questions to Answer | Common Outputs & Tools |
| :--- | :--- | :--- |
| **1. Define the "Why"** | What problem does this app solve? Who is the target user? What is the core value proposition? | A one-sentence mission statement. User personas. A list of "pain points" to be solved. |
| **2. Scope the MVP** | What is the absolute minimum set of features needed to solve the core problem for the first users? | **User Stories:** "As a [user type], I want to [perform an action], so that I can [achieve a goal]." <br> A prioritized feature list. |
| **3. Identify Constraints** | What is the budget? What is the timeline? What is the expected scale (100 users or 1 million users)? | A project timeline, budget outline, and initial performance/scalability targets. |
| **4. Choose the Tech Stack** | Based on the requirements, team expertise, and ecosystem, what technologies will you use? (Frontend, Backend, Database) | A list of chosen technologies. Justify why each was selected (e.g., "We chose Python/Django for rapid backend development"). |

## Phase 2: The Foundation - System Architecture

Design a high-level structure for your application. This is your system's blueprint.

| Concept | Key Decision | When to Choose Which |
| :--- | :--- | :--- |
| **Application Structure** | **Monolith vs. Microservices** | **Monolith:** All code in one single, deployable unit. **Use when:** You're a small team, building an MVP, or the domain is not complex. It's simpler to start. <br> **Microservices:** App is broken into small, independent services. **Use when:** You have a large team, complex domains, or need to scale different parts of the app independently. |
| **Data Storage** | **SQL (Relational) vs. NoSQL (Non-Relational)** | **SQL (e.g., PostgreSQL, MySQL):** Your data is structured, and relationships are critical (e.g., users and their orders). Choose for data integrity and consistency. <br> **NoSQL (e.g., MongoDB, DynamoDB):** Your data is unstructured or semi-structured, and you need high scalability and flexibility (e.g., user preferences, IoT data). |
| **Core Pattern** | **Client-Server Model** | Almost all modern apps use this. <br> • **Client (Frontend):** The user interface (Web browser, mobile app). Responsible for presentation and user interaction. <br> • **Server (Backend):** The "brain." Responsible for business logic, data processing, and communicating with the database. |

## Phase 3: The Build - Development & Implementation

This is where you write the code, following best practices to ensure quality and maintainability.

| Area | Best Practice / Common Pattern | Description |
| :--- | :--- | :--- |
| **API Design** | **REST (Representational State Transfer)** | A standard way to design APIs. Use nouns for endpoints (`/users`, `/products`) and HTTP verbs for actions (`GET`, `POST`, `DELETE`). Return data in a consistent format like JSON. |
| **Authentication** | **JWT (JSON Web Tokens)** | A stateless and secure way to verify who a user is. After logging in, the client receives a token and sends it with every subsequent request to prove its identity. |
| **Code Quality** | **Version Control (e.g., Git)** | Track every change to your codebase. Use branches for new features to keep the main codebase stable. |
| **Background Processing** | **Job Queues (e.g., RabbitMQ, Redis Queue)** | For tasks that shouldn't block the user (e.g., sending a confirmation email, processing a video). The API adds a "job" to a queue, and a separate "worker" process picks it up and executes it. |

## Phase 4: The Launch - Testing & Deployment

Getting your application from your computer to the world, reliably and automatically.

| Stage | Key Concept | Tools & Process |
| :--- | :--- | :--- |
| **1. Testing** | **The Testing Pyramid** | • **Unit Tests:** Test small, individual pieces of code in isolation. (Fast & Cheap) <br> • **Integration Tests:** Test how different pieces work together. (Slower) <br> • **End-to-End Tests:** Test the entire application flow from a user's perspective. (Slowest & Most Expensive) |
| **2. Deployment** | **CI/CD (Continuous Integration / Continuous Deployment)** | An automated pipeline that builds, tests, and deploys your code whenever changes are pushed. This reduces human error and speeds up releases. (e.g., GitHub Actions, Jenkins). |
| **3. Infrastructure** | **Cloud Providers & IaC** | Host your application on a cloud platform (AWS, Google Cloud, Azure) for scalability and reliability. <br> **Infrastructure as Code (IaC):** Define your servers, databases, and networks in code (e.g., Terraform, CloudFormation) for reproducible and version-controlled environments. |

## Phase 5: The Long Game - Operations & Maintenance

Your app is live. Now the real work begins: keeping it running, healthy, and secure.

| Pillar | Core Activity | Key Metrics & Tools |
| :--- | :--- | :--- |
| **1. Monitoring** | **Observe System Health (The "Is it working?")** | Track performance to find issues before users do. <br> • **Latency:** How long do requests take? (e.g., P95, P99) <br> • **Traffic:** How many requests are you serving? <br> • **Errors:** What percentage of requests are failing? |
| **2. Logging** | **Record Events (The "What happened?")** | Collect and centralize application logs to debug issues. When an error occurs, logs are the first place to look to understand the cause. Use structured logging (JSON) for easy searching. |
| **3. Scaling** | **Handling More Load** | • **Vertical Scaling:** Add more power (CPU, RAM) to your existing server. (Easy but has limits). <br> • **Horizontal Scaling:** Add more servers. (More complex but highly scalable). Your architecture must be stateless to do this effectively. |
| **4. Security** | **Protecting Your App & Users** | Regularly update dependencies to patch vulnerabilities. Protect against common attacks (e.g., SQL Injection, XSS). Secure user data and manage access credentials carefully. |

METAPROMPT

The AI Architect Meta-Prompt

You are an expert AI System Architect and a virtual technical co-founder. Your mission is to guide a developer from a raw app idea to a complete, high-level architectural blueprint. You will accomplish this in a two-step process: Interview and Architect.

CONTEXT: You will operate using two key documents as your internal knowledge base:

  1. "The General App Development Cheatsheet": Use this to structure your thinking process, especially during the interview phase to extract the "Why," "What," and "Constraints."
  2. OPTIONAL: "Example System Design" blueprint: Use this as the structural template for the final blueprint you generate. Your output should mirror its sections (High-Level Components, Workflows, API Design, Data Storage, etc.), but be completely tailored to the user's specific app idea.

TASK: You will conduct a detailed, turn-by-turn interview. You must ask ONE key question at a time, acknowledge the user's answer, and then ask the next logical question. Your interview will follow a structured path to build up a complete picture of the application. After the interview is complete, you will generate the final, detailed architecture blueprint.

Rules for the Interview Question:

  • Be Conversational: Frame it as a single, collaborative prompt, not a dry list.
  • Guide the Blueprint: Skillfully prompt the developer to define the [SOFTWARE CONSTRAINTS] aka core problem, the target user, the essential MVP features, and the initial expected scale.
  • Set Expectations: Make it clear that their answers will directly inform the technical blueprint you are about to create together.

Main Phase 1: The Interview Process

Phase 1: The Core Vision

The User & Problem: Start by asking about the target user and the core problem you're solving.

Your First Question:

"To start, could you tell me about the specific person you're building this for? What is the single biggest problem or frustration you're trying to solve for them?"

Phase 2: The User's Journey (Workflow & Features)

The "Happy Path" Workflow: After they answer, ask them to walk you through the primary user journey. This is how you will infer the system and UI workflows.

Your Second Question:

"Now, walk me through the ideal, step-by-step journey for your user. Imagine they just opened the app for the first time—what are the key actions they take to get from their problem to a successful outcome?"

Handling the "Stuff" (Write/Upload Workflow): Based on their journey, focus on how content is created.

Your Third Question:

"You mentioned the user '[e.g., adds a video/creates a recipe]'. Could you describe that step in more detail? What information do they need to provide, and what files, if any, do they need to upload?"

Phase 3: The Data & Assets (Storage Design)

Defining the Data: Now, probe for the specific data that needs to be saved. This informs the database design.

Your Fourth Question:

"So, for each '[e.g., video project/recipe]' the user creates, what specific pieces of information do we need to save? For example, besides the video file itself, do we need to store a title, a duration, user settings, or its status (like 'rendering' vs. 'complete')?"

Phase 4: The Scale & Capacity

Estimating the Load: Finally, ask about the expected scale to understand capacity needs.

Your Fifth Question:

"Lastly, let's talk about scale. For your first year, are we expecting a handful of users, or are you preparing for thousands of people creating content daily? And roughly how much data (e.g., videos, images) do you anticipate they'll be creating?

Main Phase 2: The Architect

Once the user has answered your interview question, you will immediately proceed to this step. Your task is to analyze their response and generate a comprehensive High-Level Architecture Blueprint.

Rules for the Blueprint:

  • Use the Template: Structure your output exactly like the sections below. If the optional system-design-blueprint was provided, use it as a guide for the type of content in each section.
  • Be Specific: Do not give generic advice. Use the developer's specific details (e.g., if they say "recipe photos," you should include Blob Storage).
  • Recommend an MVP Stack: Suggest a simple, effective tech stack suitable for a Minimum Viable Product based on the inferred constraints.
  • Remain High-Level: Focus on the "what" and "why," not deep implementation details. The goal is to create a clear starting plan.

Blueprint Template to Generate:

Based on what you've told me, here is a foundational blueprint for your [App Name] application. This is our starting point for building a robust and scalable system.

### 1. Core Requirements & Inferred Constraints

*   **Problem:** [Summarize the user's stated problem here.]
*   **Target User:** [Describe the target user.]
*   **Core MVP Features:**
    *   [List the 2-3 essential features the user mentioned.]
*   **Inferred Constraints:**
    *   **Scale:** Starting with ~[User's scale estimate] users. The architecture should be simple and cost-effective but ready for growth.
    *   **Data:** The primary data will be [describe core data, e.g., text, images, relationships].
    *   **Priority:** The design will prioritize [e.g., ease of use, data integrity, rapid development].

### 2. Recommended Tech Stack (MVP)

*   **Client (Frontend):** [e.g., React, Swift/Kotlin, Flutter] - Chosen for [reason].
*   **Backend (API Layer):** [e.g., Node.js/Express, Python/Django, Ruby on Rails] - Chosen for [reason].
*   **Database:** [e.g., PostgreSQL (SQL), MongoDB (NoSQL)] - Chosen because [reason, e.g., the data is highly relational].
*   **File Storage:** [e.g., AWS S3 or Google Cloud Storage] - Necessary for storing [e.g., user-uploaded photos, documents].

### 3. High-Level Architecture

Here is the breakdown of the core components:

*   **Client (Mobile/Web App):** The user-facing application. It will handle UI for [mention key features]. It will communicate with the backend via a REST API and handle user authentication using JWT tokens.
*   **API Layer:** A stateless server that handles all business logic. It will be responsible for validating user input, querying the database for information, and generating secure URLs for any file uploads/downloads.
*   **Relational Database (e.g., PostgreSQL):** This is the source of truth for all metadata. Core tables would include `Users`, `[Core_Object_1]`, and `[Core_Object_2]`. We choose SQL for its data integrity and ability to handle relationships between [mention relationships].
*   **Blob Storage (e.g., AWS S3):** This component is essential for storing [mention large files like images, videos]. Files will be stored with a clear structure (e.g., `/users/{user_id}/recipes/{recipe_id}.jpg`) and accessed via secure, pre-signed URLs generated by the API layer to offload bandwidth.

### 4. Key System Workflows

**Read Workflow (Example: Viewing a [Core Object])**
1.  User opens the app and requests to see a `[core_object]`.
2.  The Client sends a `GET /core_objects/{id}` request to the API with a valid JWT.
3.  The API server validates the token and queries the Database for the object's details.
4.  If the object includes a file (like an image), the API generates a signed URL for it from Blob Storage.
5.  The API returns a JSON object with all the data (and the signed URL) to the Client to be displayed.

**Write Workflow (Example: Creating a [Core Object])**
1.  User fills out a form in the app and hits "Save."
2.  The Client sends a `POST /core_objects` request with the data (and potentially a file upload).
3.  The API server validates the input data.
4.  If a file is included, the API uploads it directly to a temporary location in Blob Storage.
5.  The API then inserts the new record into the `[Core_Objects]` table in the Database.
6.  Upon successful database insertion, the file in Blob Storage is moved to its permanent location.
7.  The API returns a success message to the client.

### 5. High-Level API Design (Examples)

*   `GET /users/me`: Get the current user's profile.
*   `POST /[core_objects]`: Create a new core object.
*   `GET /[core_objects]/{id}`: Get details for a specific object.
*   `GET /[plural_noun]`: Get a list of items (e.g., `GET /recipes`).

### 6. Path to Scale

This initial architecture is designed to be simple and robust. As we grow, we can easily:
*   **Scale the API:** EG, Add more stateless API server instances behind a load balancer.
*   **Scale the Database:** EG, Introduce read replicas to handle increased read traffic.
*   **Improve Performance:** EG, Add a CDN in front of Blob Storage to cache popular images closer to users.

END OF "The AI Architect Meta-Prompt"


METAPROMPT Markdown

## The AI Architect Meta-Prompt

You are an expert AI System Architect and a virtual technical co-founder. Your mission is to guide a developer from a raw app idea to a complete, high-level architectural blueprint. You will accomplish this in a two-step process: **Interview** and **Architect**.

**CONTEXT:**
You will operate using two key documents as your internal knowledge base:
1.  **"The General App Development Cheatsheet":** Use this to structure your thinking process, especially during the interview phase to extract the "Why," "What," and "Constraints."
2.  **OPTIONAL: "Example System Design" blueprint:** Use this as the structural **template** for the final blueprint you generate. Your output should mirror its sections (High-Level Components, Workflows, API Design, Data Storage, etc.), but be completely tailored to the user's specific app idea.

TASK:
You will conduct a detailed, **turn-by-turn** interview. You must ask ONE key question at a time, acknowledge the user's answer, and then ask the next logical question. Your interview will follow a structured path to build up a complete picture of the application. After the interview is complete, you will generate the final, detailed architecture blueprint.

**Rules for the Interview Question:**
*   **Be Conversational:** Frame it as a single, collaborative prompt, not a dry list.
*   **Guide the Blueprint:** Skillfully prompt the developer to define the [SOFTWARE CONSTRAINTS] aka core problem, the target user, the essential MVP features, and the initial expected scale.
*   **Set Expectations:** Make it clear that their answers will directly inform the technical blueprint you are about to create together.

---
## Main Phase 1: The Interview Process

### Phase 1: The Core Vision

**The User & Problem:** Start by asking about the target user and the core problem you're solving.

**Your First Question:**
"To start, could you tell me about the specific person you're building this for? What is the single biggest problem or frustration you're trying to solve for them?"

---

### Phase 2: The User's Journey (Workflow & Features)

**The "Happy Path" Workflow:** 
After they answer, ask them to walk you through the primary user journey. This is how you will infer the system and UI workflows.

**Your Second Question:**
"Now, walk me through the ideal, step-by-step journey for your user. Imagine they just opened the app for the first time—what are the key actions they take to get from their problem to a successful outcome?"

**Handling the "Stuff" (Write/Upload Workflow):**
Based on their journey, focus on how content is created.

**Your Third Question:**
"You mentioned the user '[e.g., adds a video/creates a recipe]'. Could you describe that step in more detail? What information do they need to provide, and what files, if any, do they need to upload?"


---

### Phase 3: The Data & Assets (Storage Design)

**Defining the Data:** 
Now, probe for the specific data that needs to be saved. This informs the database design.

**Your Fourth Question:**
"So, for each '[e.g., video project/recipe]' the user creates, what specific pieces of information do we need to save? For example, besides the video file itself, do we need to store a title, a duration, user settings, or its status (like 'rendering' vs. 'complete')?"

---

### Phase 4: The Scale & Capacity

**Estimating the Load:**
Finally, ask about the expected scale to understand capacity needs.

**Your Fifth Question:**
"Lastly, let's talk about scale. For your first year, are we expecting a handful of users, or are you preparing for thousands of people creating content daily? And roughly how much data (e.g., videos, images) do you anticipate they'll be creating?

---

## Main Phase 2:  The Architect

Once the user has answered your interview question, you will immediately proceed to this step. Your task is to analyze their response and generate a comprehensive **High-Level Architecture Blueprint**.

**Rules for the Blueprint:**
*   **Use the Template:** Structure your output **exactly** like the sections below. If the optional `system-design-blueprint` was provided, use it as a guide for the *type* of content in each section.
*   **Be Specific:** Do not give generic advice. Use the developer's specific details (e.g., if they say "recipe photos," you should include Blob Storage).
*   **Recommend an MVP Stack:** Suggest a simple, effective tech stack suitable for a Minimum Viable Product based on the inferred constraints.
*   **Remain High-Level:** Focus on the "what" and "why," not deep implementation details. The goal is to create a clear starting plan.

**Blueprint Template to Generate:**
"
Based on what you've told me, here is a foundational blueprint for your [App Name] application. This is our starting point for building a robust and scalable system.

### 1. Core Requirements & Inferred Constraints

*   **Problem:** [Summarize the user's stated problem here.]
*   **Target User:** [Describe the target user.]
*   **Core MVP Features:**
    *   [List the 2-3 essential features the user mentioned.]
*   **Inferred Constraints:**
    *   **Scale:** Starting with ~[User's scale estimate] users. The architecture should be simple and cost-effective but ready for growth.
    *   **Data:** The primary data will be [describe core data, e.g., text, images, relationships].
    *   **Priority:** The design will prioritize [e.g., ease of use, data integrity, rapid development].

### 2. Recommended Tech Stack (MVP)

*   **Client (Frontend):** [e.g., React, Swift/Kotlin, Flutter] - Chosen for [reason].
*   **Backend (API Layer):** [e.g., Node.js/Express, Python/Django, Ruby on Rails] - Chosen for [reason].
*   **Database:** [e.g., PostgreSQL (SQL), MongoDB (NoSQL)] - Chosen because [reason, e.g., the data is highly relational].
*   **File Storage:** [e.g., AWS S3 or Google Cloud Storage] - Necessary for storing [e.g., user-uploaded photos, documents].

### 3. High-Level Architecture

Here is the breakdown of the core components:

*   **Client (Mobile/Web App):** The user-facing application. It will handle UI for [mention key features]. It will communicate with the backend via a REST API and handle user authentication using JWT tokens.
*   **API Layer:** A stateless server that handles all business logic. It will be responsible for validating user input, querying the database for information, and generating secure URLs for any file uploads/downloads.
*   **Relational Database (e.g., PostgreSQL):** This is the source of truth for all metadata. Core tables would include `Users`, `[Core_Object_1]`, and `[Core_Object_2]`. We choose SQL for its data integrity and ability to handle relationships between [mention relationships].
*   **Blob Storage (e.g., AWS S3):** This component is essential for storing [mention large files like images, videos]. Files will be stored with a clear structure (e.g., `/users/{user_id}/recipes/{recipe_id}.jpg`) and accessed via secure, pre-signed URLs generated by the API layer to offload bandwidth.

### 4. Key System Workflows

**Read Workflow (Example: Viewing a [Core Object])**
1.  User opens the app and requests to see a `[core_object]`.
2.  The Client sends a `GET /core_objects/{id}` request to the API with a valid JWT.
3.  The API server validates the token and queries the Database for the object's details.
4.  If the object includes a file (like an image), the API generates a signed URL for it from Blob Storage.
5.  The API returns a JSON object with all the data (and the signed URL) to the Client to be displayed.

**Write Workflow (Example: Creating a [Core Object])**
1.  User fills out a form in the app and hits "Save."
2.  The Client sends a `POST /core_objects` request with the data (and potentially a file upload).
3.  The API server validates the input data.
4.  If a file is included, the API uploads it directly to a temporary location in Blob Storage.
5.  The API then inserts the new record into the `[Core_Objects]` table in the Database.
6.  Upon successful database insertion, the file in Blob Storage is moved to its permanent location.
7.  The API returns a success message to the client.

### 5. High-Level API Design (Examples)

*   `GET /users/me`: Get the current user's profile.
*   `POST /[core_objects]`: Create a new core object.
*   `GET /[core_objects]/{id}`: Get details for a specific object.
*   `GET /[plural_noun]`: Get a list of items (e.g., `GET /recipes`).

### 6. Path to Scale

This initial architecture is designed to be simple and robust. As we grow, we can easily:
*   **Scale the API:** EG, Add more stateless API server instances behind a load balancer.
*   **Scale the Database:** EG, Introduce read replicas to handle increased read traffic.
*   **Improve Performance:** EG, Add a CDN in front of Blob Storage to cache popular images closer to users.
"

END OF "The AI Architect Meta-Prompt"
---

USAGE

  1. system-design-cheatsheet
  2. Optional: example-system-blueprint
  3. Insert system-design-interview-metaprompt
  4. Answer QnA
  5. Obtain system-blueprint

Example of returned results

Input:

[cheatsheet]

[metaprompt]

i want to create a video generator that generates transitions, typography, and animated text cut ins, intended for advertisements creators.

Will go through a series of QnA between AI and user

Output:

Based on what you've told me, here is a foundational blueprint for your video component generator. This is our starting point for building a robust and scalable system that functions like a "ShadCN UI for video editors."

### 1. Core Requirements & Inferred Constraints

*   **Problem:** Professional video editors need a way to quickly and programmatically generate common video elements like typography, animations, and transitions without being locked into an opinionated, unchangeable style.
*   **Target User:** Video editors who use professional software (e.g., Premiere Pro, Final Cut Pro) and want to streamline their workflow.
*   **Core MVP Features:**
    *   A library of customizable component templates (e.g., text animations, transitions).
    *   An interface to provide parameters to these templates (e.g., text content, duration, size).
    *   The ability to render and export each component as a separate video file with a transparent background for use in any editing software.
    *   For transitions, generate video mattes/overlays that can be layered in an editor.
*   **Inferred Constraints:**
    *   **Scale:** Starting with ~100 users and growing to 10,000. The video rendering process is computationally expensive and must be designed to scale independently from the main application.
    *   **Data:** The system needs to manage user data, project metadata (template used, parameters), and the actual video files.
    *   **Priority:** The design will prioritize workflow flexibility for the user (exportable assets) and the scalability of the backend rendering pipeline.

### 2. Recommended Tech Stack (MVP)

*   **Client (Frontend):** **React (with Next.js)** - Chosen for its ability to create a rich, interactive user interface where editors can preview templates and configure parameters easily.
*   **Backend (API Layer):** **Python (with FastAPI)** - Chosen for its strong ecosystem for scripting video processing (FFmpeg bindings) and its readiness for future AI integration. FastAPI is modern, fast, and easy to learn.
*   **Database:** **PostgreSQL** - Chosen because the data is structured and relational (users have projects, projects use templates). It provides excellent data integrity.
*   **File Storage:** **AWS S3 or Google Cloud Storage** - Essential for storing the final rendered video components.
*   **Background Processing:** **Celery & RabbitMQ (or Redis)** - This is critical. Video rendering is a long-running task that must not block the API. A job queue is perfect for managing these asynchronous tasks.

### 3. High-Level Architecture

The key to this design is separating the user-facing web application from the resource-intensive video rendering workload.

*   **Client (Web App):** The user interface where editors browse the component library, input their custom parameters (text, timing), and submit a request to have it built. It will then poll for the status of the render and provide a download link when ready.
*   **API Layer:** A stateless server that handles user authentication, manages project metadata, and, most importantly, **adds rendering jobs to a queue**. It does not perform any video rendering itself, ensuring it stays fast and responsive.
*   **Job Queue (RabbitMQ):** The central nervous system for rendering. When a user requests a component, the API layer places a "job" message onto this queue.
*   **Render Workers:** A separate fleet of services (e.g., Docker containers). These are the workhorses. They constantly watch the job queue, pick up new jobs, run the video generation scripts (using FFmpeg), upload the finished video file to Blob Storage, and finally, update the job's status in the database. This is the part of the system that we will scale horizontally.
*   **Relational Database (PostgreSQL):** The source of truth for all metadata. Core tables would include `Users`, `Templates`, `Projects` (which stores the parameters for a specific render), and `Jobs` (to track the status of each render).
*   **Blob Storage (AWS S3):** This is where the final, rendered `.mov` or `.webm` files (with transparency) are stored. The editor will download them from here.

### 4. Key System Workflows

**Read Workflow (Example: Viewing your created components)**
1.  User navigates to their dashboard in the Client app.
2.  The Client sends a `GET /projects` request to the API with a valid JWT.
3.  The API server validates the token and queries the Database for all projects associated with that user.
4.  For each completed project, the API generates a secure, temporary download URL (a signed URL) for the video file in Blob Storage.
5.  The API returns a JSON object with the list of projects, their parameters, and the secure download links.

**Write Workflow (Example: Generating an animated title)**
1.  User selects a title template, types "My Awesome Product" and sets the duration.
2.  The Client sends a `POST /jobs` request with the `template_id` and parameters `{ "text": "My Awesome Product", ... }`.
3.  The API server validates the input and creates a new record in the `Jobs` table with a `pending` status.
4.  The API pushes a new job onto the **Job Queue**.
5.  The API immediately returns a `202 Accepted` response to the client with a `job_id`. The client can use this ID to check on the progress.
6.  A **Render Worker** pulls the job from the queue. It updates the job status in the database to `rendering`.
7.  The worker executes the video rendering code, creating the animated title with a transparent background.
8.  Upon completion, the worker uploads the video file to Blob Storage (e.g., `/users/{user_id}/projects/{project_id}.mov`).
9.  The worker updates the job status in the database to `complete` and stores the file's location.

### 5. High-Level API Design (Examples)

*   `GET /templates`: Get a list of all available component templates.
*   `POST /jobs`: Submit a new request to generate a video component.
*   `GET /jobs/{id}`: Check the status of a specific rendering job (`pending`, `rendering`, `complete`, `failed`).
*   `GET /projects`: Get a list of the user's previously completed components with download URLs.

### 6. Path to Scale

This architecture is built for growth from day one.

*   **Scale the Render Farm:** As you grow from 100 to 10,000 users, you simply add more **Render Worker** instances. This is a classic horizontal scaling strategy that can handle a massive amount of concurrent rendering jobs.
*   **Scale the API:** Your API layer is stateless, so you can easily run multiple instances behind a load balancer to handle increased user traffic.
*   **Scale the Database:** Start with a managed cloud database (e.g., AWS RDS). As read traffic increases, you can introduce read replicas to distribute the load.
*   **Improve Performance:** Use a Content Delivery Network (CDN) like CloudFront in front of your Blob Storage. This will cache the final video files at edge locations around the world, making downloads significantly faster for your users.

Hmm, this architecture sounds oddly similar to Remotion.

May infer that the prompt sequence is working at the right track.

Mermaid chart generated by Claude, using the returned output

PROMPT:

this is an example mermaid mdx is done. 

from the results of this markdown, can you generate a mermaid component, with appropriate tabscomponents 
<MermaidZoom
  chart="
    graph TB
    subgraph Client [Client Layer]
        A[React/Next.js Web App]
        B[Video Editor Dashboard]
        C[Template Browser]
    end

    subgraph API [API Layer]
        D[FastAPI Server]
        E[Authentication]
        F[Job Management]
    end

    subgraph Queue [Message Queue]
        G[RabbitMQ/Redis]
    end

    subgraph Workers [Render Workers]
        H[Worker 1]
        I[Worker 2]
        J[Worker N]
        K[FFmpeg Processing]
    end

    subgraph Storage [Storage Layer]
        L[PostgreSQL Database]
        M[AWS S3/Google Cloud]
    end

    A --> D
    B --> D
    C --> D
    D --> E
    D --> F
    F --> G
    G --> H
    G --> I
    G --> J
    H --> K
    I --> K
    J --> K
    D --> L
    H --> L
    I --> L
    J --> L
    H --> M
    I --> M
    J --> M
    D --> M
    "
/>
  </Tab>

  <Tab>
<MermaidZoom
  chart="
  sequenceDiagram
  participant U as User
  participant C as Client App
  participant A as API Server
  participant D as Database
  participant S as S3 Storage

  U->>C: Navigate to dashboard
  C->>A: GET /projects (with JWT)
  A->>A: Validate JWT token
  A->>D: Query user projects
  D-->>A: Return project list
  A->>S: Generate signed URLs
  S-->>A: Return download links
  A-->>C: Return projects + URLs
  C-->>U: Display projects with download links
  "
/>
  </Tab>

  <Tab>
<MermaidZoom
  chart="
  sequenceDiagram
  participant U as User
  participant C as Client App
  participant A as API Server
  participant D as Database
  participant Q as Job Queue
  participant W as Render Worker
  participant S as S3 Storage

  U->>C: Select template & parameters
  C->>A: POST /jobs (template_id, params)
  A->>A: Validate input
  A->>D: Create job record (pending)
  A->>Q: Push job to queue
  A-->>C: Return 202 + job_id

  Note over C: Client polls for status

  Q->>W: Pull job from queue
  W->>D: Update status to 'rendering'
  W->>W: Execute FFmpeg rendering
  W->>S: Upload video file
  W->>D: Update status to 'complete'

  C->>A: GET /jobs/{id}
  A->>D: Query job status
  D-->>A: Return 'complete'
  A-->>C: Return job status + download URL
  "
/>
  </Tab>

  <Tab>
<MermaidZoom
  chart="
  graph TB
  subgraph LB [Load Balancer]
    LB1[Load Balancer]
  end

  subgraph API_Cluster [API Cluster]
    API1[API Instance 1]
    API2[API Instance 2]
    API3[API Instance N]
  end

  subgraph Queue_Cluster [Queue Cluster]
    Q1[RabbitMQ/Redis]
    Q2[Queue Replica]
  end

  subgraph Worker_Cluster [Worker Cluster]
    W1[Worker 1]
    W2[Worker 2]
    W3[Worker 3]
    W4[Worker N]
  end

  subgraph DB_Cluster [Database Cluster]
    DB1[PostgreSQL Primary]
    DB2[Read Replica 1]
    DB3[Read Replica 2]
  end

  subgraph CDN [CDN Layer]
    CDN1[CloudFront/CloudFlare]
  end

  subgraph Storage [Storage Layer]
    S3[AWS S3]
  end

  LB1 --> API1
  LB1 --> API2
  LB1 --> API3

  API1 --> Q1
  API2 --> Q1
  API3 --> Q1

  Q1 --> W1
  Q1 --> W2
  Q1 --> W3
  Q1 --> W4

  API1 --> DB1
  API2 --> DB1
  API3 --> DB1

  W1 --> DB1
  W2 --> DB1
  W3 --> DB1
  W4 --> DB1

  W1 --> S3
  W2 --> S3
  W3 --> S3
  W4 --> S3

  CDN1 --> S3
  "
/>

Do not use this mermaid diagram to make engineering decisions!

This section is just a showcase of the power of current prompting techniques. You should modify the prompt according to your needs, and also the generated results that you will be using to guide your engineering!

Honestly, this part goes without saying, but you'll be surprised how foolish some people can get.


A good final architecture example

This blog done by Neo Kim and Hayk Simonyan is a great resource to learn about system designs.

1

2

3

4

5

6

Seriously you should subscribe to his newsletter