A modern full-stack monorepo featuring React with Vite for the frontend and Hono for the backend API, all orchestrated with Turborepo.
cf-stack-sample/
βββ apps/
β βββ api/ # Hono API server
β βββ web/ # React Vite frontend
βββ packages/
βββ ui/ # Shared React components
βββ constants/ # Shared constants
βββ eslint-config/ # ESLint configurations
βββ typescript-config/ # TypeScript configurations
- Node.js 18+
- npm, yarn, pnpm, or bun
# Clone the repository
git clone <repository-url>
cd cf-stack-sample
# Install dependencies
npm install
# or
yarn install
# or
pnpm install# Start all applications in development mode
npm run dev
# or
npx turbo dev
# Start specific application
npx turbo dev --filter=web # React Vite app on :3001
npx turbo dev --filter=api # Hono API on :3000# Build all applications
npx turbo build
# Build specific application
npx turbo build --filter=web
npx turbo build --filter=api- Location:
apps/web/ - Port:
3001 - Tech Stack: React 19, Vite, TypeScript, CSS Modules
- Features:
- β‘ Fast HMR development
- π¨ Modern CSS with modules
- π CORS-enabled API integration
- π± Responsive design
Access: http://localhost:3001
- Location:
apps/api/ - Port:
3000 - Tech Stack: Hono, TypeScript
- Features:
- β‘ Ultra-fast HTTP server
- π‘οΈ Built-in CORS support
- π TypeScript types
- π Hot reload in development
Access: http://localhost:3000
Shared React component library used across applications. Currently includes:
- Reusable UI components
- Shared styles and themes
- Component documentation
Shared constants and configuration used across applications:
- Environment variables
- API endpoints
- Configuration values
Shared ESLint configuration ensuring code consistency:
- React best practices
- TypeScript rules
- Prettier integration
Shared TypeScript configuration:
- Strict type checking
- Path aliases
- Modern TypeScript features
- Edit components in
packages/ui/for shared functionality - Modify
apps/web/src/for frontend changes - Update
apps/api/src/for backend changes
- Full TypeScript support across all packages
- Shared types between frontend and backend
- Automated type checking with
npm run check-types
- ESLint for code linting
- Prettier for code formatting
- Pre-commit hooks for quality assurance
# Build the frontend
cd apps/web
npm run build
# Preview production build
npm run preview# Build the API
cd apps/api
npm run build
# Start production server
npm start- Frontend: Vercel, Netlify, Cloudflare Pages
- Backend: Railway, Render, Fly.io, Cloudflare Workers
- Database: Supabase, PlanetScale, Neon
Create .env files in respective app directories:
# apps/web/.env
VITE_API_URL=https://your-api.com
# apps/api/.env
PORT=3000
CORS_ORIGIN=https://your-frontend.com
@/*points tosrc/in each app@repo/*points to shared packages
# Development
npx turbo dev # Start all apps
npx turbo dev --filter=web # Start web app only
npx turbo dev --filter=api # Start API only
# Building
npx turbo build # Build all apps
npx turbo build --filter=web
npx turbo build --filter=api
# Code Quality
npx turbo lint # Lint all packages
npx turbo check-types # Type check all packages
# Cleaning
npx turbo clean # Clean all build artifacts- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
This project is licensed under the MIT License.
- Turborepo for the amazing monorepo tooling
- React for the frontend framework
- Vite for the blazing fast build tool
- Hono for the ultra-fast web framework
For more information, visit the Turborepo documentation.