Here are some instructions for self hosting on Render.com:
RedwoodJS is architected as monorepo with two separate sides, an “api side” and a “web side.” The api side is a NodeJS application and the web side is a static SPA (single page app). This works out great when hosting on render.com because hosting a static site is free, and static content is served via super-fast CDN.
So we’re going to setup two sides on Render.com, but first you need to add some things to your RedwoodJS project.
Setup the “api” side.
- Install the
api-server
in your api side.
cd api
yarn add @redwoodjs/api-server
- Create a “health” function:
The health function is used by Render to check if your api side is running correctly.
// ./api/src/functions/healthz.js
export const handler = async () => {
return {
statusCode: 200
}
}
On render.com, create a new "web service"
- Connect to your repository
- Environment is
Node
- Build is
yarn && yarn rw prisma migrate deploy && yarn rw build api
- Start is
cd api && yarn rw-api-server --port 80
- Use a custom domain: “api.raccoon.trade”
On render.com, create a new "static site"
- Build is
yarn && yarn rw build web
- Publish is
./web/dist
- Add rewrite and redirect rules: