This is a template for a opinionated Preact project with many features already set up.
There are 4 links, each link corresponding to Preact
/React
Full
/Light
Template.
![]() |
![]() |
---|---|
Full | Light |
Note: memo
is not used in React version.
Note 2: It is expected in the future that all Preact versions will be deleted since memoization is handled by React with its compiler.
The Light versions
remove the dependencies with typebox
, mantine
, react-hot-toast
, lucide-react
and react-icons
.
- File base routing (client) (using Easy-React-Router)
- Lazy loading (client) (using Easy-React-Router)
- Structured code (server and client)
- Tests (server and client)
- Code coverage (server and client)
- Documentation (client) (WIP: add of Storybook on client, and see for Server)
- Dependency graph (server and client)
- Linting (server and client)
- API type safety (server and client)
npm install -g bun
npm install -g serve
git clone https://github.com/nicolasventer/Preact-Project-Template
cd Preact-Project-Template
all_init_on_cloned.bat
The script will create a symbolic link between the Shared
folder of the Client
and Server
folders and then install the dependencies.
If you want to install the dependencies manually, you should at least create the symbolic link:
mk_link.bat
If you only require the server, you can run the following:
copy_shared.bat
git clone https://github.com/nicolasventer/Preact-Project-Template.git
cd Preact-Project-Template
./all_init_on_cloned.sh
The script will create a symbolic link between the Shared
folder of the Client
and Server
folders and then install the dependencies.
If you want to install the dependencies manually, you should at least create the symbolic link:
mk_link.sh
If you only require the server, you can run the following:
copy_shared.sh
In the Client folder:
bun run dev
WARNING: Be sure to be exactly in the Client folder, otherwise you will have page not found error.
Access the client at http://localhost:5173
In the Client folder, run:
bun run build
bun run preview
Access the client at http://localhost:4173
In the Client folder, run:
bun run buildProd
bun run previewProd
Access the client at http://localhost:4173/${clientEnv.BASE_URL}/
In the Client folder, run:
bun run buildDeploy
It updates the docs
folder (for example for GitHub pages).
In the Server folder, run:
bun run dev
In the Server folder, run:
bun run start
Check that the server is running at http://localhost:3000/
TODO: see for building the server.
TODO: see for deploying the server.