Skip to content

marafa1985/reactive-api-console

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Reactive API Console

A modern, interactive web application that provides a console-like interface for testing and exploring various APIs. Built with React, TypeScript, and Redux Toolkit, featuring real-time search, highlighting, and a responsive design.

🌐 Live Demo: https://reactive-api-console.vercel.app

πŸš€ Features

  • Interactive API Testing: Execute commands to fetch data from various APIs
  • Real-time Search: Global search across all API responses with highlighting
  • Responsive Design: Modern UI built with Tailwind CSS
  • Type Safety: Full TypeScript support throughout the application
  • State Management: Redux Toolkit for predictable state management
  • Reactive Programming: RxJS for handling asynchronous operations and data streams
  • Comprehensive Testing: Unit tests, integration tests, and E2E tests with Cypress

πŸ› οΈ Tech Stack

  • Frontend: React 19, TypeScript, Vite
  • Styling: Tailwind CSS 4
  • State Management: Redux Toolkit, React Redux
  • Reactive Programming: RxJS
  • Testing: Vitest, Testing Library, Cypress
  • Build Tool: Vite
  • Package Manager: pnpm

πŸ“‹ Prerequisites

  • Node.js 20 or higher
  • pnpm (recommended) or npm

πŸš€ Quick Start

1. Clone the Repository

git clone https://github.com/marafa1985/reactive-api-console.git
cd reactive-api-console

2. Install Dependencies

# Using pnpm (recommended)
pnpm install

# Or using npm
npm install

3. Start Development Server

pnpm dev

The application will be available at http://localhost:5173

πŸ“– Usage

Available Commands

The console supports the following commands:

  • help - Display available commands
  • clear - clear all results
  • history - Display messages history
  • get cat fact - Fetch a random cat fact
  • get chuck norris joke - Get a Chuck Norris joke
  • get bored activity - Get a random activity suggestion
  • get github users - Search GitHub users
  • get weather - Get weather information

Features

  1. Command Input: Type commands in the chat console
  2. API Panels: View responses in dedicated panels
  3. Global Search: Search across all responses with highlighting
  4. Response Filtering: Filter results based on search terms
  5. Response Pinning: Pin important responses for quick access

πŸ§ͺ Testing

Unit Tests

Run unit tests with Vitest:

# Run all tests
pnpm test

# Run tests with UI
pnpm test:ui

# Run tests with coverage
pnpm test:coverage

E2E Tests

Run end-to-end tests with Cypress:

# Open Cypress Test Runner
pnpm cy:open

# Run Cypress tests in headless mode
pnpm cy:run

# Run component tests
pnpm cy:open --component

Linting

pnpm lint

πŸ—οΈ Build

Development Build

pnpm build

Preview Production Build

pnpm build
pnpm preview

πŸ“ Project Structure

reactive-api-console/
β”œβ”€β”€ .github/workflows/          # GitHub Actions CI/CD
β”‚   └── ci-cd.yml              # Main CI/CD pipeline
β”œβ”€β”€ cypress/                   # E2E and Component Testing
β”‚   β”œβ”€β”€ component/             # Cypress component tests
β”‚   β”‚   └── ChatTitle.cy.tsx
β”‚   β”œβ”€β”€ e2e/                   # End-to-end tests
β”‚   β”‚   β”œβ”€β”€ api-console.cy.ts
β”‚   β”‚   β”œβ”€β”€ drag-drop.cy.ts
β”‚   β”‚   β”œβ”€β”€ export.cy.ts
β”‚   β”‚   β”œβ”€β”€ highlighting.cy.ts
β”‚   β”‚   └── redux-integration.cy.ts
β”‚   β”œβ”€β”€ fixtures/              # Test data
β”‚   β”‚   β”œβ”€β”€ cat-fact.json
β”‚   β”‚   └── example.json
β”‚   β”œβ”€β”€ support/               # Cypress support files
β”‚   β”‚   β”œβ”€β”€ commands.ts
β”‚   β”‚   β”œβ”€β”€ component.ts
β”‚   β”‚   └── e2e.ts
β”‚   └── cypress.config.js      # Cypress configuration
β”œβ”€β”€ public/                    # Static assets
β”‚   β”œβ”€β”€ robots.txt
β”‚   └── vite.svg
β”œβ”€β”€ src/                       # Source code
β”‚   β”œβ”€β”€ assets/                # Static assets
β”‚   β”‚   └── react.svg
β”‚   β”œβ”€β”€ components/            # React components (Atomic Design)
β”‚   β”‚   β”œβ”€β”€ atoms/             # Basic building blocks
β”‚   β”‚   β”‚   β”œβ”€β”€ APINotFound/
β”‚   β”‚   β”‚   β”œβ”€β”€ ChatSearchResult/
β”‚   β”‚   β”‚   β”œβ”€β”€ ChatTitle/
β”‚   β”‚   β”‚   β”œβ”€β”€ ChatWelcomeMessage/
β”‚   β”‚   β”‚   β”œβ”€β”€ DragHint/
β”‚   β”‚   β”‚   β”œβ”€β”€ DropIndicator/
β”‚   β”‚   β”‚   β”œβ”€β”€ HighlightText/
β”‚   β”‚   β”‚   β”œβ”€β”€ NoActiveAPI/
β”‚   β”‚   β”‚   β”œβ”€β”€ NoActivePanel/
β”‚   β”‚   β”‚   β”œβ”€β”€ NoResponses/
β”‚   β”‚   β”‚   β”œβ”€β”€ NoResultMatched/
β”‚   β”‚   β”‚   β”œβ”€β”€ PanelTitle/
β”‚   β”‚   β”‚   β”œβ”€β”€ ResultWrapper/
β”‚   β”‚   β”‚   └── SearchSummary/
β”‚   β”‚   β”œβ”€β”€ molecules/         # Composite components
β”‚   β”‚   β”‚   β”œβ”€β”€ BoredAPI/
β”‚   β”‚   β”‚   β”œβ”€β”€ CatFacts/
β”‚   β”‚   β”‚   β”œβ”€β”€ ChatCommand/
β”‚   β”‚   β”‚   β”œβ”€β”€ ChatLog/
β”‚   β”‚   β”‚   β”œβ”€β”€ ChatSearch/
β”‚   β”‚   β”‚   β”œβ”€β”€ ChuckNorris/
β”‚   β”‚   β”‚   β”œβ”€β”€ ChuckNorrisJoke/
β”‚   β”‚   β”‚   β”œβ”€β”€ DefaultAPIResponse/
β”‚   β”‚   β”‚   β”œβ”€β”€ DraggableTab/
β”‚   β”‚   β”‚   β”œβ”€β”€ FilterPanel/
β”‚   β”‚   β”‚   β”œβ”€β”€ GithubUsers/
β”‚   β”‚   β”‚   β”œβ”€β”€ PanelHeader/
β”‚   β”‚   β”‚   β”œβ”€β”€ SideBarHeader/
β”‚   β”‚   β”‚   β”œβ”€β”€ UserCommandInputProps/
β”‚   β”‚   β”‚   └── Weather/
β”‚   β”‚   β”œβ”€β”€ organisms/         # Complex components
β”‚   β”‚   β”‚   β”œβ”€β”€ ApiPanel/
β”‚   β”‚   β”‚   β”œβ”€β”€ APIPanelContent/
β”‚   β”‚   β”‚   β”œβ”€β”€ ApiPanelHeader/
β”‚   β”‚   β”‚   β”œβ”€β”€ ApiPanelWrapper/
β”‚   β”‚   β”‚   β”œβ”€β”€ AvailableAPIs/
β”‚   β”‚   β”‚   β”œβ”€β”€ ChatMessages/
β”‚   β”‚   β”‚   └── ChatPanel/
β”‚   β”‚   β”œβ”€β”€ pages/             # Page components
β”‚   β”‚   β”‚   └── Home/
β”‚   β”‚   └── template/          # Layout templates
β”‚   β”‚       β”œβ”€β”€ ApiPanels.tsx
β”‚   β”‚       β”œβ”€β”€ Chat.tsx
β”‚   β”‚       β”œβ”€β”€ Header.tsx
β”‚   β”‚       β”œβ”€β”€ ResponsesPanel.tsx
β”‚   β”‚       └── SideBar.tsx
β”‚   β”œβ”€β”€ core/                  # Business logic
β”‚   β”‚   β”œβ”€β”€ api/               # API integrations
β”‚   β”‚   β”‚   β”œβ”€β”€ bored.api.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ cat-fact.api.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ chuck-norris.api.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ github-users.api.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ registry.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ utils.ts
β”‚   β”‚   β”‚   └── weather.api.ts
β”‚   β”‚   β”œβ”€β”€ entity/            # Domain entities
β”‚   β”‚   β”‚   β”œβ”€β”€ api-response.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ api.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ chat-messages.ts
β”‚   β”‚   β”‚   └── user-command.ts
β”‚   β”‚   └── use-case/          # Business use cases
β”‚   β”‚       └── api-command.use-case.ts
β”‚   β”œβ”€β”€ hooks/                 # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ useApiCommands.ts
β”‚   β”‚   β”œβ”€β”€ useApiPanelsSortOrder.ts
β”‚   β”‚   β”œβ”€β”€ useApiSelectedPanel.ts
β”‚   β”‚   β”œβ”€β”€ useChat.ts
β”‚   β”‚   β”œβ”€β”€ useChatMessage.ts
β”‚   β”‚   β”œβ”€β”€ useCommandInput.ts
β”‚   β”‚   β”œβ”€β”€ useFilters.ts
β”‚   β”‚   └── useSpecialCommand.ts
β”‚   β”œβ”€β”€ store/                 # Redux store
β”‚   β”‚   β”œβ”€β”€ feature/           # Redux slices
β”‚   β”‚   β”‚   └── slices/
β”‚   β”‚   β”‚       β”œβ”€β”€ apisSlice.ts
β”‚   β”‚   β”‚       β”œβ”€β”€ chatSlice.ts
β”‚   β”‚   β”‚       β”œβ”€β”€ filtersSlice.ts
β”‚   β”‚   β”‚       β”œβ”€β”€ responsesSlice.ts
β”‚   β”‚   β”‚       └── uiSlice.ts
β”‚   β”‚   β”œβ”€β”€ hooks.ts           # Redux hooks
β”‚   β”‚   β”œβ”€β”€ store.ts           # Store configuration
β”‚   β”‚   └── StoreProvider.tsx  # Store provider
β”‚   β”œβ”€β”€ utils/                 # Utility functions
β”‚   β”‚   β”œβ”€β”€ cn.ts              # Class name utility
β”‚   β”‚   β”œβ”€β”€ formatTimestamp.ts
β”‚   β”‚   β”œβ”€β”€ highlight.ts       # Text highlighting
β”‚   β”‚   └── index.ts
β”‚   β”œβ”€β”€ App.tsx                # Main App component
β”‚   β”œβ”€β”€ main.tsx               # Application entry point
β”‚   β”œβ”€β”€ index.css              # Global styles
β”‚   └── test-setup.ts          # Test configuration
β”œβ”€β”€ .eslintrc.js               # ESLint configuration
β”œβ”€β”€ .gitignore                 # Git ignore rules
β”œβ”€β”€ cypress.config.js          # Cypress configuration
β”œβ”€β”€ index.html                 # HTML template
β”œβ”€β”€ package.json               # Dependencies and scripts
β”œβ”€β”€ pnpm-lock.yaml             # Lock file
β”œβ”€β”€ pnpm-workspace.yaml        # Workspace configuration
β”œβ”€β”€ tsconfig.json              # TypeScript configuration
β”œβ”€β”€ tsconfig.app.json          # App-specific TS config
β”œβ”€β”€ tsconfig.node.json         # Node-specific TS config
β”œβ”€β”€ vite.config.ts             # Vite configuration
└── vitest.config.ts           # Vitest configuration

