System Requirements
Minimum Requirements
- Node.js: 20.x or higher
- npm: 10.x or higher (or equivalent package manager)
- Memory: 2GB RAM minimum (4GB recommended)
- Disk Space: 500MB for dependencies and build artifacts
- Browser: Modern browser with JavaScript enabled (Chrome, Firefox, Safari, Edge)
Supported Package Managers
MicroCBM works with any of these package managers:Installation Steps
1. Get the Source Code
Clone the repository or download the source:2. Install Dependencies
Install all required packages:package.json:
Core Framework
[email protected]- Next.js framework with App Router[email protected]- React librarytypescript@^5- TypeScript language support
UI Components & Styling
@radix-ui/*- Accessible UI primitives (Dialog, Select, Dropdown, etc.)tailwindcss@^4- Utility-first CSS frameworksass@^1.93.2- SCSS preprocessorframer-motion@^12.23.24- Animation library@iconify/react@^6.0.2- Icon system
Forms & Validation
react-hook-form@^7.64.0- Form state managementzod@^4.1.11- Schema validation@hookform/resolvers@^5.2.2- Form validation integration
Data & State Management
@tanstack/react-query@^5.90.2- Server state management@tanstack/react-table@^8.21.3- Table managementzustand@^5.0.9- Client state managementaxios@^1.12.2- HTTP client
Visualization & Diagramming
recharts@^3.2.1- Chart library@xyflow/react@^12.10.1- Flow diagrams (for RCA)
Authentication & Security
jose@^6.1.0- JWT handlingvalidator@^13.15.23- Input validation
3. Environment Configuration
Create a.env.local file in the root directory:
.env.local
Environment Variables Reference
NEXT_PUBLIC_API_URL (Required)
NEXT_PUBLIC_API_URL (Required)
Type: String
Description: Base URL for the backend REST APIThis variable is used in server actions to make API requests:Example values:
Description: Base URL for the backend REST APIThis variable is used in server actions to make API requests:
src/app/actions/helpers.ts
- Development:
http://localhost:8000 - Production:
https://api.yourdomain.com - Staging:
https://api-staging.yourdomain.com
The
NEXT_PUBLIC_ prefix makes this variable available to client-side code. Do not include sensitive data in this URL.SESSION_SECRET (Required)
SESSION_SECRET (Required)
Type: String
Description: Secret key used for JWT session encryption and validationUsed inRequirements:
Description: Secret key used for JWT session encryption and validationUsed in
src/libs/jwt.ts and src/libs/session.ts for session management:- Minimum 32 characters
- Use a cryptographically secure random string
- Keep it secret and never expose in client code
4. Verify Configuration
Check that your setup is correct:Running the Application
Development Mode
Start the development server with hot reloading:http://localhost:3000 by default.
Development server features:
- Hot module replacement (HMR)
- Fast Refresh for instant updates
- Detailed error messages and stack traces
- Source maps for debugging
The first request after starting may take 30-60 seconds if the backend API is on a free-tier service with cold starts.
Production Build
Build and run the optimized production version:- Compiles TypeScript to JavaScript
- Optimizes and minifies code
- Generates static pages where possible
- Creates optimized CSS bundles
- Processes and optimizes images
Security Configuration
Security Headers
MicroCBM implements security best practices innext.config.ts:
next.config.ts
X-Content-Type-Options: nosniff- Prevents MIME type sniffingX-Frame-Options: SAMEORIGIN- Prevents clickjacking attacksReferrer-Policy- Controls referrer informationPermissions-Policy- Disables unnecessary browser featurespoweredByHeader: false- Removes X-Powered-By header
Middleware Protection
All routes except authentication pages are protected by middleware insrc/middleware.ts:
src/middleware.ts
- Checks for valid JWT token on protected routes
- Redirects unauthenticated users to login
- Redirects authenticated users away from auth pages
- Validates token expiration and clears expired sessions
- Excludes static assets, API routes, and public files
Authentication Flow
MicroCBM uses a two-step authentication process:OTP verification
Backend sends a 6-digit OTP to user’s email. User enters OTP:
src/app/actions/auth.ts
OTP verification is required for all logins. Ensure your email service is configured correctly in the backend API.
TypeScript Configuration
MicroCBM uses strict TypeScript settings defined intsconfig.json:
tsconfig.json
strict: true- Enables all strict type checking@/*path alias - Import fromsrc/using@/prefixtarget: ES2017- Compiles to ES2017 for broad compatibility
Deployment
Vercel (Recommended)
Deploy to Vercel in one click:Docker
Create aDockerfile for containerized deployment:
Dockerfile
Other Platforms
MicroCBM can be deployed to:- Netlify: Use the Netlify CLI or Git integration
- AWS: Deploy to EC2, ECS, or Amplify
- Google Cloud: Use Cloud Run or App Engine
- Azure: Deploy to App Service
For production deployments, always use
npm run build and npm run start rather than npm run dev.Troubleshooting
Module not found errors
Module not found errors
Solution: Clear cache and reinstall
Port 3000 already in use
Port 3000 already in use
Solution: Use a different port
API connection refused
API connection refused
Solution:
- Verify
NEXT_PUBLIC_API_URLis correct - Check backend API is running
- Ensure no CORS issues (check browser console)
Build fails with TypeScript errors
Build fails with TypeScript errors
Solution:
Next Steps
Development Guide
Learn about the project structure and start developing
Environment Variables
Complete reference for all configuration options
Security Best Practices
Harden your production deployment
API Reference
Explore Server Actions and type definitions