Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@ataye/client-server-vite-tailwind) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Simple Vite Client Server Template
Features
- Simple React Nodejs client / server project template
- Client builds into nodejs public folder
- Server deployable to Caprover hosting container
- Separate client and server npm instances to keep server deploy lightweight
Client
- Vite - built for speed
- Set up with Tailwind CSS and Flowbite
- Nextjs style page router
- Proxy configured for node server during development
Server
- Nodejs express server
- Router / controller model
- Passthrough for React front-end router
Project Structure
|-- client
| |-- layout
| | |-- Layout.jsx <== Basic layout component
| `-- src
| |-- pages <== Nextjs style page routing from here
| |-- index.jsx
`-- server
|-- bin
| |-- www <== Starts the express server
|-- routes
`-- controllers
Installation
Using npx, simple run:
$ npx @ataye/client-server-vite-tailwindthen provide the project name and optionally install (runs npm install for client, server and in the project root)
If you want to manually run npm install, you'll need to run it it both client and server folders.
Running the project
After installation, start the project by running
$ npm run appto run both client and server. To run each separately:
$ npm run client
$ npm run serverserver will run codemon to watch for changes.
Deployment
Deployment command builds the client vite project and copies build output to /server/public, then packages the node project into a tarball and calls caprover-deploy to deploy to the caprover server for hosting (Caprover hosting not included ;] )
From the root of the project, run:
$ npm run deployIf you dont want to deploy with caprover, just build the project and it copies into the server public folder. You can then deploy from there:
$ npm run build-client