πŸ”§ Configuration

Environment Variables

No environment variables are required for basic functionality. The application uses public APIs.

API Endpoints

The application integrates with the following public APIs:

  • Cat Facts: https://catfact.ninja/fact
  • Chuck Norris Jokes: https://api.chucknorris.io/jokes/random
  • Bored API: https://www.boredapi.com/api/activity
  • GitHub Users: https://api.github.com/search/users
  • Weather: https://api.open-meteo.com/v1/forecast

πŸš€ Deployment

Vercel (Recommended)

  1. Connect your repository to Vercel
  2. Vercel will automatically detect the Vite configuration
  3. Deploy with default settings

Manual Deployment

# Build the application
pnpm build

# The built files will be in the `dist/` directory
# Deploy the contents of `dist/` to your hosting provider

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow the existing code style and structure
  • Write tests for new features
  • Update documentation as needed
  • Use conventional commit messages

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

If you encounter any issues or have questions:

  1. Check the existing issues in the repository
  2. Create a new issue with detailed information
  3. Include steps to reproduce the problem

πŸ”„ CI/CD Pipeline

The project includes a comprehensive CI/CD pipeline with the following stages:

  1. Lint: Code quality checks
  2. Test: Unit and integration tests with coverage
  3. Build: Production build verification
  4. E2E: End-to-end testing with Cypress

The pipeline runs on every push and pull request to ensure code quality and functionality.

CI/CD Pipeline

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages