A high-performance todo application built with ElysiaJS, Bun, React, and WebAssembly (WASM).
- Fast Backend: Powered by ElysiaJS and Bun for blazing-fast API responses
- Modern React UI: Beautiful, responsive interface with smooth interactions
- WebAssembly Integration: High-performance todo filtering and sorting using WASM
- Full CRUD Operations: Create, Read, Update, and Delete todos
- Advanced Filtering: Filter by completion status and priority
- Flexible Sorting: Sort by creation date, update date, title, or priority
- Priority Management: Organize todos with low, medium, and high priorities
- Real-time Updates: Instant feedback on all operations
- ElysiaJS: Fast and ergonomic web framework for Bun
- Bun: Ultra-fast JavaScript runtime and package manager
- TypeScript for type safety
- React 18: Modern UI library with hooks
- Vite: Lightning-fast build tool and dev server
- TypeScript: Full type safety across the application
- WebAssembly: AssemblyScript-compiled WASM for efficient data operations
- Optimized sorting and filtering algorithms
bun-todo/
├── backend/ # ElysiaJS API server
│ ├── src/
│ │ └── index.ts # Main server file with routes
│ ├── package.json
│ └── tsconfig.json
├── frontend/ # React application
│ ├── public/
│ │ └── wasm/ # WASM modules
│ ├── src/
│ │ ├── App.tsx # Main React component
│ │ ├── App.css # Styles
│ │ ├── api.ts # API client
│ │ ├── types.ts # TypeScript definitions
│ │ ├── useWasm.ts # WASM hook
│ │ └── main.tsx # Entry point
│ ├── index.html
│ ├── package.json
│ └── vite.config.ts
├── wasm/ # WebAssembly module
│ ├── src/
│ │ └── index.ts # AssemblyScript source
│ ├── build/ # Compiled WASM output
│ ├── package.json
│ └── asconfig.json
└── package.json # Root workspace config
- Bun v1.3.2 or higher
- Clone the repository:
git clone <repository-url>
cd bun-todo- Install dependencies:
bun install- Build the WASM module:
bun run build:wasmStart both backend and frontend concurrently:
bun run devOr run them separately:
Backend only:
bun run dev:backendThe API will be available at http://localhost:3000
Frontend only:
bun run dev:frontendThe UI will be available at http://localhost:5173
Build all components:
bun run buildStart the production server:
bun run startGet all todos with optional filtering and sorting.
Query Parameters:
completed(boolean): Filter by completion statuspriority(string): Filter by priority (low, medium, high)sortBy(string): Sort field (createdAt, updatedAt, title, priority)sortOrder(string): Sort order (asc, desc)
Example:
curl "http://localhost:3000/todos?completed=false&priority=high&sortBy=createdAt&sortOrder=desc"Create a new todo.
Body:
{
"title": "Learn WASM",
"description": "Build a WASM module",
"priority": "high"
}Example:
curl -X POST http://localhost:3000/todos \
-H "Content-Type: application/json" \
-d '{"title":"Learn WASM","priority":"high"}'Update an existing todo.
Body:
{
"title": "Updated title",
"description": "Updated description",
"completed": true,
"priority": "medium"
}Example:
curl -X PUT http://localhost:3000/todos/1 \
-H "Content-Type: application/json" \
-d '{"completed":true}'Delete a todo.
Example:
curl -X DELETE http://localhost:3000/todos/1Health check endpoint.
The WASM module (written in AssemblyScript) provides high-performance operations:
- Efficient filtering: Filter todos by completion status and priority
- Optimized sorting: QuickSort implementation for large datasets
- Memory management: Efficient array operations
- Statistics calculation: Fast computation of todo statistics
The WASM module is compiled from AssemblyScript, which provides a TypeScript-like syntax that compiles to WebAssembly for near-native performance.
The backend uses ElysiaJS, which provides:
- Fast routing with type safety
- Built-in request validation
- CORS support
- JSON serialization
Edit backend/src/index.ts to modify API routes and logic.
The frontend is built with React and uses:
- Functional components with hooks
- TypeScript for type safety
- CSS-in-CSS styling with modern features
- Responsive design
Edit files in frontend/src/ to modify the UI.
The WASM module uses AssemblyScript:
- Write TypeScript-like code
- Compile to optimized WASM
- Import in React for high-performance operations
Edit wasm/src/index.ts and rebuild:
cd wasm
bun run build- Bun Runtime: Uses Bun's fast JavaScript engine for server-side operations
- ElysiaJS: Optimized routing and request handling
- WASM: Critical operations compiled to WebAssembly
- Vite: Fast HMR and optimized production builds
- In-memory Storage: Quick data access (can be upgraded to SQLite)
If you encounter issues with dependencies, install them in each workspace:
bun install
cd backend && bun install && cd ..
cd frontend && bun install && cd ..
cd wasm && bun install && cd ..If the WASM build fails, ensure AssemblyScript is installed:
cd wasm
bun install
bun run buildThe build uses bun x assemblyscript which automatically downloads and runs the compiler.
Make sure you're running commands from the root directory:
cd /path/to/bun-todo
./start.sh
# or
bun run devIf port 3000 or 5173 is already in use, you can modify:
- Backend port: Edit
backend/src/index.tsline 207 (.listen(3000)) - Frontend port: Edit
frontend/vite.config.tsline 6 (port: 5173)
Make sure the backend is running on port 3000, or update the API base URL in frontend/src/api.ts line 3.
- Add SQLite database for persistent storage
- Implement user authentication
- Add todo categories/tags
- Enable drag-and-drop reordering
- Add due dates and reminders
- Implement search functionality
- Add dark/light theme toggle
- Create mobile app with React Native
- Add real-time sync with WebSockets
Contributions are welcome! Please feel free to submit a Pull Request.
MIT
- Bun - Fast all-in-one JavaScript runtime
- ElysiaJS - Ergonomic web framework
- React - UI library
- AssemblyScript - TypeScript to WASM compiler
- Vite - Next generation frontend tooling
Built with ❤️ using Bun, ElysiaJS, React, and WebAssembly