Index: database/drizzle/config/componentFieldConfig.ts
===================================================================
--- database/drizzle/config/componentFieldConfig.ts	(revision 83fb5e20e4a24449997dabfce4e3017efabd0f4a)
+++ database/drizzle/config/componentFieldConfig.ts	(revision e7f1bfa7ce76200b61fe01419065e5b4c1bc1f96)
@@ -1,2 +1,23 @@
+import {
+    cablesTable, caseMoboFormFactorsTable, casePsFormFactorsTable,
+    caseStorageFormFactorsTable, coolerCPUSocketsTable, coolersTable,
+    CPUTable,
+    GPUTable, memoryCardsTable,
+    memoryTable, motherboardsTable,
+    networkAdaptersTable,
+    networkCardsTable, opticalDrivesTable, pcCasesTable, powerSupplyTable,
+    soundCardsTable, storageTable
+} from "../schema";
+
+export type ComponentConfig<SelectType = any, InsertType = any> = {
+    table: any;
+    multiTables?: {
+        storageFormFactors?: typeof caseStorageFormFactorsTable;
+        psFormFactors?: typeof casePsFormFactorsTable;
+        moboFormFactors?: typeof caseMoboFormFactorsTable;
+        cpuSockets?: typeof coolerCPUSocketsTable;
+    }
+};
+
 export type ComponentType =
     | 'cpu'
@@ -14,4 +35,33 @@
     | 'network_adapter'
     | 'network_card';
+
+export const typeConfigMap: Record<ComponentType, ComponentConfig> = {
+    cpu: { table: CPUTable },
+    gpu: { table: GPUTable },
+    memory: { table: memoryTable },
+    storage: { table: storageTable },
+    power_supply: { table: powerSupplyTable },
+    motherboard: { table: motherboardsTable },
+    case: {
+        table: pcCasesTable,
+        multiTables: {
+            storageFormFactors: caseStorageFormFactorsTable,
+            psFormFactors: casePsFormFactorsTable,
+            moboFormFactors: caseMoboFormFactorsTable,
+        },
+    },
+    cooler: {
+        table: coolersTable,
+        multiTables: {
+            cpuSockets: coolerCPUSocketsTable,
+        },
+    },
+    memory_card: { table: memoryCardsTable },
+    optical_drive: { table: opticalDrivesTable },
+    sound_card: { table: soundCardsTable },
+    cables: { table: cablesTable },
+    network_adapter: { table: networkAdaptersTable },
+    network_card: { table: networkCardsTable },
+};
 
 export const requiredFields: Record<ComponentType, string[]> = {
Index: database/drizzle/queries/builds.ts
===================================================================
--- database/drizzle/queries/builds.ts	(revision 83fb5e20e4a24449997dabfce4e3017efabd0f4a)
+++ database/drizzle/queries/builds.ts	(revision e7f1bfa7ce76200b61fe01419065e5b4c1bc1f96)
@@ -12,5 +12,5 @@
 
 export async function getPendingBuilds(db: Database) {
-    const pendingBuildsList = await db
+    const pendingBuilds = await db
         .select({
             id: buildsTable.id,
@@ -25,9 +25,9 @@
         );
 
-    return pendingBuildsList;
+    return pendingBuilds;
 }
 
 export async function getUserBuilds(db: Database, userId: number) {
-    const userBuildsList = await db
+    const userBuilds = await db
         .select({
             id: buildsTable.id,
@@ -42,5 +42,5 @@
         );
 
-    return userBuildsList;
+    return userBuilds;
 }
 
@@ -65,5 +65,5 @@
 
 export async function getFavoriteBuilds(db: Database, userId: number) {
-    const favoriteBuildsList = await db
+    const favoriteBuilds = await db
         .select({
             id: buildsTable.id,
@@ -82,5 +82,5 @@
         );
 
-    return favoriteBuildsList;
+    return favoriteBuilds;
 }
 
@@ -128,5 +128,5 @@
         }
 
-    const approvedBuildsList = await db
+    const approvedBuilds = await db
         .select({
             id: buildsTable.id,
@@ -159,5 +159,5 @@
         .limit(limit || 100); // 100 placeholder
 
-    return approvedBuildsList;
+    return approvedBuilds;
 }
 
Index: database/drizzle/queries/components.ts
===================================================================
--- database/drizzle/queries/components.ts	(revision 83fb5e20e4a24449997dabfce4e3017efabd0f4a)
+++ database/drizzle/queries/components.ts	(revision e7f1bfa7ce76200b61fe01419065e5b4c1bc1f96)
@@ -12,4 +12,6 @@
 } from "../schema";
 import {and, desc, eq, ilike} from "drizzle-orm";
+import {typeConfigMap, ComponentType} from "../config/componentFieldConfig";
+import {AnyPgColumn} from "drizzle-orm/pg-core";
 export async function getAllComponents(db: Database, limit?: number, componentType?: string, q?: string) {
     let queryConditions = [];
@@ -27,5 +29,5 @@
     }
 
-    const componentsList = await db
+    const components = await db
         .select({
             id: componentsTable.id,
@@ -47,5 +49,5 @@
         .limit(limit || 100); // 100 placeholder
 
-    return componentsList;
+    return components;
 }
 
@@ -61,62 +63,27 @@
     if(!component) return null;
 
-    let details: any = {};
-
-    switch (component.type) {
-        case 'cpu':
-            [details] = await db.select().from(CPUTable).where(eq(CPUTable.componentId, componentId));
-            break;
-        case 'gpu':
-            [details] = await db.select().from(GPUTable).where(eq(GPUTable.componentId, componentId));
-            break;
-        case 'memory':
-            [details] = await db.select().from(memoryTable).where(eq(memoryTable.componentId, componentId));
-            break;
-        case 'power_supply':
-            [details] = await db.select().from(powerSupplyTable).where(eq(powerSupplyTable.componentId, componentId));
-            break;
-        case 'case':
-            [details] = await db.select().from(pcCasesTable).where(eq(pcCasesTable.componentId, componentId));
-            if (details) {
-                details.storageFormFactors = await db.select().from(caseStorageFormFactorsTable).where(eq(caseStorageFormFactorsTable.caseId, componentId));
-                details.psFormFactors = await db.select().from(casePsFormFactorsTable).where(eq(casePsFormFactorsTable.caseId, componentId));
-                details.moboFormFactors = await db.select().from(caseMoboFormFactorsTable).where(eq(caseMoboFormFactorsTable.caseId, componentId));
-            }
-            break;
-        case 'cooler':
-            [details] = await db.select().from(coolersTable).where(eq(coolersTable.componentId, componentId));
-            if (details) {
-                details.cpuSockets = await db.select().from(coolerCPUSocketsTable).where(eq(coolerCPUSocketsTable.coolerId, componentId));
-            }
-            break;
-        case 'motherboard':
-            [details] = await db.select().from(motherboardsTable).where(eq(motherboardsTable.componentId, componentId));
-            break;
-        case 'storage':
-            [details] = await db.select().from(storageTable).where(eq(storageTable.componentId, componentId));
-            break;
-        case 'memory_card':
-            [details] = await db.select().from(memoryCardsTable).where(eq(memoryCardsTable.componentId, componentId));
-            break;
-        case 'optical_drive':
-            [details] = await db.select().from(opticalDrivesTable).where(eq(opticalDrivesTable.componentId, componentId));
-            break;
-        case 'sound_card':
-            [details] = await db.select().from(soundCardsTable).where(eq(soundCardsTable.componentId, componentId));
-            break;
-        case 'cables':
-            [details] = await db.select().from(cablesTable).where(eq(cablesTable.componentId, componentId));
-            break;
-        case 'network_adapter':
-            [details] = await db.select().from(networkAdaptersTable).where(eq(networkAdaptersTable.componentId, componentId));
-            break;
-        case 'network_card':
-            [details] = await db.select().from(networkCardsTable).where(eq(networkCardsTable.componentId, componentId));
-            break;
+    const config = typeConfigMap[component.type as ComponentType];
+
+    const [details] = await db
+        .select()
+        .from(config.table)
+        .where(
+            eq(config.table.componentId, componentId)
+        )
+        .limit(1);
+
+    if (component.type === 'case') {
+        details.storageFormFactors = await db.select().from(caseStorageFormFactorsTable).where(eq(caseStorageFormFactorsTable.caseId, componentId));
+        details.psFormFactors = await db.select().from(casePsFormFactorsTable).where(eq(casePsFormFactorsTable.caseId, componentId));
+        details.moboFormFactors = await db.select().from(caseMoboFormFactorsTable).where(eq(caseMoboFormFactorsTable.caseId, componentId));
+    }
+
+    if (component.type === 'cooler') {
+        details.cpuSockets = await db.select().from(coolerCPUSocketsTable).where(eq(coolerCPUSocketsTable.coolerId, componentId));
     }
 
     return {
         ...component,
-        details: details || null
+        details: details
     };
 }
@@ -139,182 +106,45 @@
         const componentId = newComponent.id;
 
-        switch (type) {
-            case 'cpu':
-                await tx.insert(CPUTable).values({
-                    componentId,
-                    socket: specificData.socket,
-                    cores: specificData.cores,
-                    threads: specificData.threads,
-                    baseClock: specificData.baseClock,
-                    boostClock: specificData.boostClock,
-                    tdp: specificData.tdp,
-                });
-                break;
-
-            case 'gpu':
-                await tx.insert(GPUTable).values({
-                    componentId,
-                    vram: specificData.vram,
-                    tdp: specificData.tdp,
-                    baseClock: specificData.baseClock,
-                    boostClock: specificData.boostClock,
-                    chipset: specificData.chipset,
-                    length: specificData.length,
-                });
-                break;
-
-            case 'memory':
-                await tx.insert(memoryTable).values({
-                    componentId,
-                    type: specificData.type,
-                    speed: specificData.speed,
-                    capacity: specificData.capacity,
-                    modules: specificData.modules,
-                });
-                break;
-
-            case 'power_supply':
-                await tx.insert(powerSupplyTable).values({
-                    componentId,
-                    type: specificData.type,
-                    wattage: specificData.wattage,
-                    formFactor: specificData.formFactor,
-                });
-                break;
-
-            case 'case':
-                await tx.insert(pcCasesTable).values({
-                    componentId,
-                    coolerMaxHeight: specificData.coolerMaxHeight,
-                    gpuMaxLength: specificData.gpuMaxLength,
-                });
-
-                if (specificData.storageFormFactors) {
-                    await tx.insert(caseStorageFormFactorsTable).values(
-                        specificData.storageFormFactors.map((sf: any) => ({
-                            caseId: componentId,
-                            formFactor: sf.formFactor,
-                            numSlots: sf.numSlots,
-                        }))
-                    );
-                }
-
-                if (specificData.psFormFactors) {
-                    await tx.insert(casePsFormFactorsTable).values(
-                        specificData.psFormFactors.map((pf: any) => ({
-                            caseId: componentId,
-                            formFactor: pf.formFactor,
-                        }))
-                    );
-                }
-
-                if (specificData.moboFormFactors) {
-                    await tx.insert(caseMoboFormFactorsTable).values(
-                        specificData.moboFormFactors.map((mf: any) => ({
-                            caseId: componentId,
-                            formFactor: mf.formFactor,
-                        }))
-                    );
-                }
-                break;
-
-            case 'cooler':
-                await tx.insert(coolersTable).values({
-                    componentId,
-                    type: specificData.type,
-                    height: specificData.height,
-                    maxTdpSupported: specificData.maxTdpSupported,
-                });
-
-                if (specificData.cpuSockets) {
-                    await tx.insert(coolerCPUSocketsTable).values(
-                        specificData.cpuSockets.map((socket: string) => ({
-                            coolerId: componentId,
-                            socket: socket,
-                        }))
-                    );
-                }
-                break;
-
-            case 'motherboard':
-                await tx.insert(motherboardsTable).values({
-                    componentId,
-                    socket: specificData.socket,
-                    chipset: specificData.chipset,
-                    formFactor: specificData.formFactor,
-                    ramType: specificData.ramType,
-                    numRamSlots: specificData.numRamSlots,
-                    maxRamCapacity: specificData.maxRamCapacity,
-                    pciExpressSlots: specificData.pciExpressSlots,
-                });
-                break;
-
-            case 'storage':
-                await tx.insert(storageTable).values({
-                    componentId,
-                    type: specificData.type,
-                    capacity: specificData.capacity,
-                    formFactor: specificData.formFactor,
-                });
-                break;
-
-            case 'memory_card':
-                await tx.insert(memoryCardsTable).values({
-                    componentId,
-                    numSlots: specificData.numSlots,
-                    interface: specificData.interface,
-                });
-                break;
-
-            case 'optical_drive':
-                await tx.insert(opticalDrivesTable).values({
-                    componentId,
-                    formFactor: specificData.formFactor,
-                    type: specificData.type,
-                    interface: specificData.interface,
-                    writeSpeed: specificData.writeSpeed,
-                    readSpeed: specificData.readSpeed,
-                });
-                break;
-
-            case 'sound_card':
-                await tx.insert(soundCardsTable).values({
-                    componentId,
-                    sampleRate: specificData.sampleRate,
-                    bitDepth: specificData.bitDepth,
-                    chipset: specificData.chipset,
-                    interface: specificData.interface,
-                    channel: specificData.channel,
-                });
-                break;
-
-            case 'cables':
-                await tx.insert(cablesTable).values({
-                    componentId,
-                    lengthCm: specificData.lengthCm,
-                    type: specificData.type,
-                });
-                break;
-
-            case 'network_adapter':
-                await tx.insert(networkAdaptersTable).values({
-                    componentId,
-                    wifiVersion: specificData.wifiVersion,
-                    interface: specificData.interface,
-                    numAntennas: specificData.numAntennas,
-                });
-                break;
-
-            case 'network_card':
-                await tx.insert(networkCardsTable).values({
-                    componentId,
-                    numPorts: specificData.numPorts,
-                    speed: specificData.speed,
-                    interface: specificData.interface,
-                });
-                break;
-
-            default:
-                return null;
+        const config = typeConfigMap[type as ComponentType];
+
+        await tx
+            .insert(config.table)
+            .values({
+                componentId: componentId,
+                ...specificData
+            });
+
+        if (type === 'case') {
+            if (specificData.storageFormFactors) {
+                await tx.insert(caseStorageFormFactorsTable).values(
+                    specificData.storageFormFactors.map((sf: any) => ({
+                        caseId: componentId,
+                        formFactor: sf.formFactor,
+                        numSlots: sf.numSlots,
+                    }))
+                );
+            }
+            if (specificData.psFormFactors) {
+                await tx.insert(casePsFormFactorsTable).values(
+                    specificData.psFormFactors.map((pf: any) => ({
+                        caseId: componentId,
+                        formFactor: pf.formFactor,
+                    }))
+                );
+            }
+            if (specificData.moboFormFactors) {
+                await tx.insert(caseMoboFormFactorsTable).values(
+                    specificData.moboFormFactors.map((mf: any) => ({
+                        caseId: componentId,
+                        formFactor: mf.formFactor,
+                    }))
+                );
+            }
+        }
+
+        if (type === 'cooler' && specificData.cpuSockets) {
+            await tx.insert(coolerCPUSocketsTable).values(
+                specificData.cpuSockets.map((socket: any) => ({ coolerId: componentId, socket }))
+            );
         }
 
@@ -323,22 +153,67 @@
 }
 
-export async function getCompatibleComponents(db: Database, buildId: number, componentType: string) {
-    return db.transaction(async (tx) => {
-        const [build] = await tx
-            .select({
-                buildId: buildsTable.id,
-                userId: buildsTable.userId,
-            })
-            .from(buildsTable)
+export async function getBuildComponents(db: Database, buildId: number) {
+    const [build] = await db
+        .select({
+            buildId: buildsTable.id,
+            userId: buildsTable.userId,
+        })
+        .from(buildsTable)
+        .where(
+            eq(buildsTable.id, buildId)
+        )
+        .limit(1);
+
+    if(!build) return null;
+
+    const components = await db
+        .select({
+            id: componentsTable.id,
+            type: componentsTable.type,
+        })
+        .from(buildComponentsTable)
+        .where(
+            eq(buildComponentsTable.buildId, buildId)
+        )
+        .innerJoin(
+            componentsTable,
+            eq(buildComponentsTable.componentId, componentsTable.id)
+        );
+
+    const componentsDetails = [];
+
+    for (const comp of components) {
+        const config = typeConfigMap[comp.type as ComponentType];
+
+        const [details] = await db
+            .select()
+            .from(config.table)
             .where(
-                eq(buildsTable.id, buildId)
+                eq(config.table.componentId, comp.id)
             )
             .limit(1);
 
-        if(!build) return null;
-
-
+        if (comp.type === 'case') {
+            details.storageFormFactors = await db.select().from(caseStorageFormFactorsTable).where(eq(caseStorageFormFactorsTable.caseId, comp.id));
+            details.psFormFactors = await db.select().from(casePsFormFactorsTable).where(eq(casePsFormFactorsTable.caseId, comp.id));
+            details.moboFormFactors = await db.select().from(caseMoboFormFactorsTable).where(eq(caseMoboFormFactorsTable.caseId, comp.id));
+        }
+
+        if (comp.type === 'cooler') {
+            details.cpuSockets = await db.select().from(coolerCPUSocketsTable).where(eq(coolerCPUSocketsTable.coolerId, comp.id));
+        }
+
+        componentsDetails.push({
+            ...comp,
+            details: details
+        });
+    }
+
+    return componentsDetails;
+}
+
+export async function getCompatibleComponents(db: Database, buildId: number, componentType: string) {
+    // TO BE IMPLEMENTED
     return null;
-    });
 }
 
Index: pages/+Layout.telefunc.ts
===================================================================
--- pages/+Layout.telefunc.ts	(revision 83fb5e20e4a24449997dabfce4e3017efabd0f4a)
+++ pages/+Layout.telefunc.ts	(revision e7f1bfa7ce76200b61fe01419065e5b4c1bc1f96)
@@ -40,6 +40,4 @@
     return approvedBuilds;
 }
-
-// Shared
 
 export async function onGetComponentDetails({ componentId }
Index: pages/forge/forge.telefunc.ts
===================================================================
--- pages/forge/forge.telefunc.ts	(revision 83fb5e20e4a24449997dabfce4e3017efabd0f4a)
+++ pages/forge/forge.telefunc.ts	(revision e7f1bfa7ce76200b61fe01419065e5b4c1bc1f96)
@@ -3,4 +3,5 @@
 import {Abort} from "telefunc";
 import type {Database} from "../../database/drizzle/db";
+import {removeComponentFromBuild} from "../../database/drizzle/queries";
 
 export async function onSaveNewBuild({ name, description, componentIds }
@@ -14,2 +15,60 @@
     return { success: true };
 }
+
+export async function onRemoveComponentFromBuild({ buildId, componentId }
+                                                 : { buildId: number, componentId: number }) {
+    const { c, userId } = requireUser()
+
+    const result = await drizzleQueries.removeComponentFromBuild(c.db, buildId, componentId);
+
+    if(!result) throw Abort();
+
+    return { success: true };
+}
+
+export async function onDeleteBuild({ buildId }: { buildId: number }) {
+    const { c, userId } = requireUser()
+
+    const result = await drizzleQueries.deleteBuild(c.db, userId, buildId);
+    if(!result) throw Abort();
+
+    return { success: true };
+}
+
+export async function onGetBuildComponents({ buildId }
+                                           : { buildId: number }) {
+    const { c, userId } = requireUser()
+
+    if(!Number.isInteger(buildId) || buildId <= 0) throw Abort();
+
+    const buildComponents = await drizzleQueries.getBuildComponents(c.db, buildId);
+
+    if(!buildComponents) throw Abort();
+
+    return buildComponents;
+}
+
+export async function onAddComponentToBuild({ buildId, componentId }: { buildId: number, componentId: number }) {
+    const { c, userId } = requireUser()
+
+    if(!Number.isInteger(buildId) || buildId <= 0) throw Abort();
+    if(!Number.isInteger(componentId) || componentId <= 0) throw Abort();
+
+    const result = await drizzleQueries.addComponentToBuild(c.db, buildId, componentId);
+
+    if(!result) throw Abort();
+
+    return { success: true };
+}
+
+export async function onGetCompatibleComponents({ buildId, componentType }: { buildId: number, componentType: string }) {
+    const { c, userId } = requireUser()
+
+    if(!Number.isInteger(buildId) || buildId <= 0) throw Abort();
+
+    const compatibleComponents = await drizzleQueries.getCompatibleComponents(c.db, buildId, componentType);
+
+    if(!compatibleComponents) throw Abort();
+
+    return compatibleComponents;
+}
