2 Commits

Author SHA1 Message Date
cfcc91a670 Merge branch 'feature/m1-setup' - M1 project foundation setup
Some checks failed
CI / test (push) Has been cancelled
2026-06-24 23:47:40 +02:00
9253164fd3 feat(m1): project foundation setup - Next.js 15, Tailwind, tooling, CI
- Configure Next.js 15 (App Router, Node.js runtime, serverExternalPackages for better-sqlite3/bcrypt)

- Add Tailwind CSS, PostCSS, tsconfig with @/* alias

- Create app structure (layout, page, globals.css)

- Create directory structure (lib, repositories, services, components, tests)

- Configure Vitest (alias, coverage), Playwright

- Add dependencies: next, react, better-sqlite3, bcrypt, react-markdown, etc.

- Add .env.example, CI workflow, next-env.d.ts

- Remove boilerplate src/example files
2026-06-24 23:47:27 +02:00
18 changed files with 12229 additions and 130 deletions

8
.env.example Normal file
View File

@ -0,0 +1,8 @@
# SQLite database file path
SQLITE_PATH=./data/app.db
# Session secret for signing session cookies
SESSION_SECRET=change-me-in-production
# Uploads directory path
UPLOADS_PATH=./data/uploads

20
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '24'
- run: npm ci
- run: npm run lint
- run: npm run typecheck
- run: npm test
- run: npm run build

View File

@ -12,3 +12,7 @@ node_modules/
# ビルド成果物 # ビルド成果物
dist/ dist/
.next/
# Next.js auto-generated
next-env.d.ts

3
app/globals.css Normal file
View File

@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

20
app/layout.tsx Normal file
View File

@ -0,0 +1,20 @@
import type { Metadata } from 'next';
import './globals.css';
export const metadata: Metadata = {
title: 'シンプルグループウェア',
description:
'プロジェクト単位で情報共有・タスク管理を行えるチームコラボレーションツール',
};
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="ja">
<body>{children}</body>
</html>
);
}

10
app/page.tsx Normal file
View File

@ -0,0 +1,10 @@
export default function Home() {
return (
<main className="flex min-h-screen flex-col items-center justify-center p-8">
<h1 className="text-3xl font-bold"></h1>
<p className="mt-4 text-gray-600">
</p>
</main>
);
}

View File

@ -18,6 +18,16 @@ export default tseslint.config(
}, },
}, },
{ {
ignores: ['node_modules/**', 'dist/**', '.steering/**'], ignores: [
'node_modules/**',
'dist/**',
'.next/**',
'.steering/**',
'data/**',
'backups/**',
'playwright-report/**',
'test-results/**',
'next-env.d.ts',
],
} }
); );

6
next-env.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference path="./.next/types/routes.d.ts" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

6
next.config.mjs Normal file
View File

@ -0,0 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
serverExternalPackages: ['better-sqlite3', 'bcrypt'],
};
export default nextConfig;

12031
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +1,58 @@
{ {
"name": "opencode-spec-driven-boilerplate", "name": "opengroupware",
"version": "0.1.0", "version": "0.1.0",
"description": "Spec-driven development boilerplate for opencode", "description": "Simple project-based groupware built with Next.js 15, TypeScript, and SQLite",
"type": "module", "type": "module",
"scripts": { "scripts": {
"prepare": "husky", "prepare": "husky",
"build": "tsc", "dev": "next dev",
"dev": "tsc --watch", "build": "next build",
"start": "next start",
"lint": "eslint .", "lint": "eslint .",
"format": "npx prettier --write .", "format": "prettier --write .",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"test": "vitest run", "test": "vitest run",
"test:watch": "vitest", "test:watch": "vitest",
"test:e2e": "playwright test",
"test:coverage": "vitest run --coverage", "test:coverage": "vitest run --coverage",
"test:ui": "vitest --ui" "migrate": "tsx lib/db/run-migrations.ts"
}, },
"keywords": [ "keywords": [
"spec-driven-development", "groupware",
"opencode", "nextjs",
"template" "sqlite"
], ],
"author": "", "author": "Ken Yasue",
"license": "MIT", "license": "MIT",
"dependencies": {
"bcrypt": "^5.1.1",
"better-sqlite3": "^11.3.0",
"next": "^15.1.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-markdown": "^9.0.1",
"rehype-sanitize": "^6.0.0",
"remark-gfm": "^4.0.0"
},
"devDependencies": { "devDependencies": {
"@playwright/test": "^1.49.0",
"@types/bcrypt": "^5.0.2",
"@types/better-sqlite3": "^7.6.11",
"@types/node": "^20.11.0", "@types/node": "^20.11.0",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@vitest/coverage-v8": "^2.0.0", "@vitest/coverage-v8": "^2.0.0",
"@vitest/ui": "^2.0.0", "@vitest/ui": "^2.0.0",
"autoprefixer": "^10.4.20",
"eslint": "^9.0.0", "eslint": "^9.0.0",
"eslint-config-next": "^15.1.0",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^9.1.0",
"husky": "^9.0.0", "husky": "^9.0.0",
"lint-staged": "^15.2.0", "lint-staged": "^15.2.0",
"postcss": "^8.4.49",
"prettier": "^3.2.0", "prettier": "^3.2.0",
"tailwindcss": "^3.4.15",
"tsx": "^4.19.2",
"typescript": "~5.3.0", "typescript": "~5.3.0",
"typescript-eslint": "^8.0.0", "typescript-eslint": "^8.0.0",
"vitest": "^2.0.0" "vitest": "^2.0.0"

26
playwright.config.ts Normal file
View File

@ -0,0 +1,26 @@
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests/e2e',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: 'html',
use: {
baseURL: 'http://localhost:3000',
trace: 'on-first-retry',
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
webServer: {
command: 'npm run dev',
url: 'http://localhost:3000',
reuseExistingServer: !process.env.CI,
timeout: 120 * 1000,
},
});

9
postcss.config.mjs Normal file
View File

@ -0,0 +1,9 @@
/** @type {import('postcss-load-config').Config} */
const config = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
export default config;

