[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"blog-one-database-many-branches-row-scope":3,"blog-nav-one-database-many-branches-row-scope":27},{"slug":4,"title":5,"description":6,"body":7,"category":8,"readTime":9,"tags":10,"coverImage":14,"coverImageAlt":15,"heroImage":16,"heroImageAlt":15,"metaTitle":17,"metaDescription":18,"ogImage":19,"noindex":20,"published":21,"publishAt":22,"sortOrder":23,"updatedAt":22,"status":24,"path":25,"bodyHtml":26},"one-database-many-branches-row-scope","One database, many branches: scope rows, do not split the system","A second site is a branch column, not a second app. Stock and schedules stay scoped. Queries, exports, and jobs must all carry that scope.","A second shop, warehouse, or venue is not a second application. It is a column the queries must not forget.\n\n[How we build scalable web applications](\u002Fblog\u002Fhow-we-build-scalable-web-applications) says you can open another branch on a shared permissions model. It does not say which tables are shared. This article does.\n\nIt is still one deployable. [A modular monolith](\u002Fblog\u002Fmodular-monolith-vs-microservices) is that decision. You also do not “integrate” your own branches through a no-code tool when both sites are rows in your database. [Composable integrations](\u002Fblog\u002Fcomposable-software-integrations-2026-philippines) is for systems you do not own.\n\n## Shared versus scoped\n\n| Usually shared | Usually branch-scoped |\n|----------------|------------------------|\n| A customer who really visits more than one site | Stock on hand |\n| Staff identity, plus the branches that person may open | Schedules, courts, rooms |\n| A catalog SKU that is the same item everywhere | Drawers, daily totals, prices that differ by site |\n\nIf a customer must never appear at the other branch, that customer is not shared. Write the rule down before the migration. A branch dropdown on the form is not the control. The query is the control.\n\nEvery read of branch data includes the branch, including exports and admin search. Background jobs too. A nightly report that forgets the branch is how one site sees another site’s stock. The same mistake in a queued job is worse, because nobody is looking at the screen when it runs.\n\n## What we will not build\n\n- A copy of the database per branch, merged by spreadsheet on Fridays.\n- A service per branch.\n- A platform for other companies. This design is one operator and many sites. Selling the system to other operators is a different boundary, and we would scope it before calling it the same feature.\n\nPermissions still matter: a person at branch A does not get branch B because the row exists. The role check and the branch check are both required. Neither replaces the other.\n\n## Straight next step\n\n[Send the list of records that must never show up at the other branch](\u002Fcontact). We will mark shared tables and scoped tables before anyone adds a dropdown.","Engineering",7,[11,12,13],"Architecture","Database","Branches","\u002Fimages\u002Fjournal\u002Fone-database-many-branches-row-scope-cover.webp?v=20261013b","Open sign hanging in a shop window","\u002Fimages\u002Fjournal\u002Fone-database-many-branches-row-scope-hero.webp?v=20261013b","One Database, Many Branches | PrimeCode","How a business system scopes stock and schedules to a branch without cloning the database or standing up microservices.","\u002Fimages\u002Fjournal\u002Fone-database-many-branches-row-scope-og.webp?v=20261013b",false,true,"2026-10-26T01:00:00.000Z",56,"live","\u002Fblog\u002Fone-database-many-branches-row-scope","\u003Cp>A second shop, warehouse, or venue is not a second application. It is a column the queries must not forget.\u003C\u002Fp>\n\u003Cp>\u003Ca href=\"\u002Fblog\u002Fhow-we-build-scalable-web-applications\" rel=\"noopener noreferrer\">How we build scalable web applications\u003C\u002Fa> says you can open another branch on a shared permissions model. It does not say which tables are shared. This article does.\u003C\u002Fp>\n\u003Cp>It is still one deployable. \u003Ca href=\"\u002Fblog\u002Fmodular-monolith-vs-microservices\" rel=\"noopener noreferrer\">A modular monolith\u003C\u002Fa> is that decision. You also do not “integrate” your own branches through a no-code tool when both sites are rows in your database. \u003Ca href=\"\u002Fblog\u002Fcomposable-software-integrations-2026-philippines\" rel=\"noopener noreferrer\">Composable integrations\u003C\u002Fa> is for systems you do not own.\u003C\u002Fp>\n\u003Ch2>Shared versus scoped\u003C\u002Fh2>\n\u003Ctable>\n\u003Cthead>\n\u003Ctr>\n\u003Cth>Usually shared\u003C\u002Fth>\n\u003Cth>Usually branch-scoped\u003C\u002Fth>\n\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\u003Ctr>\n\u003Ctd>A customer who really visits more than one site\u003C\u002Ftd>\n\u003Ctd>Stock on hand\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Staff identity, plus the branches that person may open\u003C\u002Ftd>\n\u003Ctd>Schedules, courts, rooms\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>A catalog SKU that is the same item everywhere\u003C\u002Ftd>\n\u003Ctd>Drawers, daily totals, prices that differ by site\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftbody>\u003C\u002Ftable>\n\u003Cp>If a customer must never appear at the other branch, that customer is not shared. Write the rule down before the migration. A branch dropdown on the form is not the control. The query is the control.\u003C\u002Fp>\n\u003Cp>Every read of branch data includes the branch, including exports and admin search. Background jobs too. A nightly report that forgets the branch is how one site sees another site’s stock. The same mistake in a queued job is worse, because nobody is looking at the screen when it runs.\u003C\u002Fp>\n\u003Ch2>What we will not build\u003C\u002Fh2>\n\u003Cul>\n\u003Cli>A copy of the database per branch, merged by spreadsheet on Fridays.\u003C\u002Fli>\n\u003Cli>A service per branch.\u003C\u002Fli>\n\u003Cli>A platform for other companies. This design is one operator and many sites. Selling the system to other operators is a different boundary, and we would scope it before calling it the same feature.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>Permissions still matter: a person at branch A does not get branch B because the row exists. The role check and the branch check are both required. Neither replaces the other.\u003C\u002Fp>\n\u003Ch2>Straight next step\u003C\u002Fh2>\n\u003Cp>\u003Ca href=\"\u002Fcontact\" rel=\"noopener noreferrer\">Send the list of records that must never show up at the other branch\u003C\u002Fa>. We will mark shared tables and scoped tables before anyone adds a dropdown.\u003C\u002Fp>\n",{"prev":28,"related":46},{"slug":29,"title":30,"description":31,"category":8,"readTime":32,"tags":33,"coverImage":37,"coverImageAlt":38,"heroImage":39,"heroImageAlt":38,"metaTitle":40,"metaDescription":41,"ogImage":42,"noindex":20,"published":21,"publishAt":43,"sortOrder":44,"updatedAt":43,"status":24,"path":45},"sanctum-cookie-sessions-vs-bearer-tokens","Cookie sessions or bearer tokens for a Nuxt and Laravel app","A first-party Nuxt app should use a Sanctum cookie session. Bearer tokens belong to mobile apps and other clients, and they must be revocable.",6,[34,35,36],"Auth","Laravel","Nuxt","\u002Fimages\u002Fjournal\u002Fsanctum-cookie-sessions-vs-bearer-tokens-cover.webp?v=20261013b","Person at a laptop in an office","\u002Fimages\u002Fjournal\u002Fsanctum-cookie-sessions-vs-bearer-tokens-hero.webp?v=20261013b","Cookie Sessions vs Bearer Tokens | PrimeCode","When a Nuxt and Laravel app should use Sanctum cookie sessions, and when a bearer token is the right client.","\u002Fimages\u002Fjournal\u002Fsanctum-cookie-sessions-vs-bearer-tokens-og.webp?v=20261013b","2026-10-23T01:00:00.000Z",55,"\u002Fblog\u002Fsanctum-cookie-sessions-vs-bearer-tokens",[47,49,65],{"slug":29,"title":30,"description":31,"category":8,"readTime":32,"tags":48,"coverImage":37,"coverImageAlt":38,"heroImage":39,"heroImageAlt":38,"metaTitle":40,"metaDescription":41,"ogImage":42,"noindex":20,"published":21,"publishAt":43,"sortOrder":44,"updatedAt":43,"status":24,"path":45},[34,35,36],{"slug":50,"title":51,"description":52,"category":8,"readTime":9,"tags":53,"coverImage":56,"coverImageAlt":57,"heroImage":58,"heroImageAlt":57,"metaTitle":59,"metaDescription":60,"ogImage":61,"noindex":20,"published":21,"publishAt":62,"sortOrder":63,"updatedAt":62,"status":24,"path":64},"prevent-double-booking-reservation-concurrency","How a reservation system prevents double booking","Two requests can both read a free slot. A unique or exclusion constraint, plus a hold that expires, is what rejects the second insert.",[54,12,55],"Bookings","Concurrency","\u002Fimages\u002Fjournal\u002Fprevent-double-booking-reservation-concurrency-cover.webp?v=20261013b","Open calendar planner with a coffee cup","\u002Fimages\u002Fjournal\u002Fprevent-double-booking-reservation-concurrency-hero.webp?v=20261013b","Preventing Double Bookings in a Reservation System | PrimeCode","Why two simultaneous bookings both see a free slot, and how a constraint and a short hold stop the duplicate.","\u002Fimages\u002Fjournal\u002Fprevent-double-booking-reservation-concurrency-og.webp?v=20261013b","2026-10-21T01:00:00.000Z",54,"\u002Fblog\u002Fprevent-double-booking-reservation-concurrency",{"slug":66,"title":67,"description":68,"category":8,"readTime":32,"tags":69,"coverImage":72,"coverImageAlt":73,"heroImage":74,"heroImageAlt":73,"metaTitle":75,"metaDescription":76,"ogImage":77,"noindex":20,"published":21,"publishAt":78,"sortOrder":79,"updatedAt":78,"status":24,"path":80},"idempotency-keys-webhooks-side-effects","Idempotency keys: one webhook, one side effect","Retries are normal. Store the key with the result and enforce it with a unique constraint so a second delivery cannot create a second row.",[70,71,35],"API","Webhooks","\u002Fimages\u002Fjournal\u002Fidempotency-keys-webhooks-side-effects-cover.webp?v=20261013b","Person writing on a printed form","\u002Fimages\u002Fjournal\u002Fidempotency-keys-webhooks-side-effects-hero.webp?v=20261013b","Idempotency Keys for Webhooks | PrimeCode","How an API stores an idempotency key so a retried webhook updates one record instead of creating a second side effect.","\u002Fimages\u002Fjournal\u002Fidempotency-keys-webhooks-side-effects-og.webp?v=20261013b","2026-10-19T01:00:00.000Z",53,"\u002Fblog\u002Fidempotency-keys-webhooks-side-effects"]