Hello. Just joined. In the process of initiation v...
# seed
t
Hello. Just joined. In the process of initiation via your serverless-stack resource. Really super impressed by your product and your approach to education. Just wondering if anyone has tips for my specific scenario. I'm trying to deploy 1 backend service (ts/lambda), 1 frontend (ts/svelte app, built with sst.StaticSite), and hoping to share typescript interfaces (DTOs) between frontend and backend (in the absence of client generation via openapi specs, which I don't want to manually maintain). Deploying backend and frontend on Seed only, not using Netlify for frontend. So far, I can build each by themselves, but am getting a bit stuck tying it all together. Is there a way to do it without Lerna/workspaces? Docs seem to be using serverless.yml, is there a way to do it all with plain sst and typescript? Cheers!
f
Hey @Timothy Farland, is your backend service using SST or serverless framework?
t
sst
f
I see. Are the backend service and the frontend service two different SST apps? Or two stacks in the same app?
t
two different sst apps. the frontend service only exists to deploy the svelte app via StaticSite
so it's not really a service. rather, an sst setup
f
I see. Are both apps in the same repo?
t
Yep
f
Thanks @Timothy Farland. I think I have a good understand of the structure. Back to the original question, do you have a link to the doc where you saw sharing DTOs in serverless.yml?
t
That was in https://serverless-stack.com/chapters/using-lerna-and-yarn-workspaces-with-serverless.html , didn't mention dtos specifically but I guess they could be in a shared package.
f
Ah yup. I’m not too familiar with DTOs, but lemme throw something out there first. Say ur structure looks like this:
Copy code
/
  backend-sst/
  frontend-sst/
  shared/
    dto.js
Can you do
import dto from "../../shared/dto"
in both ur backend and frontend?
t
Yep it doesn't get picked up at deploy time though. Maybe I need to put a bit of work into a build script and tsconfigs. I see it's using
Copy code
cd /tmp/seed/source
during deploy, is it perhaps copying the folder for the service (where sst.json lives) and that alone?
f
The entire repo is checked out there.
Does the import work on ur local machine?