Organising large-scale applications using serverless compose

Hey,

I am working on a large-scale application using serverless and want to separate my current code-base to multiple services for faster deploy times, etc.

What would you recommend to still be able to reference resources from other services?

At this point I have already tried serverless compose which worked great but I would like to have shared code between multiple services and the only way I found so far is the use of webpack.

This is the current folder structure:

- libs/
  - database/
    - mongodb.ts
    - sql.ts
  - user.ts
- services/
  - service-1/
    - [...]
    - webpack.config.js
    - serverless.yml
  - service-2/
    - [...]
    - webpack.config.js
    - serverless.yml
- serverless-compose.yml

The problem with the current structure is the developer experience; packages have to be installed on multiple places; having to use aliases to access shared code, etc.

Is there a better way to share code between services, while still be able to run on locally.

Thank you for your help in advance.