Blog
Project Structure in Umami codebase - Part 1.3

Project Structure in Umami codebase - Part 1.3

Inspired by BulletProof React, I applied its codebase architecture concepts to the Umami codebase.

This article focuses on files and folders structure to understand the project structure and how its organized.

Prerequisites

  1. Project Structure in Umami codebase — Part 1.0

  2. Project Structure in Umami codebase — Part 1.1

  3. Project Structure in Umami codebase — Part 1.2

In this part 1.3, we review the following folders in Umami codebase.

  1. permission.

  2. queries.

  3. store.

permission folder

This folder has the following files

permissions folder is about access control. If you check user.ts, you will see the following symbols.

Similarly, you will see the following symbols in website.ts.

So anything to do with access control, you must add or update the function in the permission folder.

queries folder

queries folder has the following:

Umami uses Prisma. Prisma ORM is an open-source ORM that provides fast, type-safe access to Postgres, MySQL, SQLite, and more databases, and runs smoothly across Node.js, Bun, and Deno.

prisma folder has files and website.ts has all the website related queries.

In the sql folder, you will see the following files:

From the way I see it, I think these sql related are legacy and may be Umami is migrating towards prisma ORM. This is just a guess.

About me:

Hey, my name is Ramu Narasinga. I study codebase architecture in large open-source projects.

Email: ramu.narasinga@gmail.com

I spent 200+ hours analyzing Supabase, shadcn/ui, LobeChat. Found the patterns that separate AI slop from production code. Stop refactoring AI slop. Start with proven patterns. Check out production-grade projects at thinkthroo.com

References:

  1. https://github.com/umami-software/umami/blob/master/src/permissions/user.ts

  2. https://github.com/umami-software/umami/tree/master/src/permissions

  3. https://github.com/umami-software/umami/blob/master/src/permissions/website.ts

  4. https://www.prisma.io/docs/orm/overview/introduction/what-is-prisma