Deploying vite apps to dokku

Today I did the classic Todo app as a warmup/practice problem. I used viteto quickly scaffold out a typescript + react app, got to work and had a working app pretty quickly. I try to deploy everything I make because it doesn’t feel real as long as it’s just on my computer. So I wanted to deploy to my dokku instance. Here’s what works:

  • Add the serve node module: yarn add serve
  • In package.json add a key for start that looks like: "start": "serve -s dist"

When dokku does the deploy it’ll figure out that the this is a node app, run build (which compiles the typescript to JS) then run serve which will serve the dist folder. And just like that the app is built and served.

Here’s my todo app for the very curious. It’s 15 minutes of work so it doesn’t have any styling or niceties but it works!