Starter template for a full-stack application using a vite react-ts client and node-ts server with a pnpm workspace monorepo.
Client:
- React 19
- Vite
- TypeScript
- Tailwind CSS
- shadcn/ui
- Vitest & React Testing Library
Server:
- Node.js
- Express.js
- TypeScript
- PostgreSQL
- Prisma
- Winston (for logging)
Monorepo:
- pnpm workspaces
This project is a monorepo managed with pnpm workspaces. It consists of two main packages:
packages/client: A React frontend application built with Vite. It handles the user interface and interacts with the server API.packages/server: A Node.js backend application built with Express. It provides a RESTful API for the client, manages the database with Prisma, and handles business logic.
-
Clone the repository:
git clone <repository-url> cd vite-node-starter
-
Install dependencies:
pnpm install
-
Generate prisma files:
pnpm --filter server prisma:generate
You need to create .env files for both the client and server packages. You can copy the example files and fill in the required values.
Copy packages/client/.env.example to packages/client/.env:
| Variable | Description | Example Value |
|---|---|---|
VITE_ENV |
The environment for the client. | development |
VITE_SENTRY_DSN |
Sentry DSN for error tracking. |
Copy packages/server/.env.example to packages/server/.env:
| Variable | Description | Example Value |
|---|---|---|
ENV |
The environment for the server. | development |
SERVER_PORT |
The port the server will run on. | 8080 |
SERVER_URL |
The base URL of the server. | http://localhost:8080 |
DATABASE_URL |
The connection string for the PostgreSQL DB. | postgresql://user:pass@host:port/db |
MONGODB_URL |
The connection string for MongoDB (for logs). |
Here are some of the most important scripts you can run from the root directory:
| Script | Description |
|---|---|
pnpm dev |
Runs both the client and server in development mode. |
pnpm dev:client |
Runs only the client in development mode. |
pnpm dev:server |
Runs only the server in development mode. |
You can also run package-specific scripts from within their respective directories (e.g., pnpm test:unit inside packages/client).
To run the entire application in development mode with hot-reloading:
pnpm devThe client will be available at http://localhost:5173 and the server at http://localhost:8080.
This project uses GitHub Actions for Continuous Integration. The workflow is defined in .github/workflows/ci.yaml. It runs tests and linting on every push and pull request to the main branch.
.
├── packages
│ ├── client/ # React Frontend
│ └── server/ # Node.js Backend
├── .github/
│ └── workflows/ # CI/CD workflows
├── .husky/ # Git hooks
└── ...