A modern, full-stack Customer Relationship Management (CRM) system built with enterprise-grade technologies and best practices.
- Framework: Node.js with NestJS
- Database: PostgreSQL 15+ with TypeORM
- API: REST API with OpenAPI/Swagger documentation
- Authentication: JWT tokens with refresh mechanism
- Caching: Redis for session and data caching
- Search: Elasticsearch for full-text search
- Queue: Redis/Bull for background jobs
- Framework: React 18+ with TypeScript
- UI Library: Material-UI (MUI)
- State Management: Redux Toolkit
- Build Tool: Vite
- Charts: Chart.js for data visualization
- PWA: Progressive Web App capabilities
- Define custom fields per module (Leads, Opportunities, Contacts) in Settings
- Supported types: text, textarea, number, date, boolean, select, multiselect
- Authentication & Authorization: Role-based access control (RBAC)
- Multi-tenancy: Support for multiple organizations
- Reporting & Analytics: Comprehensive reporting system
- Real-time Updates: WebSocket integration
- Mobile Support: Responsive design and PWA
- Node.js 18.0 or higher
- PostgreSQL 15+
- Redis 7+
- npm 9+ or yarn
-
Clone the repository
git clone <repository-url> cd Edforce
-
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env # Edit .env with your configuration -
Start with Docker (Recommended)
docker-compose up -d
-
Or start manually
# Start backend cd backend npm run start:dev # Start frontend (in another terminal) cd frontend npm run dev
- Frontend: http://localhost:3001
- Backend API: http://localhost:3000/api
- API Documentation: http://localhost:3000/api/docs
Edforce/
├── backend/ # NestJS backend application
│ ├── src/
│ │ ├── modules/ # Feature modules (accounts, contacts, etc.)
│ │ ├── database/ # Database configuration and migrations
│ │ ├── common/ # Shared utilities and decorators
│ │ └── main.ts # Application entry point
│ ├── package.json
│ └── Dockerfile
├── frontend/ # React frontend application
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ ├── pages/ # Page components
│ │ ├── store/ # Redux store and slices
│ │ ├── services/ # API services
│ │ ├── hooks/ # Custom React hooks
│ │ └── theme/ # Material-UI theme configuration
│ ├── package.json
│ └── Dockerfile
├── shared/ # Shared TypeScript types and interfaces
│ ├── src/
│ │ ├── entities.ts # Business entity interfaces
│ │ ├── dto.ts # Data Transfer Objects
│ │ └── enums.ts # Shared enumerations
│ └── package.json
├── docker-compose.yml # Docker services configuration
└── package.json # Root package.json for workspace
From the root directory:
npm run dev- Start both backend and frontend in development modenpm run build- Build both applications for productionnpm run test- Run tests for both applicationsnpm run lint- Lint both applications
npm run start:dev- Start backend in development modenpm run migration:generate- Generate new database migrationnpm run migration:run- Run pending migrationsnpm run seed- Seed database with sample data
npm run dev- Start frontend development servernpm run build- Build frontend for productionnpm run preview- Preview production build locally
- Open Settings > Custom Fields in the app sidebar
- Choose the module tab (Leads, Opportunities, Contacts)
- Click “Add Field” and configure:
- Label and optional Key (auto-generated from label if omitted)
- Type (text, number, select, etc.)
- Required, Order, Help Text
- For selects, enter options (one per line)
- Save. The new field immediately appears in that module’s create/edit form under “Custom Fields”
- Values save along with the record; you can edit or delete fields anytime
Backend endpoints (JWT-protected, NestJS):
- GET
/custom-fields/definitions?entityType=lead|opportunity|contact - POST
/custom-fields/definitions(create) - PATCH
/custom-fields/definitions/:id(update) - DELETE
/custom-fields/definitions/:id(delete) - POST
/custom-fields/valueswith{ entityType, recordId, values: { key: value } } - GET
/custom-fields/values?entityType=...&recordId=...
Implementation details:
- Definitions:
custom_field_definitions(TypeORM entity) - Values:
custom_field_values(JSONB value, per record) - Frontend dynamic renderer:
src/components/custom-fields/CustomFieldsRenderer.tsx - Settings page:
src/pages/settings/CustomFieldsPage.tsx
The system uses PostgreSQL with the following core entities:
- Account: Companies and organizations
- Contact: Individual contacts
- Lead: Potential customers
- Opportunity: Sales opportunities
- Case: Customer service cases
- Task: To-do items and activities
- Meeting: Scheduled meetings
- Call: Phone call records
- Email: Email communications
- Product: Product catalog
- Quote: Price quotes
- Invoice: Billing documents
- User: System users
- Role: User roles and permissions
- Campaign: Marketing campaigns
- JWT Authentication: Secure token-based authentication
- Role-Based Access Control: Granular permissions system
- Input Validation: Comprehensive data validation
- SQL Injection Protection: TypeORM query builder protection
- XSS Protection: Content Security Policy headers
- Rate Limiting: API request rate limiting
- HTTPS Enforcement: SSL/TLS encryption in production
The API is fully documented using OpenAPI/Swagger specification:
- Local: http://localhost:3000/api/docs
- Authentication: Bearer token required for protected endpoints
- Rate Limits: 100 requests per 15 minutes per IP
- Versioning: API versioning support
{
auth: { // Authentication state
user: User | null,
isAuthenticated: boolean,
tokens: { access, refresh }
},
ui: { // UI state
sidebarOpen: boolean,
loading: boolean,
notifications: []
},
accounts: { // Accounts module state
accounts: Account[],
selectedAccount: Account | null,
filters: FilterState
},
// ... other modules
}- Responsive Design: Mobile-first responsive layout
- Dark/Light Theme: Theme switching capability
- Data Tables: Advanced filtering, sorting, and pagination
- Forms: Dynamic form generation with validation
- Charts: Interactive data visualizations
- Drag & Drop: Intuitive drag-and-drop interfaces
- Real-time Updates: Live data synchronization
- Progressive Web App: Offline capability and app-like experience
- Unit Tests: Jest-based unit testing
- Integration Tests: API endpoint testing
- E2E Tests: End-to-end testing with Supertest
- Component Tests: React Testing Library
- Hook Tests: Custom hook testing
- Integration Tests: User interaction testing
Run tests:
npm test- Database Indexing: Optimized database queries
- Caching: Redis caching for frequently accessed data
- Code Splitting: Lazy loading of route components
- Bundle Optimization: Webpack optimization techniques
- Image Optimization: Responsive images and lazy loading
- CDN Integration: Static asset delivery optimization
docker-compose -f docker-compose.prod.yml up -d-
Build applications:
npm run build
-
Set production environment variables
-
Start production servers
-
Configure reverse proxy (Nginx)
-
Set up SSL certificates
- Always build the backend before starting it in production mode to avoid stale compiled artifacts:
- From
backend/: usenpm run serve:prod(builds then runsnode dist/main). - If you use
npm run start:proddirectly, ensure you rannpm run buildbeforehand.
- From
- Roles allowed to create leads: Center Manager and Counselor only.
- If you see 403 when creating a lead while authenticated as one of these roles:
- Ensure backend was started with a fresh build (
npm run serve:prod). - As a temporary workaround, you can route creates to the fallback endpoint
/api/leads/open-create.- Frontend can toggle this via env: set
VITE_USE_OPEN_CREATE=trueand rebuild the frontend.
- Frontend can toggle this via env: set
- Verify your token role claims via
/api/auth/profile.
- Ensure backend was started with a fresh build (
- Fork the repository
- Create a feature branch:
git checkout -b feature/new-feature - Commit changes:
git commit -am 'Add new feature' - Push to branch:
git push origin feature/new-feature - Submit a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue on GitHub
- Check the API documentation
- Review the project wiki
- Core architecture setup
- Authentication system
- Basic CRUD operations
- Database schema
- Advanced reporting
- Email integration
- Mobile app
- Third-party integrations
- AI/ML features
- Advanced analytics
- Workflow automation
- Multi-language support
Built with ❤️ using modern web technologies