# Seeking Advice on Best Practices for Directory Structure and Architecture in Serverless Framework (TypeScript)

**URL:** <https://forum.serverless.com/t/seeking-advice-on-best-practices-for-directory-structure-and-architecture-in-serverless-framework-typescript/20545>\
**Category:** Serverless Framework\
**Tags:** aws, lambda, api-gateway\
**Created:** [September 16, 2024, 1:07pm UTC](https://forum.serverless.com/t/seeking-advice-on-best-practices-for-directory-structure-and-architecture-in-serverless-framework-typescript/20545 "2024-09-16T13:07:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucas1068](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/lucas1068/32/8063_2.png) [@lucas1068](https://forum.serverless.com/u/lucas1068)\
**Post date:** [September 16, 2024, 1:07pm UTC](https://forum.serverless.com/t/seeking-advice-on-best-practices-for-directory-structure-and-architecture-in-serverless-framework-typescript/20545/1 "2024-09-16T13:07:19Z")

</div>

Hi everyone,

I’m currently working on a **serverless project using the Serverless Framework** with **TypeScript** , and I’m looking for advice and best practices on how to organize the project’s structure and architecture.  
Here are some key points about the project:

### Project Overview

- **Serverless Framework** : I plan to deploy all my infrastructure as code.
- **TypeScript** : I’m using TypeScript for type safety and code structure.
- **Prisma ORM** : I’ll be using Prisma to interact with a centralized database, as all parts of the system will share this same database.

### Questions I Need Help With

**1.Services Organization** :

- Should I split my project into **multiple services** (each handling a specific domain of the business logic, e.g., `user-management`, `inventory`, etc.)?
- Or should I keep everything **within a single service** and organize by domains (e.g., `src/modules/<domain>`)?

I’m interested in the **trade-offs** between these two approaches in terms of scalability, maintainability, and overall best practices.

**2.Prisma ORM Centralization** :

- Given that all services or domains will need to interact with the **same database** , is it better to **centralize Prisma** (e.g., as a shared layer), or should I create individual Prisma instances for each domain/module/service?
- What’s the best way to manage Prisma with **Serverless** functions to ensure database connection efficiency and reuse the Prisma client across services if they are separated?

**3.Directory Structure** :

- If I go with a **single service** approach, what would be the most **effective directory structure** for organizing modules/domains?
- If I opt for **multiple services** , how should I structure those services to maintain code reuse, especially for common utilities like Prisma, middlewares, and error handling?

### Current Setup

- I’m considering **centralizing Prisma** since all parts of the system will interact with the same database.
- I’ve started building the system with multiple modules (domains), but they’re all within one service for now.

Any advice on how to structure the project for **clean separation of concerns** , **scalability** , and **ease of maintenance** would be greatly appreciated! If you’ve worked on similar setups or have any **best practices** to share for a TypeScript and Prisma-based serverless app, I’d love to hear your thoughts.

Thank you in advance for your help!

---

<div class="post-metadata">

**Author:** ![TomC](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/tomc/32/4002_2.png) [@TomC](https://forum.serverless.com/u/TomC)\
**Post date:** [September 17, 2024, 2:34pm UTC](https://forum.serverless.com/t/seeking-advice-on-best-practices-for-directory-structure-and-architecture-in-serverless-framework-typescript/20545/2 "2024-09-17T14:34:01Z")

</div>

Wow. That’s a lot of stuff to cover. I won’t attempt to.

But I do wonder if you’ve read the (free) “Modernize with event-driven architectures” from AWS @ [Building Event-driven Architectures on AWS](https://pages.awscloud.com/global-ln-gc-300-build-eda-ent-guide-learn) ?

---

<div class="post-metadata">

**Author:** ![beenmeckel](https://avatars.discourse-cdn.com/v4/letter/b/8dc957/32.png) [@beenmeckel](https://forum.serverless.com/u/beenmeckel)\
**Post date:** [February 13, 2026, 1:54pm UTC](https://forum.serverless.com/t/seeking-advice-on-best-practices-for-directory-structure-and-architecture-in-serverless-framework-typescript/20545/3 "2026-02-13T13:54:42Z")

</div>

where is it ?

[192.168.100.1](https://1921681001.id/) [192.168.1.1](https://19216811.cam/)
