A customizable Notion-style avatar editor built with Svelte 5, featuring a clean, responsive UI and modern state management.
Live Demo: notion-avatar-svelte.vercel.app
macOS and Linux
Linux users — The
unzip
package is required to install Bun. Usesudo apt install unzip
to installunzip
package. Kernel version 5.6 or higher is strongly recommended, but the minimum is 5.1. Useuname -r
to check Kernel version.
# macOS, Linux, and WSL
curl -fsSL https://bun.sh/install | bash
# To install a specific version
curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.13"
Windows
# PowerShell/cmd.exe
powershell -c "irm bun.sh/install.ps1|iex"
Bun requires a minimum of Windows 10 version 1809. For support and discussion, please join the #windows channel on the Bun Discord.
git clone https://github.com/stickerdaniel/notion-avatar-svelte
cd notion-avatar-svelte
Or download and extract the zip file.
# Install dependencies
bun install
The project includes VSCode tasks for common operations:
Cmd+Shift+B
(macOS) or Ctrl+Shift+B
(Windows/Linux) to run the default build taskAlternatively, open the Command Palette (Cmd+Shift+P
or Ctrl+Shift+P
) and type "Run Task", then select "bun dev (run dev server)".
# Start the development server
bun run dev
# Or start the server and open in a browser
bun run dev -- --open
The application will be available at http://localhost:5173/
.
The application uses a modern state management approach with Svelte 5 Runes and the Runed library:
// Class-based store with Svelte 5 Runes
export class AvatarStoreClass implements IAvatar {
// Reactive state with $state rune
configJSON = $state<string>('');
// Derived state with $derived rune
previewConfig = $derived<AvatarConfiguration>(this._parseConfigJSON());
// History tracking with Runed
private _history: StateHistory<string>;
}
Key aspects of the state management:
configJSON
string is the core state that drives everything$derived
reactively update when dependencies changeStateHistory
class from Runed provides undo/redo functionalityContext
systemThe UI is built with shadcn-svelte components:
The project uses Tailwind CSS with customizable themes via shadcn-svelte:
src/app.css
file to apply your custom theme variablestailwind.config.ts
file to extend or modify the theme furtherTo add new avatar parts:
static/avatar-creator/part/[category]/[category]-[index].svg
static/avatar-creator/preview/[category]/[index].svg
DEFAULT_CATEGORIES
array in src/lib/components/ui/avatar-creator/types.ts
# Build the application
bun run build
# Preview the production build
bun run preview
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Note: This project is not affiliated with Notion. The avatar style is inspired by Notion's UI.