Project living live can be accessed by visiting kalbynas.lt
Define routes in /src/pages.ts
Write react code in /src/front/ (each route component is suggested to be in its own directory)
Write backend code in /src/back/
Add static content in /src/static/
Various build related things reside in /src/build
bun run build - builds dev (by default) build
bun run build-prod - builds production build (minifies and other stuff)
bun run watch - builds dev build and serves code while actively watching for code changes - not bug free
bun run serve - serves built code from /out/back/server.js
bun run serve-pm2 - serves built code from /out/back/server.js with pm2 (bun install pm2 -g to install it
globally)
Project port to serve can be set with KALBYNAS_PORT, otherwise NODE_PORT or the default (3000) ports will be used
Css Modules are not supported
hence BEM is suggested. Having each react-route in a separate directory is highly
suggested for this reason.
Css Modules are semi-supported now for *.module.scss files, to use them
follow this snippet:
.italic {
font-style: italic;
}//MyComponent.tsx
import React from 'react'
import styles from 'myModule.module.scss'
export default function MyComponent() {
return <div className={styles('italic')}>Hello world!</div>
}Sass generated $uniqueId is required in order for custom css modules implementation to work.
Pm2 is not supported as it's not that friendly with a bun runtime.
Pm2 can be run by bun, so it works now, see package.json for a working example.
This project was originally created using Voldemortas/bun-react-server template, however, later it migrated to Voldemortas/voldemortas-server which is based on the former version of this very project.