question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Best scalable project structure

See original GitHub issue

[ ] Regression 
[ ] Bug report
[X] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

I have big e-commerce apps, i planning move previous codebase from express (Typescript) to NestJS.

After reading documentation and try create nestjs project, I’m confused with project structure. In my opinion generated project structure not scalable, it strange when large codebase have project structure like that.

Currently on my backend have Controller, Model, Event, Middleware, Validator, interface, static file server (subdomain), websocket, here my current project structure

- src
  - app
    - controller
    - model
    - middleware
    - validator
    - event
  - config
    - server.ts
    - route.ts
    - database.ts
    - ...
  - routes
    - sub
      - static.ts
    - store.ts
    - product.ts
    - ...
  - lib
  - main.ts

I’m not angular developer so i dont know how to manage project structure like that

How i for best project structure on awesome nestjs framework ?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:17 (4 by maintainers)

github_iconTop GitHub Comments

19reactions
kamilmysliwieccommented, May 22, 2019

I need to create a nestjs apis for my frontend UI and backend (admin dashboard) UI, should I create two projects for that or just one (I prefer just one)?

@wxs77577 you can always use monorepo approach - create 2 projects in 1 repo and share common things between them as libraries/packages

@liebalogh without modules directory. Also, you can group common/core things as separate directories + sometimes interceptors/guards/pipes will be scoped by modules. See the following example:

- src
  - core
  - common
    - middleware
    - interceptors
    - guards
  - user
      - interceptors (scoped interceptors)
    - user.controller.ts
    - user.model.ts
  - store
    - store.controller.ts
    - store.model.ts
2reactions
wxs77577commented, May 22, 2019

That’s right, but it seems thers is no modules folder.

Read more comments on GitHub >

github_iconTop Results From Across the Web

High scalable folder structure in angular applications - Medium
Other tips to build scalable angular applications · Use cache as much as possible · Don't forget to write test · Use linters...
Read more >
How to define a highly scalable folder structure for ... - ITNEXT
The directives , pipes and models folders contains the directives, pipes and models used across the application.
Read more >
Scalable Angular Structure - Adnan Halilovic Blog
Core Module · Auth folder · Guards folder · Handlers folder · Interceptors folder · Services folder.
Read more >
A Scalable Project Structure for Next.js
I'll talk more about that in another article. In this article, I want to show a neat, scalable folder structure for solo-developers or...
Read more >
React Project Structure Best Practices for Scalable Application
React Project Structure Best Practices for Scalable Application · 1. Assets folder. The assets folder contains images and scss folder for styling ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found