Deployment

Deployment strategies vary based on your project setup: full-stack, client-only, or server-only.

New in v1.1.0: Optimized deployment configurations for different project types. Package manager-specific build optimizations included.


Client Deployment (Frontend)

The client is a static site built with Vite that can be deployed to any static hosting service like Vercel, Netlify, or GitHub Pages.

For Full-Stack Projects:

  1. Build the client: `npm run build --workspace client` or `cd client && npm run build`
  2. Deploy the `client/dist` folder to your hosting service.
  3. Set `VITE_API_URL` environment variable to your deployed backend URL.

For Client-Only Projects:

  1. Build the application: `npm run build` (or with your chosen package manager)
  2. Deploy the generated `dist` folder to your hosting service.
  3. No backend configuration needed - it's a standalone React app.

Package Manager Specific Commands:

  • bun: `bun run build` (fastest build)
  • pnpm: `pnpm build` (efficient caching)
  • yarn: `yarn build` (reliable builds)
  • npm: `npm run build` (standard)

Server Deployment (Backend)

The server can be deployed to any service that supports Node.js, such as Heroku, Render, Railway, or a VPS.

For Full-Stack Projects:

  1. Build the server (TypeScript only): `npm run build --workspace server`
  2. Deploy the `server/` directory to your hosting platform.
  3. Ensure your platform runs `npm start` from the server directory.

For Server-Only Projects:

  1. Build the application (TypeScript): `npm run build`
  2. Deploy the entire project directory.
  3. Platform should run `npm start` from project root.

Required Environment Variables:

  • NODE_ENV: Set to `production`
  • PORT: Server port (usually auto-set by platform)
  • MONGODB_URI: Production MongoDB connection string
  • CORS_ORIGIN: Your deployed client URL (full-stack only)
  • RATE_LIMIT_WINDOW_MS: Rate limiting window (optional)
  • RATE_LIMIT_MAX_REQUESTS: Max requests per window (optional)

Package Manager Considerations:

  • bun: Ensure platform supports bun runtime
  • pnpm: Include `pnpm-lock.yaml` and set npm_config_production=false if needed
  • yarn: Include `yarn.lock` for consistent installs
  • npm: Standard deployment, works everywhere

Full-Stack Deployment Strategies

For full-stack projects, you have several deployment options:

Separate Deployment

Deploy client and server independently:

  • Client: Vercel, Netlify, GitHub Pages
  • Server: Heroku, Render, Railway
  • Best for: Different scaling needs

Monorepo Deployment

Deploy entire project to one platform:

  • Platforms: Render, Railway, DigitalOcean
  • Serve client as static files from server
  • Best for: Simpler deployment pipeline