Organizing Serverless Projects

Link to chapter - https://serverless-stack.com/chapters/organizing-serverless-projects.html

Great chapter. I could really use examples of a monorepo.

What are best practices if mulitiple services use the same dynamodo or Cognito setup.

How do you deploy multiple services with the same domain? Example - api.example.com?

I feel a chapter on this would be amazing. People are using monorepos but there are not examples outside of claiming you put severless.yml in different folders.

1 Like

Thats a great point. Thanks for feedback. I’m going to write a couple of chapters on these very shortly. But here is the general idea:

1 Like

Thank you so much @jayair this is a good start. Look forward to seeing the chapters. This guide has been indispensable and one of the best technology books/tutorials I have seen in my long career doing web development.

2 Likes

Thank you! I’m glad you’ve found it helpful!

The package.json (and the node_modules/ dir) are at the root of the repo. However, it is fairly common to have a separate package.json inside each service directory.

I think it would be interesting to expand on that a bit. The example provided is great but does not illustrate how to handle dependencies, and shared code between services which is a fairly common issue

That’s a good point. We’ve gotten a couple of requests for this in past. We’ll be updating this with a more detailed example.

How did you tackle the problem? By deploying every single service on aws, the common node_modules dir is not loaded

If anybody is looking for an example of how to handle your package.json in a monorepo app, we wrote about it here:

I’ll add a link to this in the chapter.