Development Mode
Open Tarteel provides multiple development server options for different use cases.Standard Development Server
Start the Next.js development server with hot reload:Turbopack Development Server
Use Next.js with Turbopack for faster builds and hot module replacement:Turbopack is Next.js’s next-generation bundler, providing significantly faster refresh times during development.
Development with React Scan
Analyze React component renders and performance:Debug Mode with Inspector
Start the development server with Node.js inspector for debugging:Code Quality Checks
Linting
Run ESLint to check for code quality issues:Linting is automatically run on staged files before each commit via Husky hooks.
Type Checking
Verify TypeScript types without emitting files:Code Formatting
Format all files using Prettier:- JavaScript/TypeScript files (
.js,.jsx,.ts,.tsx) - JSON files
- Markdown files
- CSS files
Building for Production
Run Production Build
Create an optimized production build:This command:
- Compiles TypeScript
- Bundles all assets
- Optimizes code for production
- Generates static pages where possible
- Creates service worker for PWA
Start Production Server
After building, start the production server:The production server will run at http://localhost:3000.
Available Scripts
Here’s a complete reference of all npm scripts in the project:| Script | Description |
|---|---|
dev | Start development server |
dev:turbo | Start development server with Turbopack |
dev:scan | Start development server with React Scan |
dev:inspect | Start development server with Node.js inspector |
build | Create production build |
start | Start production server |
lint | Run ESLint checks |
lint:fix | Run ESLint and auto-fix issues |
type-check | Run TypeScript type checking |
format | Format code with Prettier |
prepare | Install Husky git hooks |
Git Hooks
The project uses Husky for Git hooks to ensure code quality:Pre-commit Hook
Automatically runs before each commit:Commit Message Hook
Enforces conventional commit format using Commitlint:Valid commit types:
feat, fix, docs, style, refactor, perf, test, chore, ci, buildBuild Output
After runningnpm run build, you’ll find:
.next/- Next.js build output and cachepublic/sw.js- Generated service worker for PWA.next/static/- Static assets and JavaScript bundles
Performance Optimization
The production build automatically includes:- Code splitting - Automatic route-based splitting
- Tree shaking - Removes unused code
- Minification - JavaScript and CSS compression
- Image optimization - Automatic image optimization via Next.js
- Bundle analysis - Available via
@next/bundle-analyzer
Troubleshooting
Build Failures
If the build fails:-
Clear Next.js cache:
-
Check for TypeScript errors:
-
Check for ESLint errors:
Slow Build Times
- Use
dev:turbofor faster development builds - Clear
.nextcache periodically - Check for circular dependencies
For more information on Next.js build optimization, see the Next.js documentation.