Try the production deployment on Vercel: v0-timeseries-five.vercel.app
This frontend application provides an interface for time series forecasting with support for multiple forecasting models like N-BEATS, Prophet, and TiDE. The application follows SOLID principles and uses a flexible component architecture to allow easy addition of new models.
- Flexible model registry system for adding new forecasting models
- Dynamic parameter configuration for each model type
- Model training workflow with real-time progress tracking
- Dataset selection and management
- Clean, modern UI with dark mode support
- TypeScript for improved type safety
The application uses WebSockets for real-time updates during model training:
- Live Training Progress: Watch training progress in real-time with detailed metrics
- Resource Monitoring: Monitor CPU and memory usage during training
- Automatic Reconnection: Handles connection issues with smart retry logic
- Efficient Updates: Optimized message protocol minimizes bandwidth usage
This real-time capability enables a responsive user experience when training complex models that might take significant time to complete.
- Deno 2.0 or higher
- Make
- pre-commit
- pnpm 11 or higher, only for local dependency audits with
make audit
- Clone the repository:
git clone https://github.com/your-username/TimeSeries_Frontend.git
cd TimeSeries_Frontend- Install required tooling:
# For macOS
brew install deno pre-commit pnpmFor other platforms, install Deno from https://deno.com/, pre-commit from https://pre-commit.com/, and pnpm from https://pnpm.io/.
- Run the setup command:
make setup- Clone the repository:
git clone https://github.com/your-username/TimeSeries_Frontend.git
cd TimeSeries_Frontend- Install Deno and pre-commit (if not already installed):
# For macOS
brew install deno pre-commit
# For Linux
curl -fsSL https://deno.land/x/install/install.sh | sh
python -m pip install pre-commit- Initialize project tooling:
make setupStart the regular development server:
make devStart the local environment development server (with mocked data):
make dev-localThe application will be available at http://localhost:3000.
The project supports multiple environments:
local- Local development with mocked datadevelopment- Development environment with test APItest- Testing environmentproduction- Production environment
To create custom environment configurations:
- Copy
.env.exampleto.env.{environment}(e.g.,.env.local) - Modify the variables as needed
- Import this repository in Vercel.
- In project settings, set Root Directory to
src. - In Environment Variables, add:
NEXT_PUBLIC_API_BASE_URL= your backend API URL
- Deploy from
main(or your release branch) and use the generated domain.
If the app shows API access errors in production, verify that
NEXT_PUBLIC_API_BASE_URL is set for the Production environment and points
to a reachable backend with CORS enabled for your Vercel domain.
Build the application for production:
make buildStart the production server:
make start/src- Source code directory/app- Next.js application files/components- React components/hooks- Custom React hooks/lib- Utility functions and libraries/public- Static assets/styles- Global styles
The project implements a comprehensive testing approach across multiple layers:
- Component testing with React Testing Library
- Model registry and utility function tests
- Type validation tests
- Component interaction testing
- API client testing with mock servers
- State management testing
- Critical user flow validation
- Backend integration testing
- WebSocket communication testing
- Rendering performance measurements
- Network operation optimizations
- Memory usage monitoring
We've implemented several improvements to support React component testing in Deno:
-
Enhanced Type Declarations:
- Added proper JSX element type definitions
- Updated React component return types
- Created appropriate module declarations
-
Import Path Optimization:
- Ensured proper file extensions in imports
- Configured import map for correct module resolution
-
Documentation:
- Added notes about current testing limitations
- Provided workarounds for common issues
While there are still some compatibility challenges between Deno's type system and React's JSX, our improvements allow for reliable testing of both UI components and business logic.
Run tests with:
make test- Deno 2.0 as the runtime
- Next.js 15
- React 19
- Tailwind CSS
- Radix UI Components
- Recharts for data visualization
- D3.js and Observable Plot for advanced visualizations
The application follows SOLID principles and uses several design patterns to ensure maintainability and extensibility:
The core of the application is a flexible model registry system that implements the Factory pattern:
- Dynamic Registration: Models can be registered at runtime
- Type Safety: Strong TypeScript typing for all model definitions
- Parameter Validation: Automatic validation of model parameters
- Extensibility: New models can be added without modifying existing code
- Factory Pattern: Used for creating model instances
- Strategy Pattern: Applied for interchangeable forecasting algorithms
- Observer Pattern: Implemented for reactive UI updates
- Adapter Pattern: Used for backend API communication
- Repository Pattern: Applied for data access abstraction
- Single Responsibility: Each component has a clear, focused purpose
- Composition over Inheritance: Components are composed of smaller, reusable parts
- Container/Presenter Pattern: Separation of logic and presentation
- Custom Hooks: Encapsulation of reusable logic
- Security: Deno has a permissions system that provides greater security by default
- TypeScript built-in: No need for additional TypeScript configuration
- Modern JavaScript: First-class support for ESM and top-level await
- Built-in tooling: Includes testing, formatting, and linting out of the box
- Node.js compatibility: Deno 2.0 can use npm packages seamlessly
- Improved performance: Better runtime performance than Node.js
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
The codebase currently has some linting issues that are being addressed gradually:
- 'any' type usage: We're working on replacing
anytypes with more specific types - Unused variables: Some variables are unused and should be prefixed with underscores
- Async functions without await: Some async functions need await statements or should have the async keyword removed
To keep linting and formatting clean during development, run:
make fmt
make lintThen address any remaining issues manually in the reported files.
The pre-commit hooks are configured in .pre-commit-config.yaml. We're
currently ignoring:
no-explicit-any: allowsanytype for nowrequire-await: allows async functions without awaitno-unused-vars: allows unused variables
In production code, these issues should be properly addressed.
To run all pre-commit hooks locally:
make pre-commit