Dune Dune Hakusho
Dune Dune Hakusho
TTCTheo's Typesafe Cult
Created by Dune Dune Hakusho on 6/18/2024 in #questions
How to get hotloading to work with t3 + sst?
built project using create-t3-app. did some small extra stuff (pointing prisma to supabase db, changed discord auth to google auth) installed sst so i didn't need to run it from npx package.json:
"sst": "^2.43.1",
"aws-cdk-lib": "2.142.1",
"constructs": "10.3.0"
"sst": "^2.43.1",
"aws-cdk-lib": "2.142.1",
"constructs": "10.3.0"
sst.config.ts
import { SSTConfig } from "sst";
import { NextjsSite } from "sst/constructs";

export default {
config(_input) {
return {
name: "next-js-typescript-example-sst",
region: "us-east-2",
};
},
stacks(app) {
app.stack(function Site({ stack }) {
const site = new NextjsSite(stack, "site");

stack.addOutputs({
SiteUrl: site.url,
});
});
},
} satisfies SSTConfig;
import { SSTConfig } from "sst";
import { NextjsSite } from "sst/constructs";

export default {
config(_input) {
return {
name: "next-js-typescript-example-sst",
region: "us-east-2",
};
},
stacks(app) {
app.stack(function Site({ stack }) {
const site = new NextjsSite(stack, "site");

stack.addOutputs({
SiteUrl: site.url,
});
});
},
} satisfies SSTConfig;
package.json scripts
"backend:dev": "sst dev",
"frontend:dev": "sst bind next dev",
"backend:dev": "sst dev",
"frontend:dev": "sst bind next dev",
When I go to run the app I run (from the main folder) "npm run backend:dev", and afterwords "npm run frontend:dev" in another terminal. (I'm not sure if these naming conventions for the scripts are really correct, since in the "backend" terminal it shows publishing the Site and the "frontend" terminal it shows the prisma:query which i would also expect to be on a backend but you know.) biggest problem though is that it doesn't hotreload on any changes, i have to ctrl+c to exit and run them again to see my changes. Anything obvious I'm doing wrong here?
3 replies