This project follows the recommended monorepo structure using Turborepo:
mern-turbopack-aio-boilerplate/
├── apps/
│ ├── client/ # React + TypeScript + Vite frontend
│ └── server/ # Express + TypeScript + MongoDB backend
├── packages/
│ ├── types/ # Shared TypeScript type definitions
│ ├── utils/ # Shared utility functions
│ └── ui/ # Shared UI components (future)
├── turbo.json # Turborepo configuration
├── package.json # Root package.json with workspace configuration
└── pnpm-workspace.yaml # pnpm workspace configuration
This Turborepo structure provides several key benefits:
- Code Sharing: Easily share TypeScript types, utility functions, and UI components between client and server
- Atomic Commits: Changes to frontend and backend can be committed in a single transaction
- Simplified Deployment: Build and deploy both applications together with a single command
- Centralized Configuration: ESLint, TypeScript, and other tools configured for the entire repository
- Optimized Builds: Turborepo's intelligent caching and parallel execution for faster builds
- Dependency Management: Shared dependencies managed efficiently across all packages
- Vite - Fast build tool and dev server
- TypeScript - Type-safe JavaScript
- React - UI library
- shadcn-ui - Component library
- Tailwind CSS - Utility-first CSS framework
- React Router - Client-side routing
- Recharts - Data visualization
- Zustand - State management
- React Query - API data fetching
- Axios - HTTP client
- Express - Web framework
- TypeScript - Type-safe JavaScript
- MongoDB - Database
- Mongoose - MongoDB ODM
- Zod - Schema validation
- Axios - HTTP client
- Helmet - Security middleware
- CORS - Cross-origin resource sharing
- Morgan - HTTP request logger
- Node.js 18+ - install with nvm
- pnpm 8+ -
npm install -g pnpm - MongoDB
- Turborepo (installed automatically via pnpm)
-
Clone the repository
git clone <YOUR_GIT_URL> cd mern-turbopack-aio-boilerplate
-
Install dependencies
pnpm install
-
Set up environment variables
# Copy server environment template cp apps/server/env.example apps/server/.env # Edit apps/server/.env with your configuration
-
Start MongoDB
# Install and start MongoDB locally # Then update apps/server/.env with: MONGODB_URI=mongodb://localhost:27017/mern_turbopack_aio
-
Start development servers
# Start all apps and packages in development mode pnpm dev # Or start individual apps: pnpm --filter @mern-turbopack-aio/client dev # Client on http://localhost:4444 pnpm --filter @mern-turbopack-aio/server dev # Server on http://localhost:4443
pnpm dev- Start all apps and packages in development modepnpm build- Build all apps and packages for productionpnpm lint- Lint all apps and packagespnpm test- Run tests for all apps and packagespnpm clean- Clean all build artifactspnpm format- Format all code with Prettierpnpm type-check- Run TypeScript type checking
pnpm --filter @mern-turbopack-aio/client dev- Start client development serverpnpm --filter @mern-turbopack-aio/client build- Build client for productionpnpm --filter @mern-turbopack-aio/client preview- Start client production serverpnpm --filter @mern-turbopack-aio/server dev- Start server development serverpnpm --filter @mern-turbopack-aio/server build- Build server for productionpnpm --filter @mern-turbopack-aio/server start- Start server production server
pnpm --filter @mern-turbopack-aio/types build- Build shared types packagepnpm --filter @mern-turbopack-aio/utils build- Build shared utils packagepnpm --filter @mern-turbopack-aio/ui build- Build shared UI package
GET /api/health- Server health status
# Server Configuration
PORT=4443
NODE_ENV=development
# Database
MONGODB_URI=mongodb://localhost:27017/mern_turbopack_aio
# Frontend URL (for CORS)
FRONTEND_URL=http://localhost:4444
# External API configuration
# Add external API base URLs here as needed
# Rate Limiting
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100The client uses Vite environment variables:
VITE_API_URL- Server API URL (default: http://localhost:4443/api)
- High-density interface: Compact, information-rich dashboard for monitoring data and insights
- Real-time data: Live updates on key metrics and trends
- Signal tracking: Monitor and track signals and alerts
- Active items: View and manage active positions
- Search: Find items using keywords
- Sort: Sort results by relevant metrics (e.g., volume, date)
- Item Cards: Display key information including:
- Title and image
- Current value and 24h change
- Volume/activity
- Creation and closing dates
- Trend indicators
- Details View: Explore detailed information with:
- Interactive charts (e.g., 30-day history)
- Statistics (e.g., liquidity, fees)
- Additional metadata
- Direct links to external sources
- Splash screen: Professional loading experience with progress indicators
- Responsive design: Optimized for desktop and mobile viewing
- Fast loading: Efficient data fetching and caching
- External integration: Direct links to external platforms for trading
- Build all apps and packages:
pnpm build - Start server:
pnpm --filter @mern-turbopack-aio/server start - Serve client build files with a web server (nginx, Apache, etc.)
- Make changes to client, server, or shared packages
- Run linting to check code quality:
pnpm lint - Test changes locally:
pnpm dev - Build for production:
pnpm build - Deploy using your preferred deployment method
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Run tests and linting:
pnpm lint && pnpm test - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
This project is licensed under the MIT License.