A monorepo template for web application development using Bun. This template adopts a simplified clean architecture directory structure that eliminates anti-patterns. A Todo list is implemented as a usage example.
.
├── frontend/ # SvelteKit frontend
│ ├── src/
│ │ ├── lib/ # Components and utilities
│ │ │ ├── components/ # UI components
│ │ ├── routes/ # Application routes
│ │ └── app.css # Global styles and theme variables
├── backend/ # Hono.js backend
│ ├── src/
│ │ ├── application/ # Application layer
│ │ ├── domain/ # Domain layer
│ │ ├── infrastructure/ # Infrastructure layer
│ │ └── presentation/ # Presentation layer
├── database/ # Database related
│ ├── schema/ # Drizzle ORM schema
│ ├── migrations/ # Migration files
├── shared/ # Shared code
├── tools/ # Development tools
├── docker/ # Docker configuration (planned)
└── workflows/ # CI/CD configuration (planned)
format:code changes → lint → Unit Test → Integrated Test → E2E Test → Build → Deploy
プロジェクトは以下のGitHub Actionsワークフローを使用しています:
継続的インテグレーション/デプロイ
エンドツーエンドテスト
アプリケーションはDockerを使用して簡単に実行できます:
# Docker Composeを使用して全サービスを起動(Linux/macOS)
docker compose up
# Windowsでの実行(デバッグスクリプト付き)
bun run docker:dev:windows
# バックグラウンドで起動
docker compose up -d
# 特定のサービスのみ起動
docker compose up frontend backend
# ログを表示
docker compose logs -f
# 環境を停止
docker compose down
Windows環境でDockerを使用する場合は、以下の点に注意してください:
bun run docker:debug
CLAUDE.md
の「Windows環境でのDocker使用方法」セクションを参照よくある問題:
開発環境ではローカルSQLiteデータベースを使用しますが、本番環境ではTursoクラウドデータベースを使用することをお勧めします。.env
ファイルで適切なTurso接続情報を設定してください。
The project includes a comprehensive test suite for both frontend and backend:
# Run all tests (backend and frontend)
bun run test:all
# Run only backend tests
bun run test:backend
# Run only frontend tests
bun run test:frontend
# Run E2E tests
bun run test:e2e
# Run tests with coverage
bun run test:coverage
@testing-library/svelte
If tests fail with warnings about deprecated Svelte event handlers, ensure that:
on:event
directives have been updated to Svelte 5's new onevent
attribute format# Clone the repository
git clone <repository-url>
cd <repository-name>
# Install dependencies
bun install
Create a .env
file in the project root with the following variables:
# Backend server port
PORT=3000
BACKEND_URL=http://localhost:${PORT}
# API base URL
API_BASE_URL=${BACKEND_URL}/api
# Frontend URL (for CORS)
PORT_FRONTEND=5173
FRONTEND_URL=http://localhost:${PORT_FRONTEND}
# Turso Database URL
DATABASE_URL=libsql://your-database-url
DATABASE_AUTH_TOKEN=your-auth-token
# Run database migrations
cd database
bun run migrate
# Start the frontend development server
cd frontend
bun run dev
# Start the backend development server
cd backend
bun run dev
# Or run everything from the root (requires Turbo)
bun run dev
You can test the API using PowerShell:
# Get all todos
Invoke-RestMethod -Method GET -Uri "http://localhost:3000/api/todos"
# Create a todo
Invoke-RestMethod -Method POST -Uri "http://localhost:3000/api/todos" -ContentType "application/json" -Body '{"title":"New task"}'
# Update a todo
Invoke-RestMethod -Method PUT -Uri "http://localhost:3000/api/todos/{id}" -ContentType "application/json" -Body '{"completed":true}'
# Delete a todo
Invoke-RestMethod -Method DELETE -Uri "http://localhost:3000/api/todos/{id}"
The application uses a centralized theme system with CSS custom properties:
:root {
/* Light mode variables */
--color-bg-primary: #f9fafb;
--color-text-primary: #111827;
/* ...other variables */
}
.dark {
/* Dark mode variables */
--color-bg-primary: #1e1e1e;
--color-text-primary: #f9fafb;
/* ...other variables */
}
For standard styles:
<div class="bg-theme-primary text-theme-secondary"></div>
For hover effects (important):
<!-- Correct way to use theme variables with hover effects -->
<button class="hover:bg-[var(--color-bg-button-hover)]">Button</button>
MIT
This project is currently under active development. The following components are implemented:
The following components are planned or in progress: