This app is a simple React demo for @devisfuture/mega-collection.
It shows how to work with a large list of users, around 100,000 items, without making the page feel frozen.
A live version is here: demo
The app has a few pages.
Searchsearches users by text.Search Nestedsearches normal fields and nested order fields.Filterfilters users by city and age.Filter Nestedfilters users by city, age, and nested order status.Sortsorts users by name, city, or age.Mergecombines search, filter, and sort.Merge Nesteddoes the same, but also works with nested order data.
All pages use the same big demo data.
This project uses a few small tools together:
Reactfor the UI.Viteto run and build the app.TypeScriptfor types.react-router-domfor page routing.Tailwind CSSfor styles.@devisfuture/mega-collectionfor search, filter, sort, and merge logic.react-windowto render only visible list items.react-virtualized-auto-sizerto measure list size automatically.
Creating 100,000 records and building all search and filter modules can take time.
If all of that runs right away during import, the first page load feels slow.
So this app does it in the background:
- The app opens quickly.
- A spinner is shown.
- Navigation is locked while data is loading.
- The big user list is created step by step.
- Search, filter, sort, and merge modules are created one time.
- When everything is ready, navigation becomes active.
The app has one shared loader for all demo pages.
- Data is created asynchronously.
- The data is built in small chunks, not all at once.
- Ready objects are saved in shared
Mapobjects. - The initialization runs only one time.
- Every route reads ready modules from the shared state.
This means the app does not rebuild the same large data again and again when you open different pages.
The demo shows these engines:
TextSearchEnginefor text search.FilterEnginefor filtering by selected values.SortEnginefor sorting data.MergeEnginesfor chaining search, filter, and sort together.
The nested pages also work with orders.status.
Even if the data work is fast, showing 100,000 cards in the browser is still too much.
So the app uses virtualization.
That means:
- the full array stays in memory
- but only a small part of the list is rendered on screen
- scrolling stays smooth
- the DOM stays small
src/
components/ reusable UI parts
data/ demo data builders
modules/ shared async initialization and module storage
routes/ demo pages
App.tsx main app layout and loading flow
main.tsx app entry
src/App.tsxstarts the one-time app initialization, shows the spinner, and locks navigation until the data is ready.src/modules/demo-modules.tsxbuilds all shared datasets and engine objects, stores them inMap, and shares them through React context.src/data/users.tscreates the large demo datasets in async chunks.src/routes/*reads ready modules from the shared state and uses them on each page.
These pages use TextSearchEngine.
You type text, and the app finds matching users.
The nested search page can also search inside orders.status.
These pages use FilterEngine.
You click buttons for city, age, or order status, and the list updates.
This page uses SortEngine.
You choose a field and a direction, and the list is sorted.
These pages use MergeEngines.
They let you search, filter, and sort in one place.
Install packages:
npm installStart the dev server:
npm run devBuild the app:
npm run build