A refined, single-page data visualization application built with SvelteKit, featuring modern UI components and interactive charts powered by Observable Plot.
The Simple Data Dashboard is a minimal yet elegant web application that visualizes monthly sales data across multiple distribution channels. The project demonstrates:
Perfect as a learning project, portfolio piece, or foundation for more complex dashboards.
simple-data-dashboard/
βββ src/
β βββ routes/
β β βββ +layout.svelte # Root layout
β β βββ +page.svelte # Main dashboard page
β βββ lib/
β β βββ components/
β β β βββ ui/ # Reusable UI components
β β β βββ Card.svelte
β β β βββ CardHeader.svelte
β β β βββ CardContent.svelte
β β β βββ Select.svelte
β β βββ charts.ts # Observable Plot configurations
β β βββ data.ts # Data loading & transformations
β β βββ types.ts # TypeScript type definitions
β βββ app.css # Global styles & Tailwind
β βββ app.d.ts # TypeScript declarations
βββ static/
β βββ data/
β βββ sales.csv # Sample dataset
βββ svelte.config.js # SvelteKit configuration
βββ tailwind.config.js # Tailwind CSS configuration
βββ vite.config.ts # Vite configuration
βββ tsconfig.json # TypeScript configuration
βββ package.json # Dependencies & scripts
Clone or download the project
cd simple-data-dashboard
Install dependencies
npm install
Start the development server with hot module replacement:
npm run dev
The application will be available at:
Build the application for production:
npm run build
Preview the production build:
npm run preview
The optimized application will be available at http://localhost:4173
The dashboard expects CSV data in the following format:
month,value,category
Jan,120,Online
Feb,90,Online
Mar,140,Store
static/data/sales.csvEdit the CSS variables in src/app.css:
:root {
--background: 28 15% 8%; /* Dark background */
--foreground: 30 15% 95%; /* Light text */
--primary: 38 70% 65%; /* Golden accent */
--accent: 185 65% 55%; /* Teal highlight */
/* ... */
}
Change fonts in tailwind.config.js:
fontFamily: {
display: ['Playfair Display', 'serif'],
body: ['Crimson Pro', 'serif'],
mono: ['JetBrains Mono', 'monospace'],
}
Modify chart settings in src/lib/charts.ts:
export function createBarChart(data: Sale[], container: HTMLElement) {
const chart = Plot.plot({
height: 400, // Adjust height
marginLeft: 60, // Adjust margins
// Customize colors, tooltips, etc.
});
}
<script>
import Card from '$lib/components/ui/Card.svelte';
import CardHeader from '$lib/components/ui/CardHeader.svelte';
import CardContent from '$lib/components/ui/CardContent.svelte';
</script>
<Card>
<CardHeader>
<h2>Chart Title</h2>
</CardHeader>
<CardContent>
<!-- Your content here -->
</CardContent>
</Card>
<script>
import Select from '$lib/components/ui/Select.svelte';
let selectedValue = 'option1';
const options = [
{ value: 'option1', label: 'Option 1' },
{ value: 'option2', label: 'Option 2' },
];
</script>
<Select bind:value={selectedValue} {options} />
All data structures are fully typed:
// src/lib/types.ts
export type Sale = {
month: string;
value: number;
category: string;
};
export type Category = 'Online' | 'Store' | 'Wholesale' | 'All';
Future enhancements (currently out of scope):
# Kill the process using port 5173
npx kill-port 5173
# Or use a different port
npm run dev -- --port 3000
# Clear node_modules and reinstall
rm -rf node_modules package-lock.json
npm install
| Command | Description |
|---|---|
npm run dev |
Start development server with HMR |
npm run build |
Build for production |
npm run preview |
Preview production build locally |
This is a learning project, but improvements are welcome:
MIT License - Feel free to use this project for learning or as a foundation for your own work.
For questions or issues:
Built with β€οΈ using SvelteKit, TypeScript, and Tailwind CSS