View File

@ -1,93 +0,0 @@
import { describe, it, expect } from 'vitest';
import { add, subtract, multiply, divide } from './example';
describe('Math operations', () => {
describe('add', () => {
it('正の数を足すと正しい結果が返る', () => {
// Given: 準備
const a = 2;
const b = 3;
// When: 実行
const result = add(a, b);
// Then: 検証
expect(result).toBe(5);
});
it('負の数を足すと正しい結果が返る', () => {
// Given: 準備
const a = -2;
const b = 3;
// When: 実行
const result = add(a, b);
// Then: 検証
expect(result).toBe(1);
});
});
describe('subtract', () => {
it('正の数を引くと正しい結果が返る', () => {
// Given: 準備
const a = 5;
const b = 3;
// When: 実行
const result = subtract(a, b);
// Then: 検証
expect(result).toBe(2);
});
});
describe('multiply', () => {
it('正の数をかけると正しい結果が返る', () => {
// Given: 準備
const a = 2;
const b = 3;
// When: 実行
const result = multiply(a, b);
// Then: 検証
expect(result).toBe(6);
});
it('0をかけると0が返る', () => {
// Given: 準備
const a = 5;
const b = 0;
// When: 実行
const result = multiply(a, b);
// Then: 検証
expect(result).toBe(0);
});
});
describe('divide', () => {
it('正の数で割ると正しい結果が返る', () => {
// Given: 準備
const a = 6;
const b = 3;
// When: 実行
const result = divide(a, b);
// Then: 検証
expect(result).toBe(2);
});
it('0で割るとエラーをスローする', () => {
// Given: 準備
const a = 5;
const b = 0;
// When/Then: 実行と検証
expect(() => divide(a, b)).toThrow('Division by zero is not allowed');
});
});
});

View File

@ -1,18 +0,0 @@
export function add(a: number, b: number): number {
return a + b;
}
export function subtract(a: number, b: number): number {
return a - b;
}
export function multiply(a: number, b: number): number {
return a * b;
}
export function divide(a: number, b: number): number {
if (b === 0) {
throw new Error('Division by zero is not allowed');
}
return a / b;
}

14
tailwind.config.ts Normal file
View File

@ -0,0 +1,14 @@
import type { Config } from 'tailwindcss';
const config: Config = {
content: [
'./app/**/*.{js,ts,jsx,tsx,mdx}',
'./components/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
extend: {},
},
plugins: [],
};
export default config;

View File

@ -1,22 +1,33 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES2022", "target": "ES2022",
"lib": ["dom", "dom.iterable", "ES2022"],
"module": "ESNext", "module": "ESNext",
"lib": ["ES2022"],
"moduleResolution": "bundler", "moduleResolution": "bundler",
"resolveJsonModule": true, "resolveJsonModule": true,
"allowJs": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"esModuleInterop": true, "esModuleInterop": true,
"outDir": "./dist", "isolatedModules": true,
"rootDir": "./src", "jsx": "preserve",
"incremental": true,
"noEmit": true,
"strict": true, "strict": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"skipLibCheck": true, "skipLibCheck": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"types": ["vitest/globals"] "plugins": [{ "name": "next" }],
"paths": {
"@/*": ["./*"]
}
}, },
"include": ["src/**/*"], "include": [
"exclude": ["node_modules", "dist"] "next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": ["node_modules", "dist", ".next", "data", "backups"]
} }

View File

@ -1,12 +1,15 @@
import { defineConfig } from 'vitest/config'; import { defineConfig } from 'vitest/config';
import path from 'node:path';
export default defineConfig({ export default defineConfig({
test: { test: {
globals: true, globals: true,
environment: 'node', environment: 'node',
include: [ include: [
'src/**/*.{test,spec}.{ts,tsx}',
'tests/**/*.{test,spec}.{ts,tsx}', 'tests/**/*.{test,spec}.{ts,tsx}',
'lib/**/*.{test,spec}.{ts,tsx}',
'repositories/**/*.{test,spec}.{ts,tsx}',
'services/**/*.{test,spec}.{ts,tsx}',
], ],
coverage: { coverage: {
provider: 'v8', provider: 'v8',
@ -14,9 +17,11 @@ export default defineConfig({
exclude: [ exclude: [
'node_modules/**', 'node_modules/**',
'dist/**', 'dist/**',
'.next/**',
'.steering/**', '.steering/**',
'**/*.config.{ts,js}', '**/*.config.{ts,js,mjs}',
'**/types/**', '**/types/**',
'tests/**',
], ],
thresholds: { thresholds: {
branches: 80, branches: 80,
@ -26,4 +31,9 @@ export default defineConfig({
}, },
}, },
}, },
resolve: {
alias: {
'@': path.resolve(__dirname, '.'),
},
},
}); });