A modern infinite scroll implementation built with SvelteKit that demonstrates seamless data loading and user experience patterns.
š Live Demo: https://infinite-scroll.cybernaut.app/
src/
āāā lib/
ā āāā components/
ā ā āāā custom/bento/ # Bento box components
ā ā āāā ui/skeleton/ # Loading skeleton components
ā āāā hooks/ # Custom Svelte hooks
ā āāā utils.ts # Utility functions
āāā routes/
ā āāā +layout.svelte # App layout
ā āāā +page.svelte # Main page
ā āāā +page.server.ts # Server actions
āāā types/
āāā post.ts # TypeScript interfaces
The main infinite scroll container that:
Individual item component featuring:
Clone the repository
git clone <repository-url>
cd infinite-scroll-demo
Install dependencies
pnpm install
Start the development server
pnpm dev
Open http://localhost:5173 in your browser
pnpm build
The project includes a multi-stage Dockerfile for production deployment:
# Run the container
docker run -p 3000:3000 ghcr.io/garrettpfoy/infinite-scroll-demo:latest
Key configuration options in +page.svelte
:
let limit = $state(10); // Initial posts to load
let increment = 3; // Posts to load on each scroll
let offset = $state(0); // Current offset for pagination
The demo uses the DummyJSON API for sample data. The server action in +page.server.ts
handles:
This project is open source and available under the MIT License.