Build a React site
The CLI can create a starter project using React and Tailwind:
sonion new my-appsonion cert --out certssonion dev --root my-app --cert certs/cert.pem --key certs/key.pemsonion dev serves your project on 127.0.0.1:6767. With Bun installed, it also:
- runs
bun installifnode_modulesis missing - rebuilds
src/main.jsxintodist/when files change - rebuilds Tailwind from
src/input.cssintodist/style.css
Without Bun, .jsx and .tsx files are compiled per request, and npm packages like React can not be imported, so install Bun for this template.
The certificate is self-signed, so tick Allow self-signed certs in the browser settings to open sonion://localhost. Turn it back off when you are done.
Going live
Section titled “Going live”sonion dev is for your own machine. To publish, copy your project to your server and serve it with sonion serve, including the built dist/ folder.
sonion serve --root my-app --cert certs/cert.pem --key certs/key.pem