Server side rendering template with ton of features.
It's considered good practice to lock the versions of your environment tools, such as Node.js and pnpm. To do this,
you can specify the required versions in the engines
field in package.json
and configure enforcement using the
.npmrc
file in your project's root.
If needed, you can disable strict version checks by setting engine-strict=false
in .npmrc
.
git clone https://github.com/jquery-dlya-slabih/ssr.git
npm install -g pnpm@latest-10
pnpm install
pnpm run dev
pnpm install
description | command |
---|---|
run dev build with dev server | pnpm dev |
run prod build | pnpm build |
run prod server (prod build needed) | pnpm prod |
run linting | pnpm lint |
run prettier check | pnpm prettier:check |
run prettier write | pnpm prettier:write |
run type checking | pnpm types |
run bundle analyzer | pnpm analyze |
run unit tests | pnpm test |
show unit tests information | pnpm test:ui |
run e2e tests | pnpm e2e |
run e2e tests in ui | pnpm e2e:ui |
show e2e tests information | pnpm e2e:report |
run e2e codegen | pnpm e2e:codegen |
generate assets for pwa | pnpm generate-pwa-assets |
If you're using NGINX or another solution for static file serving and compression, you can remove these lines
from server.ts
and delete the compression dependency from package.json
.
if (isProduction) {
app.use(compression());
app.use(express.static('dist'));
}
You may need to additionally reconfigure the public path. This can be done by setting base
in the vite.config.ts
file.
The same goes for using the vite-plugin-static-copy plugin. It’s better to put the robots.txt
file in the
required section of the site at the CD stage. And remove the logic for copy file in the root from the CI stage.
There is a pre-push
hook in the .githooks
folder. If you want to add another hook, for example pre-commit
, then you need:
pre-commit
in .githooks
folderchmod +x .githooks/pre-commit
pre-push
hookIf you want to delete all hooks:
.githooks
folderprepare
command in package.json
git config --unset core.hooksPath
sudo nano /etc/hosts
127.0.0.1 ssr-local.com
pnpm dev
A DNS reset may be necessary. On macOS, the simplest solution is to restart the system.
For aliasing just add alias in file tsconfig.app.json
.
login | password |
---|---|
avat | avatpass |
emilys | emilyspass |
Cache for all HTML pages. Cache expiration eq 10 min.
brew install redis
redis-server
DISABLE_REDIS_CACHE
in package.json
to false
pnpm dev
commandFor reset all cache use /reset_redis_cache
handler.
To enable https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Server-Timing just use query flag timing=true
.
Example:
To view data, go to chrome devtools, network tab, next select your html-file and choose timing tab.
For generating pwa assets:
public
folder your icon, name of icon must be favicon.svg
pnpm generate-pwa-assets
If you have any problems with canvas on macOS, use command brew install pkg-config cairo pango libpng jpeg giflib librsvg
.
Tailwind CSS v4.0 is designed for and tested on modern browsers, and the core functionality of the framework specifically depends on these browser versions:
For this reason, we need to transpile the code to older browsers. List of supported browsers here.
Alternatively, if you only need to support browsers compatible with Tailwind, you can safely remove Lightning CSS.
Feel free to open an issue or submit PRs.