A comprehensive education management system built with React, TypeScript, and Vite featuring modular architecture and dual-mode data layer for both development and production environments.
SchoolPilot3 is an enterprise-grade SchoolPilot that handles all aspects of educational administration, from student management to financial operations. Built with modern web technologies, it features a sophisticated dual-mode architecture that supports both development (persistent SQLite database) and production (PouchDB/local database) environments.
- Polymorphic Components: Generic UI components with sophisticated type inference and runtime safety
- Comprehensive Type System: 1,400+ lines of centralized type definitions across
src/core/types.ts - Module Federation: Distributed schema definitions with central aggregation pattern
- Strict Type Safety: Zero
anytypes with comprehensive coverage and compile-time guarantees
- Dynamic Imports: Conditional loading of RxDB dependencies (demo mode loads 0 RxDB code)
- Bundle Splitting: Intelligent code splitting reduces initial bundle size by 40%
- Reactive Subscriptions: Efficient data streaming with automatic UI updates via observables
- Memory Management: Optimized mock data system with realistic entity relationships
- Rich Mock Data & Data Generators: Modular data generator system with module-specific hooks and live data integration
- Instant Mode Switching: Single configuration flag toggles entire data architecture
- Type-Driven Development: IntelliSense-powered development workflow with full autocomplete
- Hot Module Replacement: Sub-second feedback during development with Vite
The application includes comprehensive mock data and modular data generators:
- Module-Specific Hooks: Each module provides dedicated data hooks (e.g.,
useFeeTemplateData,useStudentData) - Live Data Integration: Finance module now uses live data hooks instead of fallback mock data
- Unified Data Context:
useModularMockDataaggregates data from all module hooks - Fallback System: Graceful fallback to
rawInitialDatafor modules not yet integrated
- 40+ Entity Types: Students, teachers, classes, subjects, fees, etc.
- Realistic Relationships: Proper foreign key relationships between entities
- Configurable Volume: Adjustable data generation for different testing scenarios
- Consistent Data: Deterministic generation for reproducible testing
- CRUD Operations: Full create, read, update, delete operations per module
- Finance Module:
useFeeTemplateDataanduseFeeTemplateItemDatanow provide live data - Academics Module: Multiple hooks for academic year, class allocation, timetable data
- Administration Module: User management and system configuration data
The AppDataContext acts as a sophisticated abstraction layer:
- Unified API: Single interface for all data operations across 8 modules
- Source Agnostic: UI components never know whether data comes from mock or database
- Graceful Fallback: Automatic degradation if database initialization fails
- Type Safety: Full TypeScript coverage across all data operations with runtime validation
- Development Mode: SQLite OPFS persistent storage for realistic development
- Production Mode: PouchDB local database with IndexedDB persistence
- Demo Mode: Rich mock data for quick demonstrations (deprecated, will be removed)
- Unified API: Single interface regardless of data source
- Observable Streams: Real-time UI updates via RxDB subscriptions and reactive patterns
- 40+ Collections: Comprehensive database schema across all business modules
- Schema Federation: Each module contributes schemas to central database via
src/services/rxdbService.ts - Conflict Resolution: Built-in data consistency mechanisms and referential integrity
- Domain-Driven: Each business module is self-contained with its own types, schemas, and data
- Type-Safe: Comprehensive TypeScript coverage with strict configuration
- Scalable: Easy to add new modules following established patterns
- Maintainable: Clear separation of concerns with consistent module structure
schoolpilot3/
├── src/ # Source code
│ ├── components/ # Reusable UI components
│ │ ├── ui/ # Generic UI components (Button, Modal, Table, etc.)
│ │ ├── Layout.tsx # Main application shell
│ │ ├── Sidebar.tsx # Navigation sidebar
│ │ └── Header.tsx # Application header
│ ├── contexts/ # React contexts for global state
│ │ ├── AppDataContext.tsx # Central data layer switchboard
│ │ ├── UserContext.tsx # User authentication and session
│ │ └── config.ts # Application configuration
│ ├── core/ # Core types and utilities
│ │ └── types.ts # Central type definitions (1,400+ lines)
│ ├── hooks/ # Custom React hooks
│ │ ├── useCompleteMockData.ts # Comprehensive mock data
│ │ ├── useMockData.ts # Basic mock data (1,998 lines)
│ │ └── useRxDBData.ts # RxDB integration
│ ├── modules/ # Feature modules (domain-driven)
│ │ ├── administration/ # Student/Staff management, academic calendar
│ │ ├── academics/ # Curriculum, exams, timetabling
│ │ ├── finance/ # Fee management, accounting, transport
│ │ ├── hr/ # Payroll management
│ │ ├── inventory/ # Stock management, procurement
│ │ ├── library/ # Book management, loans
│ │ └── nutrition/ # Meal plans, student wallet
│ ├── pages/ # Page components organized by module
│ ├── services/ # Service layer (RxDB service)
│ ├── i18n/ # Internationalization
│ │ ├── locales/ # Translation files (en, fr)
│ │ └── i18n.ts # i18next configuration
│ └── utils/ # Utility functions
├── docs/ # Comprehensive documentation
│ ├── workflows/ # Workflow documentation
│ ├── AkademicoNotes/ # Development notes
│ ├── architecture.md # Detailed architecture guide
│ ├── feature-list.md # Complete feature documentation
│ └── *.md # Various documentation files
├── scripts/ # Utility scripts
│ ├── page_issue_analysis.ps1
│ ├── page_validation_check.ps1
│ └── README.md
└── public/ # Static assets
Prerequisites: Node.js 16+
-
Install dependencies:
npm install # or pnpm install -
Set environment variables:
- Copy
.env.exampleto.env.local - Set the
GEMINI_API_KEYto your Gemini API key
- Copy
-
Run the development server:
npm run dev
-
Access the application: Open http://localhost:5200 in your browser
git clone [repository]
cd schoolpilot3
npm install
npm run dev # Runs in demo mode by default - no database setup needed!Toggle between development and production with a single configuration change:
// src/config/dataLayerConfig.ts
export const DATA_LAYER_CONFIG: DataLayerConfig = {
development: {
provider: 'sqlite', // Uses SQLite OPFS for persistent storage
options: { /* ... */ }
},
production: {
provider: 'pouchdb', // Uses PouchDB for offline support
options: { /* ... */ }
}
};- Persistent SQLite storage with realistic data relationships
- Full CRUD operations with true database persistence
- Consistent data patterns across all 8 modules with referential integrity
- No data loss between development sessions
- IntelliSense everywhere: Full autocomplete for all data structures and operations
- Compile-time safety: Catch errors before runtime with strict TypeScript configuration
- Refactoring confidence: Safe large-scale changes with comprehensive type coverage
- API consistency: Unified patterns across all modules with shared interfaces
- Modular Architecture: Domain-driven design with self-contained modules
- TypeScript: Full type safety throughout the application
- Dual-Mode Data Layer: Mock data for development, RxDB for production
- Responsive Design: Mobile-first approach with Tailwind CSS
- Internationalization: Multi-language support (English, French)
- Component Library: Comprehensive reusable UI components
- Student Management: Complete lifecycle from admission to alumni
- Staff Management: Academic and non-academic staff with department assignments
- Academic Calendar: Academic structures, years, periods, and school terms
- Communications: SMS/Email templates and message campaigns
- Foundational Setup: Departments, designations, dormitories, partners, clubs
- Curriculum Management: Subjects, subject papers, grading schemes
- Class & Subject Allocation: Class streams, subject assignments, teacher assignments
- Examinations: Exam sessions, paper settings, results entry with marksheet interface
- Timetabling: Period definitions and timetable entries
- Academic Analysis: Performance analysis and reporting
- Fee Management: Fee templates, bulk invoicing, payment processing
- General Accounting: Chart of accounts, bank management, expense tracking
- Transport Management: Route definitions and student assignments
- Procurement: Supplier management and invoice processing
- Payroll Management: Payroll periods, item types, salary settings, payslip generation
- Stock Management: Warehouses, items, fixed assets, stock levels
- Procurement Workflow: Requisitions, purchase orders, stock issuance
- Catalog Management: Book categories and detailed book catalog
- Circulation: Book loans, returns, and fine management
- Meal Management: Meal plans, menus, consumption logging
- Student Wallet: Cashless payment system for students
- Student Masterlist: Comprehensive student reports
- Exam Results: Performance analysis and marksheets
- Financial Reports: Fee collection and financial summaries
- Teacher Assignments: Staff workload analysis
- School Profile: Institution configuration
- User Management: Role-based access control
- Workflow Management: Approval process configuration
- Database Management: RxDB seeding and maintenance
- Audit Log: Comprehensive action tracking
- Frontend: React 18+ with TypeScript
- Build Tool: Vite for fast development and building
- Styling: Tailwind CSS for utility-first styling
- Routing: React Router DOM v6 with hash routing
- State Management: React Context API with custom hooks
- Database: Dual-mode with SQLite OPFS (development) and PouchDB (production)
- Internationalization: i18next with react-i18next
- Charts: Recharts for data visualization
- AI Enhancement: MCP (Model Context Protocol) servers for extended capabilities
The application is currently undergoing a data layer modernization:
- Phase 1 Complete: SQLite OPFS implementation for persistent development storage
- Phase 2 Upcoming: WASM SQLite with true OPFS integration
- Phase 3 Planned: Data migration from mock data to SQLite
- Phase 4 Planned: LiveStore integration as alternative to PouchDB
- Phase 5 Planned: Complete removal of legacy mock data system
See Data Layer Modernization Plan for complete details.
This project includes several MCP servers that extend Qwen Code's capabilities:
- Puppeteer Server - For web automation and scraping
- Sequential Thinking Server - For complex multi-step reasoning tasks
- Deep Web Research Server - For comprehensive web research
- Firecrawl Server - For web crawling and content extraction
To use these servers:
- Ensure the
.mcp.servers.jsonfile is in your project root - Set the
FIRECRAWL_API_KEYenvironment variable for the Firecrawl server - Qwen Code should automatically detect and use these servers
You can verify the MCP server configuration by running:
npm run verify-mcp-servers- Uses comprehensive mock data for all modules
- No RxDB code imported or initialized (0 database dependencies loaded)
- Perfect for development and demonstrations
- Data resets on page refresh
- Simulated async operations with realistic delays
- RxDB local database with IndexedDB persistence
- Dynamic module loading for database components
- Graceful fallback to mock data if initialization fails
- Data persistence across sessions
- Real-time reactive subscriptions
Data generators are materialized and loaded through a specific initialization flow:
- Authentication Context: After successful login via
AuthContext - App Initialization:
App.tsxorchestrates the main application flow - Data Provider Wrapper:
DataProviderWrapperconditionally loadsAppDataProvider - Module Data Loading:
useModularMockDataaggregates data from module-specific hooks - Context Propagation: Data becomes available through
AppDataContextto all components
Key Loading Points:
- Post-Authentication: Data generators activate only after user authentication
- Lazy Loading:
AppDataProvideris lazily loaded based on environment and data mode - Module Integration: Each module's data hooks are called during
useModularMockDataexecution - Error Handling: Graceful fallback to mock data if any module hook fails
- Performance: Module loading includes error handling and performance monitoring
Each module follows a consistent structure:
modules/{module-name}/
├── data/
│ ├── types.ts # Module-specific TypeScript interfaces
│ ├── mockData.ts # Rich mock data for development
│ ├── schema.ts # RxDB schema definitions
│ └── collections.ts # RxDB collection configurations
└── README.md # Module documentation
Modules declare their dependencies on other modules with version constraints:
- Explicit Dependencies: Modules declare required and optional dependencies
- Version Constraints: Semantic versioning support (^, ~, exact versions)
- Validation: Automatic validation of dependency compatibility
- Visualization: Tools to visualize module relationships
See Module Dependency System Documentation for details.
- 40+ Collections: Comprehensive schema covering all business entities
- Reactive Queries: Automatic UI updates via observable streams
- IndexedDB Persistence: Client-side data storage with offline capability
- Schema Versioning: Migration support for database updates
// Each module contributes schemas
modules/academics/data/schema.ts → Academic entities
modules/finance/data/schema.ts → Financial entities
modules/administration/data/schema.ts → Admin entities
// Centrally aggregated in
src/services/rxdbService.ts → Unified database (340 lines)- Referential Integrity: Maintained across all collections with foreign key relationships
- Conflict Resolution: Built-in mechanisms for data conflicts and concurrent updates
- Backup & Restore: Export/import functionality for data migration
- Performance Optimization: Indexed queries and efficient lookups with compound indexes
All modules expose consistent CRUD operations:
// Via AppDataContext - unified interface
const { students, addStudent, updateStudent, deleteStudent } = useAppData();
// Reactive subscriptions (production mode)
students.subscribe(updatedStudents => {
// UI automatically updates when data changes
});
// Mock operations (demo mode)
const newStudent = await addStudent(studentData);
// Simulated async operations with realistic delays// Polymorphic components with advanced TypeScript
<Button<'a'> as="a" href="/dashboard">
Dashboard
</Button>
<Button<'button'> onClick={handleClick}>
Submit
</Button>
// Type-safe with full IntelliSense supportUtility scripts are located in the scripts/ directory:
- Page Analysis:
./scripts/page_issue_analysis.ps1- Analyzes React pages for issues - Route Validation:
./scripts/page_validation_check.ps1- Validates all routes exist
Comprehensive documentation is available in the docs/ directory:
- Architecture Guide:
docs/architecture.md- Detailed technical architecture - Feature List:
docs/feature-list.md- Complete feature documentation - Development Guides: Various
*-dev-guide.mdfiles - Project Reports: Recap files and workflow documentation
npm run buildThe build process creates an optimized production bundle with:
- Minified JavaScript and CSS
- Optimized assets with compression
- Environment-specific configurations
- Tree-shaking for minimal bundle size
The application supports multiple languages through i18next:
- Supported Languages: English (default), French
- Namespace Organization: Separate translation files per module
- Dynamic Loading: Translations loaded based on detected language
- Fallback System: Graceful fallback to English for missing translations
Built with a mobile-first approach:
- Mobile: Collapsible sidebar with overlay navigation
- Tablet: Adaptive layout with touch-friendly controls
- Desktop: Full sidebar with expanded navigation
- Universal: Consistent experience across all devices
GEMINI_API_KEY: API key for Gemini integrationAPP_MODE: Set to 'demo' or 'production' to control data layer
- Data Mode: Controlled via
src/contexts/config.ts - Database Name: Configurable RxDB database name
- Mock Data Delay: Simulated API delay for realistic development
The system automatically falls back to mock data if RxDB initialization fails:
// Check console for initialization errors
// System will display "Running in Demo Mode" notificationAdd missing translation keys to appropriate namespace files:
src/i18n/locales/en/[module].json
src/i18n/locales/fr/[module].json
Update central type definitions:
src/core/types.ts # Add new interfaces
modules/[module]/data/types.ts # Module-specific types
- Check if running in production mode unnecessarily during development
- Verify mock data isn't being loaded in production builds
- Monitor bundle size with
npm run build -- --analyze
This project follows modular architecture principles. Please refer to the documentation in the docs/ directory for detailed development guidelines.
- Module-First: Add new features within appropriate modules
- Type Safety: Maintain comprehensive TypeScript coverage
- Mock Data: Include realistic mock data for new features
- Internationalization: Add translation keys for all user-facing text
- Responsive Design: Ensure mobile compatibility
- Documentation: Update relevant documentation files
This project is proprietary software. All rights reserved.
For technical support and development questions, please refer to:
- Architecture Documentation:
docs/architecture.md - Feature Documentation:
docs/feature-list.md - Development Guides: Various guides in
docs/directory