@totaland/create-starter-kit 1.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +130 -18
- package/bin/index.js +109 -21
- package/package.json +2 -2
- package/templates/backend/.github/agents/ /360/237/216/255 planner.agent.md" +92 -0
- package/templates/backend/.github/agents/api-architect.agent.md +41 -0
- package/templates/backend/.github/agents/code-reviewer.agent.md +26 -0
- package/templates/backend/.github/agents/code-simplifier.agent.md +41 -0
- package/templates/backend/.github/agents/code-skeptic.agent.md +74 -0
- package/templates/backend/.github/agents/docs-specialist.agent.md +25 -0
- package/templates/backend/.github/agents/implementation-plan.agent.md +160 -0
- package/templates/backend/.github/agents/janitor.agent.md +90 -0
- package/templates/backend/.github/agents/ms-sql-dba.agent.md +25 -0
- package/templates/backend/.github/agents/plan.agent.md +115 -0
- package/templates/backend/.github/agents/planner.agent.md +15 -0
- package/templates/backend/.github/agents/playwright-tester.agent.md +13 -0
- package/templates/backend/.github/agents/postgresql-dba.agent.md +18 -0
- package/templates/backend/.github/agents/prd.agent.md +202 -0
- package/templates/backend/.github/agents/research-technical-spike.agent.md +170 -0
- package/templates/backend/.github/agents/software-engineer-agent-v1.agent.md +165 -0
- package/templates/backend/.github/agents/task-planner.agent.md +375 -0
- package/templates/backend/.github/agents/task-researcher.agent.md +255 -0
- package/templates/backend/.github/agents/tdd-green.agent.md +60 -0
- package/templates/backend/.github/agents/tdd-red.agent.md +60 -0
- package/templates/backend/.github/agents/tdd-refactor.agent.md +85 -0
- package/templates/backend/.github/agents/tech-debt-remediation-plan.agent.md +50 -0
- package/templates/backend/.github/agents/typescript-mcp-expert.agent.md +91 -0
- package/templates/backend/.github/agents/ultimate-thinking-beastmode.agent.md +644 -0
- package/templates/backend/.github/agents//360/237/216/255 generator.agent.md" +264 -0
- package/templates/backend/.github/agents//360/237/216/255 healer.agent.md" +44 -0
- package/templates/backend/.github/agents//360/237/216/255 pom.agent.md" +308 -0
- package/templates/backend/.github/instructions/a11y.instructions.md +369 -0
- package/templates/backend/.github/instructions/ms-sql-dba.instructions.md +25 -0
- package/templates/backend/.github/instructions/object-calisthenics.instructions.md +302 -0
- package/templates/backend/.github/instructions/performance-optimization.instructions.md +420 -0
- package/templates/backend/.github/instructions/playwright-python.instructions.md +62 -0
- package/templates/backend/.github/instructions/playwright-typescript.instructions.md +86 -0
- package/templates/backend/.github/instructions/security-and-owasp.instructions.md +51 -0
- package/templates/backend/.github/instructions/self-explanatory-code-commenting.instructions.md +162 -0
- package/templates/backend/.github/instructions/spec-driven-workflow-v1.instructions.md +323 -0
- package/templates/backend/.github/instructions/sql-sp-generation.instructions.md +74 -0
- package/templates/backend/.github/instructions/task-implementation.instructions.md +190 -0
- package/templates/backend/.github/instructions/typescript-mcp-server.instructions.md +228 -0
- package/templates/backend/.github/prompts/ai-prompt-engineering-safety-review.prompt.md +229 -0
- package/templates/backend/.github/prompts/architecture-blueprint-generator.prompt.md +321 -0
- package/templates/backend/.github/prompts/breakdown-epic-arch.prompt.md +65 -0
- package/templates/backend/.github/prompts/breakdown-epic-pm.prompt.md +57 -0
- package/templates/backend/.github/prompts/breakdown-feature-implementation.prompt.md +127 -0
- package/templates/backend/.github/prompts/breakdown-feature-prd.prompt.md +60 -0
- package/templates/backend/.github/prompts/breakdown-plan.prompt.md +508 -0
- package/templates/backend/.github/prompts/copilot-instructions-blueprint-generator.prompt.md +293 -0
- package/templates/backend/.github/prompts/create-agentsmd.prompt.md +248 -0
- package/templates/backend/.github/prompts/create-github-issue-feature-from-specification.prompt.md +27 -0
- package/templates/backend/.github/prompts/create-github-issues-feature-from-implementation-plan.prompt.md +27 -0
- package/templates/backend/.github/prompts/create-github-issues-for-unmet-specification-requirements.prompt.md +35 -0
- package/templates/backend/.github/prompts/create-implementation-plan.prompt.md +156 -0
- package/templates/backend/.github/prompts/create-llms.prompt.md +209 -0
- package/templates/backend/.github/prompts/create-specification.prompt.md +126 -0
- package/templates/backend/.github/prompts/create-technical-spike.prompt.md +230 -0
- package/templates/backend/.github/prompts/csharp-nunit.prompt.md +71 -0
- package/templates/backend/.github/prompts/ef-core.prompt.md +76 -0
- package/templates/backend/.github/prompts/folder-structure-blueprint-generator.prompt.md +404 -0
- package/templates/backend/.github/prompts/gen-specs-as-issues.prompt.md +165 -0
- package/templates/backend/.github/prompts/generate-custom-instructions-from-codebase.prompt.md +239 -0
- package/templates/backend/.github/prompts/java-junit.prompt.md +64 -0
- package/templates/backend/.github/prompts/memory-merger.prompt.md +107 -0
- package/templates/backend/.github/prompts/multi-stage-dockerfile.prompt.md +46 -0
- package/templates/backend/.github/prompts/playwright-automation-fill-in-form.prompt.md +29 -0
- package/templates/backend/.github/prompts/playwright-explore-website.prompt.md +19 -0
- package/templates/backend/.github/prompts/playwright-generate-test.prompt.md +19 -0
- package/templates/backend/.github/prompts/postgresql-code-review.prompt.md +214 -0
- package/templates/backend/.github/prompts/postgresql-optimization.prompt.md +406 -0
- package/templates/backend/.github/prompts/project-workflow-analysis-blueprint-generator.prompt.md +294 -0
- package/templates/backend/.github/prompts/prompt-builder.prompt.md +142 -0
- package/templates/backend/.github/prompts/remember.prompt.md +125 -0
- package/templates/backend/.github/prompts/review-and-refactor.prompt.md +15 -0
- package/templates/backend/.github/prompts/sql-code-review.prompt.md +303 -0
- package/templates/backend/.github/prompts/sql-optimization.prompt.md +298 -0
- package/templates/backend/.github/prompts/suggest-awesome-github-copilot-agents.prompt.md +72 -0
- package/templates/backend/.github/prompts/suggest-awesome-github-copilot-chatmodes.prompt.md +71 -0
- package/templates/backend/.github/prompts/suggest-awesome-github-copilot-collections.prompt.md +149 -0
- package/templates/backend/.github/prompts/suggest-awesome-github-copilot-instructions.prompt.md +88 -0
- package/templates/backend/.github/prompts/suggest-awesome-github-copilot-prompts.prompt.md +71 -0
- package/templates/backend/.github/prompts/technology-stack-blueprint-generator.prompt.md +242 -0
- package/templates/backend/.github/prompts/typescript-mcp-server-generator.prompt.md +90 -0
- package/templates/backend/.github/prompts/update-implementation-plan.prompt.md +157 -0
- package/templates/backend/.github/prompts/update-markdown-file-index.prompt.md +76 -0
- package/templates/backend/Project_Folders_Structure_Blueprint.md +529 -0
- package/templates/backend/README.md +99 -0
- package/templates/backend/biome.json +45 -0
- package/{template → templates/backend}/drizzle.config.ts +1 -1
- package/{template → templates/backend}/package.json +9 -4
- package/templates/backend/pnpm-lock.yaml +4240 -0
- package/templates/backend/src/features/health/health.test.ts +23 -0
- package/{template → templates/backend}/src/features/health/index.ts +1 -0
- package/templates/backend/src/features/health/schemas.ts +29 -0
- package/templates/backend/src/features/orders/controller.ts +18 -0
- package/templates/backend/src/features/orders/index.ts +10 -0
- package/templates/backend/src/features/orders/schemas.ts +62 -0
- package/{template → templates/backend}/src/index.ts +3 -36
- package/templates/backend/src/lib/openapi.ts +25 -0
- package/templates/backend/src/lib/validateRequest.test.ts +84 -0
- package/templates/backend/src/lib/validateRequest.ts +72 -0
- package/{template → templates/backend}/tsconfig.json +2 -2
- package/{template → templates/backend}/vitest.config.ts +8 -1
- package/templates/frontend/.env.example +7 -0
- package/templates/frontend/.github/agents/ /360/237/216/255 planner.agent.md" +92 -0
- package/templates/frontend/.github/agents/api-architect.agent.md +41 -0
- package/templates/frontend/.github/agents/code-reviewer.agent.md +26 -0
- package/templates/frontend/.github/agents/code-simplifier.agent.md +41 -0
- package/templates/frontend/.github/agents/code-skeptic.agent.md +74 -0
- package/templates/frontend/.github/agents/docs-specialist.agent.md +25 -0
- package/templates/frontend/.github/agents/implementation-plan.agent.md +160 -0
- package/templates/frontend/.github/agents/janitor.agent.md +90 -0
- package/templates/frontend/.github/agents/ms-sql-dba.agent.md +25 -0
- package/templates/frontend/.github/agents/plan.agent.md +115 -0
- package/templates/frontend/.github/agents/planner.agent.md +15 -0
- package/templates/frontend/.github/agents/playwright-tester.agent.md +13 -0
- package/templates/frontend/.github/agents/postgresql-dba.agent.md +18 -0
- package/templates/frontend/.github/agents/prd.agent.md +202 -0
- package/templates/frontend/.github/agents/research-technical-spike.agent.md +170 -0
- package/templates/frontend/.github/agents/software-engineer-agent-v1.agent.md +165 -0
- package/templates/frontend/.github/agents/task-planner.agent.md +375 -0
- package/templates/frontend/.github/agents/task-researcher.agent.md +255 -0
- package/templates/frontend/.github/agents/tdd-green.agent.md +60 -0
- package/templates/frontend/.github/agents/tdd-red.agent.md +60 -0
- package/templates/frontend/.github/agents/tdd-refactor.agent.md +85 -0
- package/templates/frontend/.github/agents/tech-debt-remediation-plan.agent.md +50 -0
- package/templates/frontend/.github/agents/typescript-mcp-expert.agent.md +91 -0
- package/templates/frontend/.github/agents/ultimate-thinking-beastmode.agent.md +644 -0
- package/templates/frontend/.github/agents//360/237/216/255 generator.agent.md" +264 -0
- package/templates/frontend/.github/agents//360/237/216/255 healer.agent.md" +44 -0
- package/templates/frontend/.github/agents//360/237/216/255 pom.agent.md" +308 -0
- package/templates/frontend/.github/instructions/a11y.instructions.md +369 -0
- package/templates/frontend/.github/instructions/ms-sql-dba.instructions.md +25 -0
- package/templates/frontend/.github/instructions/object-calisthenics.instructions.md +302 -0
- package/templates/frontend/.github/instructions/performance-optimization.instructions.md +420 -0
- package/templates/frontend/.github/instructions/playwright-python.instructions.md +62 -0
- package/templates/frontend/.github/instructions/playwright-typescript.instructions.md +86 -0
- package/templates/frontend/.github/instructions/security-and-owasp.instructions.md +51 -0
- package/templates/frontend/.github/instructions/self-explanatory-code-commenting.instructions.md +162 -0
- package/templates/frontend/.github/instructions/spec-driven-workflow-v1.instructions.md +323 -0
- package/templates/frontend/.github/instructions/sql-sp-generation.instructions.md +74 -0
- package/templates/frontend/.github/instructions/task-implementation.instructions.md +190 -0
- package/templates/frontend/.github/instructions/typescript-mcp-server.instructions.md +228 -0
- package/templates/frontend/.github/prompts/ai-prompt-engineering-safety-review.prompt.md +229 -0
- package/templates/frontend/.github/prompts/architecture-blueprint-generator.prompt.md +321 -0
- package/templates/frontend/.github/prompts/breakdown-epic-arch.prompt.md +65 -0
- package/templates/frontend/.github/prompts/breakdown-epic-pm.prompt.md +57 -0
- package/templates/frontend/.github/prompts/breakdown-feature-implementation.prompt.md +127 -0
- package/templates/frontend/.github/prompts/breakdown-feature-prd.prompt.md +60 -0
- package/templates/frontend/.github/prompts/breakdown-plan.prompt.md +508 -0
- package/templates/frontend/.github/prompts/copilot-instructions-blueprint-generator.prompt.md +293 -0
- package/templates/frontend/.github/prompts/create-agentsmd.prompt.md +248 -0
- package/templates/frontend/.github/prompts/create-github-issue-feature-from-specification.prompt.md +27 -0
- package/templates/frontend/.github/prompts/create-github-issues-feature-from-implementation-plan.prompt.md +27 -0
- package/templates/frontend/.github/prompts/create-github-issues-for-unmet-specification-requirements.prompt.md +35 -0
- package/templates/frontend/.github/prompts/create-implementation-plan.prompt.md +156 -0
- package/templates/frontend/.github/prompts/create-llms.prompt.md +209 -0
- package/templates/frontend/.github/prompts/create-specification.prompt.md +126 -0
- package/templates/frontend/.github/prompts/create-technical-spike.prompt.md +230 -0
- package/templates/frontend/.github/prompts/csharp-nunit.prompt.md +71 -0
- package/templates/frontend/.github/prompts/ef-core.prompt.md +76 -0
- package/templates/frontend/.github/prompts/folder-structure-blueprint-generator.prompt.md +404 -0
- package/templates/frontend/.github/prompts/gen-specs-as-issues.prompt.md +165 -0
- package/templates/frontend/.github/prompts/generate-custom-instructions-from-codebase.prompt.md +239 -0
- package/templates/frontend/.github/prompts/java-junit.prompt.md +64 -0
- package/templates/frontend/.github/prompts/memory-merger.prompt.md +107 -0
- package/templates/frontend/.github/prompts/multi-stage-dockerfile.prompt.md +46 -0
- package/templates/frontend/.github/prompts/playwright-automation-fill-in-form.prompt.md +29 -0
- package/templates/frontend/.github/prompts/playwright-explore-website.prompt.md +19 -0
- package/templates/frontend/.github/prompts/playwright-generate-test.prompt.md +19 -0
- package/templates/frontend/.github/prompts/postgresql-code-review.prompt.md +214 -0
- package/templates/frontend/.github/prompts/postgresql-optimization.prompt.md +406 -0
- package/templates/frontend/.github/prompts/project-workflow-analysis-blueprint-generator.prompt.md +294 -0
- package/templates/frontend/.github/prompts/prompt-builder.prompt.md +142 -0
- package/templates/frontend/.github/prompts/remember.prompt.md +125 -0
- package/templates/frontend/.github/prompts/review-and-refactor.prompt.md +15 -0
- package/templates/frontend/.github/prompts/sql-code-review.prompt.md +303 -0
- package/templates/frontend/.github/prompts/sql-optimization.prompt.md +298 -0
- package/templates/frontend/.github/prompts/suggest-awesome-github-copilot-agents.prompt.md +72 -0
- package/templates/frontend/.github/prompts/suggest-awesome-github-copilot-chatmodes.prompt.md +71 -0
- package/templates/frontend/.github/prompts/suggest-awesome-github-copilot-collections.prompt.md +149 -0
- package/templates/frontend/.github/prompts/suggest-awesome-github-copilot-instructions.prompt.md +88 -0
- package/templates/frontend/.github/prompts/suggest-awesome-github-copilot-prompts.prompt.md +71 -0
- package/templates/frontend/.github/prompts/technology-stack-blueprint-generator.prompt.md +242 -0
- package/templates/frontend/.github/prompts/typescript-mcp-server-generator.prompt.md +90 -0
- package/templates/frontend/.github/prompts/update-implementation-plan.prompt.md +157 -0
- package/templates/frontend/.github/prompts/update-markdown-file-index.prompt.md +76 -0
- package/templates/frontend/README.md +199 -0
- package/templates/frontend/biome.json +45 -0
- package/templates/frontend/components.json +22 -0
- package/templates/frontend/index.html +13 -0
- package/templates/frontend/package.json +44 -0
- package/templates/frontend/pnpm-lock.yaml +2011 -0
- package/templates/frontend/postcss.config.js +6 -0
- package/templates/frontend/public/vite.svg +1 -0
- package/templates/frontend/src/App.css +42 -0
- package/templates/frontend/src/App.tsx +17 -0
- package/templates/frontend/src/assets/react.svg +1 -0
- package/templates/frontend/src/components/layout/layout.component.tsx +31 -0
- package/templates/frontend/src/components/menu-toggle-icon.tsx +53 -0
- package/templates/frontend/src/components/ui/button.tsx +57 -0
- package/templates/frontend/src/docs/RECOMMENDED_LIBRARIES.md +226 -0
- package/templates/frontend/src/docs/SETUP_SUMMARY.md +162 -0
- package/templates/frontend/src/hooks/use-scroll.ts +21 -0
- package/templates/frontend/src/index.css +121 -0
- package/templates/frontend/src/lib/api-client.ts +46 -0
- package/templates/frontend/src/lib/utils.ts +6 -0
- package/templates/frontend/src/main.tsx +30 -0
- package/templates/frontend/src/pages/about/about.page.tsx +50 -0
- package/templates/frontend/src/pages/home/home.page.tsx +43 -0
- package/templates/frontend/tailwind.config.js +59 -0
- package/templates/frontend/tsconfig.app.json +41 -0
- package/templates/frontend/tsconfig.json +13 -0
- package/templates/frontend/tsconfig.node.json +26 -0
- package/templates/frontend/vite.config.ts +14 -0
- package/template/.env.example +0 -8
- package/template/AGENTS.md +0 -23
- package/template/ARCHITECTURE.md +0 -53
- package/template/ORDER_SYSTEM.md +0 -93
- package/template/biome.json +0 -3
- package/template/src/features/orders/controller.ts +0 -13
- package/template/src/features/orders/index.ts +0 -7
- /package/{template → templates/backend}/knip.json +0 -0
- /package/{template → templates/backend}/playwright.config.ts +0 -0
- /package/{template → templates/backend}/pnpm-workspace.yaml +0 -0
- /package/{template → templates/backend}/src/features/health/controller.ts +0 -0
- /package/{template → templates/backend}/tsconfig.build.json +0 -0
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
# Cybermate API - Project Folder Structure Blueprint
|
|
2
|
+
|
|
3
|
+
> **Auto-detected Project Type:** Node.js/TypeScript Backend API
|
|
4
|
+
> **Framework:** Ultimate Express (Express-based)
|
|
5
|
+
> **Architecture:** Feature-based modular architecture
|
|
6
|
+
> **Monorepo:** No
|
|
7
|
+
> **Microservices:** No
|
|
8
|
+
> **Last Updated:** November 25, 2025
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 1. Structural Overview
|
|
13
|
+
|
|
14
|
+
### Detected Technology Stack
|
|
15
|
+
|
|
16
|
+
| Technology | Version | Purpose |
|
|
17
|
+
|------------|---------|---------|
|
|
18
|
+
| TypeScript | ^5.8.3 | Primary language |
|
|
19
|
+
| Ultimate Express | ^2.0.12 | Web framework |
|
|
20
|
+
| Drizzle ORM | ^0.44.7 | Database ORM (PostgreSQL) |
|
|
21
|
+
| Zod | ^4.1.12 | Schema validation |
|
|
22
|
+
| Vitest | ^4.0.13 | Unit testing |
|
|
23
|
+
| Playwright | - | E2E testing |
|
|
24
|
+
| Biome | 2.0.6 | Linting & formatting |
|
|
25
|
+
| SWC | ^1.10.1 | TypeScript compilation |
|
|
26
|
+
| pnpm | - | Package manager |
|
|
27
|
+
|
|
28
|
+
### Architectural Approach
|
|
29
|
+
|
|
30
|
+
The project follows a **feature-based modular architecture** with clear separation of concerns:
|
|
31
|
+
|
|
32
|
+
1. **Feature Modules**: Self-contained feature folders under `src/features/` that encapsulate routes, controllers, schemas, and tests
|
|
33
|
+
2. **Shared Libraries**: Common utilities and infrastructure in `src/lib/`
|
|
34
|
+
3. **Configuration as Code**: All configuration files at the root level
|
|
35
|
+
4. **Co-located Tests**: Test files placed alongside source files (`*.test.ts`)
|
|
36
|
+
5. **OpenAPI-First Design**: Zod schemas registered with OpenAPI for auto-generated documentation
|
|
37
|
+
|
|
38
|
+
### Organizational Principles
|
|
39
|
+
|
|
40
|
+
- **Vertical Slicing**: Features are organized by domain (health, orders) rather than technical layers
|
|
41
|
+
- **Colocation**: Related files (controller, schemas, tests) live together
|
|
42
|
+
- **Single Responsibility**: Each file has one clear purpose
|
|
43
|
+
- **Explicit Dependencies**: All imports use explicit `.js` extensions for ESM compatibility
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 2. Directory Visualization
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
cybermate-api/
|
|
51
|
+
├── .github/ # GitHub-specific configurations
|
|
52
|
+
│ ├── agents/ # Custom AI agents (22 files)
|
|
53
|
+
│ ├── instructions/ # Copilot instruction files (12 files)
|
|
54
|
+
│ └── prompts/ # Reusable prompt templates (44 files)
|
|
55
|
+
├── .vscode/ # VS Code workspace settings
|
|
56
|
+
│ └── mcp.json # MCP server configuration
|
|
57
|
+
├── build/ # [GENERATED] Compiled JavaScript output
|
|
58
|
+
│ ├── index.js # Compiled entry point
|
|
59
|
+
│ ├── features/ # Compiled feature modules
|
|
60
|
+
│ │ ├── health/
|
|
61
|
+
│ │ └── orders/
|
|
62
|
+
│ └── lib/ # Compiled shared libraries
|
|
63
|
+
├── coverage/ # [GENERATED] Test coverage reports
|
|
64
|
+
│ ├── index.html # Coverage dashboard
|
|
65
|
+
│ ├── features/ # Feature-specific coverage
|
|
66
|
+
│ └── lib/ # Library coverage
|
|
67
|
+
├── src/ # Source code root
|
|
68
|
+
│ ├── index.ts # Application entry point
|
|
69
|
+
│ ├── features/ # Feature modules
|
|
70
|
+
│ │ ├── health/ # Health check feature
|
|
71
|
+
│ │ │ ├── index.ts # Router definition
|
|
72
|
+
│ │ │ ├── controller.ts # Request handlers
|
|
73
|
+
│ │ │ ├── schemas.ts # Zod schemas + OpenAPI registration
|
|
74
|
+
│ │ │ └── health.test.ts # Unit tests
|
|
75
|
+
│ │ └── orders/ # Orders feature
|
|
76
|
+
│ │ ├── index.ts # Router definition
|
|
77
|
+
│ │ ├── controller.ts # Request handlers
|
|
78
|
+
│ │ └── schemas.ts # Zod schemas + OpenAPI registration
|
|
79
|
+
│ └── lib/ # Shared utilities
|
|
80
|
+
│ ├── openapi.ts # OpenAPI registry & generator
|
|
81
|
+
│ ├── validateRequest.ts # Request validation middleware
|
|
82
|
+
│ └── validateRequest.test.ts # Middleware tests
|
|
83
|
+
├── biome.json # Biome linter/formatter config
|
|
84
|
+
├── drizzle.config.ts # Drizzle ORM configuration
|
|
85
|
+
├── knip.json # Unused code detection config
|
|
86
|
+
├── package.json # Project manifest & scripts
|
|
87
|
+
├── playwright.config.ts # Playwright E2E test config
|
|
88
|
+
├── pnpm-lock.yaml # Dependency lock file
|
|
89
|
+
├── pnpm-workspace.yaml # pnpm workspace config
|
|
90
|
+
├── tsconfig.build.json # TypeScript build config
|
|
91
|
+
├── tsconfig.json # TypeScript config
|
|
92
|
+
├── vitest.config.ts # Vitest test runner config
|
|
93
|
+
└── README.md # Project documentation
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 3. Key Directory Analysis
|
|
99
|
+
|
|
100
|
+
### `src/` - Source Code Root
|
|
101
|
+
|
|
102
|
+
The main source directory containing all application code.
|
|
103
|
+
|
|
104
|
+
| Subdirectory | Purpose | Contents |
|
|
105
|
+
|--------------|---------|----------|
|
|
106
|
+
| `features/` | Domain feature modules | Self-contained feature implementations |
|
|
107
|
+
| `lib/` | Shared utilities | Reusable middleware, helpers, OpenAPI setup |
|
|
108
|
+
|
|
109
|
+
### `src/features/` - Feature Modules
|
|
110
|
+
|
|
111
|
+
Each feature is a self-contained module following a consistent internal structure:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
features/{feature-name}/
|
|
115
|
+
├── index.ts # Router definition and route mounting
|
|
116
|
+
├── controller.ts # HTTP request handlers (thin layer)
|
|
117
|
+
├── schemas.ts # Zod validation schemas + OpenAPI registration
|
|
118
|
+
├── service.ts # [Optional] Business logic
|
|
119
|
+
├── repository.ts # [Optional] Database access layer
|
|
120
|
+
├── types.ts # [Optional] TypeScript type definitions
|
|
121
|
+
└── {feature}.test.ts # Unit tests (co-located)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
#### Feature Module Responsibilities
|
|
125
|
+
|
|
126
|
+
| File | Responsibility | Dependencies |
|
|
127
|
+
|------|----------------|--------------|
|
|
128
|
+
| `index.ts` | Export router, wire up routes to handlers | controller, schemas |
|
|
129
|
+
| `controller.ts` | Handle HTTP request/response, delegate to services | service (optional), types |
|
|
130
|
+
| `schemas.ts` | Define and export Zod schemas, register OpenAPI paths | lib/openapi |
|
|
131
|
+
| `service.ts` | Business logic, orchestration | repository (optional) |
|
|
132
|
+
| `repository.ts` | Database operations via Drizzle ORM | drizzle schema |
|
|
133
|
+
| `*.test.ts` | Unit tests for the feature | vitest, feature modules |
|
|
134
|
+
|
|
135
|
+
### `src/lib/` - Shared Libraries
|
|
136
|
+
|
|
137
|
+
Contains cross-cutting utilities used by multiple features:
|
|
138
|
+
|
|
139
|
+
| File | Purpose | Used By |
|
|
140
|
+
|------|---------|---------|
|
|
141
|
+
| `openapi.ts` | OpenAPI registry and document generator | All feature schemas, index.ts |
|
|
142
|
+
| `validateRequest.ts` | Express middleware for Zod-based validation | Feature routers |
|
|
143
|
+
|
|
144
|
+
### `.github/` - GitHub & AI Configuration
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
.github/
|
|
148
|
+
├── agents/ # Custom GitHub Copilot agents
|
|
149
|
+
├── instructions/ # Copilot instruction files (.instructions.md)
|
|
150
|
+
└── prompts/ # Reusable prompt templates (.prompt.md)
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
| Subdirectory | File Pattern | Purpose |
|
|
154
|
+
|--------------|--------------|---------|
|
|
155
|
+
| `agents/` | `*.agent.md` | AI agent personas for specific tasks |
|
|
156
|
+
| `instructions/` | `*.instructions.md` | Coding guidelines and rules |
|
|
157
|
+
| `prompts/` | `*.prompt.md` | Reusable prompt templates |
|
|
158
|
+
|
|
159
|
+
### `build/` - Compiled Output
|
|
160
|
+
|
|
161
|
+
**[AUTO-GENERATED]** - Do not manually edit.
|
|
162
|
+
|
|
163
|
+
Contains JavaScript files compiled by SWC from TypeScript sources. Mirrors the `src/` structure.
|
|
164
|
+
|
|
165
|
+
### `coverage/` - Test Coverage Reports
|
|
166
|
+
|
|
167
|
+
**[AUTO-GENERATED]** - Do not manually edit.
|
|
168
|
+
|
|
169
|
+
Contains HTML and JSON coverage reports generated by Vitest with V8 coverage provider.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 4. File Placement Patterns
|
|
174
|
+
|
|
175
|
+
### Configuration Files
|
|
176
|
+
|
|
177
|
+
| File Type | Location | Example |
|
|
178
|
+
|-----------|----------|---------|
|
|
179
|
+
| TypeScript config | Root | `tsconfig.json`, `tsconfig.build.json` |
|
|
180
|
+
| Build tools | Root | `biome.json`, `vitest.config.ts` |
|
|
181
|
+
| Database config | Root | `drizzle.config.ts` |
|
|
182
|
+
| Test config | Root | `playwright.config.ts`, `vitest.config.ts` |
|
|
183
|
+
| Environment | Root | `.env`, `.env.example` |
|
|
184
|
+
| Package manifest | Root | `package.json` |
|
|
185
|
+
|
|
186
|
+
### Source Code
|
|
187
|
+
|
|
188
|
+
| File Type | Location Pattern | Example |
|
|
189
|
+
|-----------|------------------|---------|
|
|
190
|
+
| Feature router | `src/features/{name}/index.ts` | `src/features/orders/index.ts` |
|
|
191
|
+
| Controllers | `src/features/{name}/controller.ts` | `src/features/orders/controller.ts` |
|
|
192
|
+
| Schemas | `src/features/{name}/schemas.ts` | `src/features/orders/schemas.ts` |
|
|
193
|
+
| Shared utilities | `src/lib/*.ts` | `src/lib/validateRequest.ts` |
|
|
194
|
+
| App entry | `src/index.ts` | `src/index.ts` |
|
|
195
|
+
|
|
196
|
+
### Test Files
|
|
197
|
+
|
|
198
|
+
| Test Type | Location Pattern | Example |
|
|
199
|
+
|-----------|------------------|---------|
|
|
200
|
+
| Unit tests | Co-located with source: `*.test.ts` | `src/features/health/health.test.ts` |
|
|
201
|
+
| Library tests | `src/lib/*.test.ts` | `src/lib/validateRequest.test.ts` |
|
|
202
|
+
| E2E tests | `src/generated/tests/` | Playwright-generated tests |
|
|
203
|
+
|
|
204
|
+
### Documentation
|
|
205
|
+
|
|
206
|
+
| Doc Type | Location | Example |
|
|
207
|
+
|----------|----------|---------|
|
|
208
|
+
| Project README | Root | `README.md` |
|
|
209
|
+
| AI instructions | `.github/instructions/` | `security-and-owasp.instructions.md` |
|
|
210
|
+
| AI prompts | `.github/prompts/` | `create-specification.prompt.md` |
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## 5. Naming and Organization Conventions
|
|
215
|
+
|
|
216
|
+
### File Naming Patterns
|
|
217
|
+
|
|
218
|
+
| Type | Convention | Examples |
|
|
219
|
+
|------|------------|----------|
|
|
220
|
+
| Feature folders | `lowercase-hyphenated` | `user-management/`, `orders/` |
|
|
221
|
+
| TypeScript files | `lowercase-hyphenated.ts` | `controller.ts`, `validate-request.ts` |
|
|
222
|
+
| Test files | `{name}.test.ts` | `health.test.ts`, `validateRequest.test.ts` |
|
|
223
|
+
| Config files | `{tool}.config.ts` | `vitest.config.ts`, `drizzle.config.ts` |
|
|
224
|
+
| JSON configs | `{tool}.json` | `biome.json`, `tsconfig.json` |
|
|
225
|
+
|
|
226
|
+
### Code Naming Conventions
|
|
227
|
+
|
|
228
|
+
| Type | Convention | Examples |
|
|
229
|
+
|------|------------|----------|
|
|
230
|
+
| Types/Interfaces | PascalCase | `Order`, `CreateOrderInput`, `ValidatedRequest` |
|
|
231
|
+
| Zod Schemas | PascalCase + `Schema` suffix | `OrderSchema`, `CreateOrderSchema` |
|
|
232
|
+
| Functions | camelCase | `getOrders`, `createOrder`, `validateRequest` |
|
|
233
|
+
| Router exports | camelCase + `Router` suffix | `ordersRouter`, `healthRouter` |
|
|
234
|
+
| Constants | UPPER_SNAKE_CASE | `PORT`, `DATABASE_URL` |
|
|
235
|
+
| Environment vars | UPPER_SNAKE_CASE | `process.env.PORT` |
|
|
236
|
+
|
|
237
|
+
### Import Conventions
|
|
238
|
+
|
|
239
|
+
```typescript
|
|
240
|
+
// External packages first
|
|
241
|
+
import { Router } from 'ultimate-express';
|
|
242
|
+
import { z } from 'zod';
|
|
243
|
+
|
|
244
|
+
// Internal imports with .js extension (ESM requirement)
|
|
245
|
+
import { validateRequest } from '../../lib/validateRequest.js';
|
|
246
|
+
import { CreateOrderSchema } from './schemas.js';
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Export Conventions
|
|
250
|
+
|
|
251
|
+
- **Named exports** preferred over default exports
|
|
252
|
+
- **Routers** exported from feature `index.ts`
|
|
253
|
+
- **Schemas** exported from `schemas.ts` for reuse
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## 6. Navigation and Development Workflow
|
|
258
|
+
|
|
259
|
+
### Entry Points
|
|
260
|
+
|
|
261
|
+
| Purpose | File | Description |
|
|
262
|
+
|---------|------|-------------|
|
|
263
|
+
| Application start | `src/index.ts` | Express app setup, middleware, route mounting |
|
|
264
|
+
| Feature discovery | `src/features/` | Browse available features |
|
|
265
|
+
| API documentation | `/api/docs` | Scalar-powered OpenAPI docs |
|
|
266
|
+
| OpenAPI spec | `/openapi.json` | Raw OpenAPI JSON |
|
|
267
|
+
|
|
268
|
+
### Common Development Tasks
|
|
269
|
+
|
|
270
|
+
#### Adding a New Feature
|
|
271
|
+
|
|
272
|
+
1. Create feature directory: `src/features/{feature-name}/`
|
|
273
|
+
2. Create required files:
|
|
274
|
+
```
|
|
275
|
+
src/features/{feature-name}/
|
|
276
|
+
├── index.ts # Router
|
|
277
|
+
├── controller.ts # Handlers
|
|
278
|
+
├── schemas.ts # Validation + OpenAPI
|
|
279
|
+
└── {feature}.test.ts # Tests
|
|
280
|
+
```
|
|
281
|
+
3. Mount router in `src/index.ts`:
|
|
282
|
+
```typescript
|
|
283
|
+
import { featureRouter } from './features/{feature-name}/index.js';
|
|
284
|
+
app.use('/api/{feature-name}', featureRouter);
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
#### Adding a New Endpoint
|
|
288
|
+
|
|
289
|
+
1. Define schema in `schemas.ts` with OpenAPI registration
|
|
290
|
+
2. Add handler in `controller.ts`
|
|
291
|
+
3. Wire route in `index.ts`
|
|
292
|
+
4. Add unit test in `{feature}.test.ts`
|
|
293
|
+
|
|
294
|
+
#### Adding Shared Utility
|
|
295
|
+
|
|
296
|
+
1. Create file in `src/lib/{utility-name}.ts`
|
|
297
|
+
2. Add tests in `src/lib/{utility-name}.test.ts`
|
|
298
|
+
3. Import in features as needed
|
|
299
|
+
|
|
300
|
+
### Dependency Flow
|
|
301
|
+
|
|
302
|
+
```
|
|
303
|
+
src/index.ts
|
|
304
|
+
↓
|
|
305
|
+
src/features/{feature}/index.ts (Router)
|
|
306
|
+
↓
|
|
307
|
+
src/features/{feature}/controller.ts (Handlers)
|
|
308
|
+
↓
|
|
309
|
+
src/features/{feature}/schemas.ts (Validation)
|
|
310
|
+
↓
|
|
311
|
+
src/lib/openapi.ts (Registry)
|
|
312
|
+
src/lib/validateRequest.ts (Middleware)
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## 7. Build and Output Organization
|
|
318
|
+
|
|
319
|
+
### Build Configuration
|
|
320
|
+
|
|
321
|
+
| Tool | Config File | Purpose |
|
|
322
|
+
|------|-------------|---------|
|
|
323
|
+
| SWC | Via CLI in `package.json` | TypeScript → JavaScript compilation |
|
|
324
|
+
| TypeScript | `tsconfig.json` | Type checking configuration |
|
|
325
|
+
| Biome | `biome.json` | Linting and formatting |
|
|
326
|
+
|
|
327
|
+
### NPM Scripts
|
|
328
|
+
|
|
329
|
+
| Script | Command | Purpose |
|
|
330
|
+
|--------|---------|---------|
|
|
331
|
+
| `dev` | `vite-node --watch src/index.ts` | Development server with hot reload |
|
|
332
|
+
| `build` | `swc src -d build --strip-leading-paths --copy-files` | Production build |
|
|
333
|
+
| `start` | `node build/index.js` | Run production server |
|
|
334
|
+
| `test` | `vitest run` | Run unit tests |
|
|
335
|
+
| `test:coverage` | `vitest run --coverage` | Run tests with coverage |
|
|
336
|
+
| `typecheck` | `npx tsc --noEmit` | Type checking without emit |
|
|
337
|
+
|
|
338
|
+
### Output Structure
|
|
339
|
+
|
|
340
|
+
```
|
|
341
|
+
build/ # Compiled JavaScript (mirrors src/)
|
|
342
|
+
├── index.js
|
|
343
|
+
├── features/
|
|
344
|
+
│ ├── health/
|
|
345
|
+
│ │ ├── index.js
|
|
346
|
+
│ │ ├── controller.js
|
|
347
|
+
│ │ └── schemas.js
|
|
348
|
+
│ └── orders/
|
|
349
|
+
│ └── ...
|
|
350
|
+
└── lib/
|
|
351
|
+
├── openapi.js
|
|
352
|
+
└── validateRequest.js
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
## 8. Node.js-Specific Structure Patterns
|
|
358
|
+
|
|
359
|
+
### Module Organization
|
|
360
|
+
|
|
361
|
+
- **ESM (ES Modules)**: Project uses `"type": "module"` in package.json
|
|
362
|
+
- **Import Extensions**: All local imports use `.js` extension for ESM compatibility
|
|
363
|
+
- **Path Aliases**: `@/` alias available via Vitest config
|
|
364
|
+
|
|
365
|
+
### Script Organization
|
|
366
|
+
|
|
367
|
+
| Category | Scripts |
|
|
368
|
+
|----------|---------|
|
|
369
|
+
| Development | `dev`, `build`, `build:debug` |
|
|
370
|
+
| Testing | `test`, `test:coverage`, `test:watch`, `test:ui` |
|
|
371
|
+
| Database | `db:generate`, `db:migrate`, `db:push`, `db:studio` |
|
|
372
|
+
| Quality | `typecheck`, `knip` |
|
|
373
|
+
|
|
374
|
+
### Configuration Management
|
|
375
|
+
|
|
376
|
+
| Config Type | File | Environment Override |
|
|
377
|
+
|-------------|------|---------------------|
|
|
378
|
+
| Server port | `.env` | `PORT` |
|
|
379
|
+
| Database URL | `.env` | `DATABASE_URL` |
|
|
380
|
+
| Test base URL | `.env` | `PLAYWRIGHT_BASE_URL` |
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## 9. Extension and Evolution
|
|
385
|
+
|
|
386
|
+
### Adding New Feature Module
|
|
387
|
+
|
|
388
|
+
```
|
|
389
|
+
src/features/{new-feature}/
|
|
390
|
+
├── index.ts # Required: Router setup
|
|
391
|
+
├── controller.ts # Required: HTTP handlers
|
|
392
|
+
├── schemas.ts # Required: Zod schemas + OpenAPI
|
|
393
|
+
├── {new-feature}.test.ts # Required: Unit tests
|
|
394
|
+
├── service.ts # Optional: Business logic
|
|
395
|
+
├── repository.ts # Optional: Database access
|
|
396
|
+
└── types.ts # Optional: TypeScript types
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
### Scalability Patterns
|
|
400
|
+
|
|
401
|
+
- **Feature splitting**: Large features can be split into sub-features
|
|
402
|
+
- **Service extraction**: Business logic can move to dedicated service files
|
|
403
|
+
- **Repository pattern**: Database operations isolated in repository files
|
|
404
|
+
|
|
405
|
+
### Future Infrastructure (Planned)
|
|
406
|
+
|
|
407
|
+
Based on `drizzle.config.ts`, the project plans to add:
|
|
408
|
+
- `src/infrastructure/database/schema.ts` - Drizzle schema definitions
|
|
409
|
+
- `drizzle/` - Migration files
|
|
410
|
+
|
|
411
|
+
---
|
|
412
|
+
|
|
413
|
+
## 10. Structure Templates
|
|
414
|
+
|
|
415
|
+
### New Feature Template
|
|
416
|
+
|
|
417
|
+
```typescript
|
|
418
|
+
// src/features/{feature}/index.ts
|
|
419
|
+
import { Router } from 'ultimate-express';
|
|
420
|
+
import { validateRequest } from '../../lib/validateRequest.js';
|
|
421
|
+
import { getItems, createItem } from './controller.js';
|
|
422
|
+
import { CreateItemSchema } from './schemas.js';
|
|
423
|
+
|
|
424
|
+
export const {feature}Router = Router();
|
|
425
|
+
|
|
426
|
+
{feature}Router.get('/', getItems);
|
|
427
|
+
{feature}Router.post('/', validateRequest({ body: CreateItemSchema }), createItem);
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
```typescript
|
|
431
|
+
// src/features/{feature}/controller.ts
|
|
432
|
+
import type { RequestHandler } from 'ultimate-express';
|
|
433
|
+
|
|
434
|
+
export const getItems: RequestHandler = (_req, res) => {
|
|
435
|
+
res.json([]);
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
export const createItem: RequestHandler = (req, res) => {
|
|
439
|
+
res.status(201).json(req.body);
|
|
440
|
+
};
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
```typescript
|
|
444
|
+
// src/features/{feature}/schemas.ts
|
|
445
|
+
import { z } from 'zod';
|
|
446
|
+
import { registry } from '../../lib/openapi.js';
|
|
447
|
+
|
|
448
|
+
export const ItemSchema = z.object({
|
|
449
|
+
id: z.number().int().positive(),
|
|
450
|
+
name: z.string().min(1),
|
|
451
|
+
}).openapi('Item');
|
|
452
|
+
|
|
453
|
+
export const CreateItemSchema = z.object({
|
|
454
|
+
name: z.string().min(1),
|
|
455
|
+
}).openapi('CreateItem');
|
|
456
|
+
|
|
457
|
+
registry.registerPath({
|
|
458
|
+
method: 'get',
|
|
459
|
+
path: '/api/{feature}',
|
|
460
|
+
tags: ['{Feature}'],
|
|
461
|
+
responses: {
|
|
462
|
+
200: {
|
|
463
|
+
description: 'List all items',
|
|
464
|
+
content: { 'application/json': { schema: z.array(ItemSchema) } },
|
|
465
|
+
},
|
|
466
|
+
},
|
|
467
|
+
});
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
```typescript
|
|
471
|
+
// src/features/{feature}/{feature}.test.ts
|
|
472
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
473
|
+
import type { Request, Response } from 'ultimate-express';
|
|
474
|
+
import { getItems } from './controller.js';
|
|
475
|
+
|
|
476
|
+
describe('GET /api/{feature}', () => {
|
|
477
|
+
it('returns empty array', () => {
|
|
478
|
+
const json = vi.fn();
|
|
479
|
+
const res = { json } as unknown as Response;
|
|
480
|
+
const req = {} as Request;
|
|
481
|
+
|
|
482
|
+
getItems(req, res, vi.fn());
|
|
483
|
+
|
|
484
|
+
expect(json).toHaveBeenCalledWith([]);
|
|
485
|
+
});
|
|
486
|
+
});
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
---
|
|
490
|
+
|
|
491
|
+
## 11. Structure Enforcement
|
|
492
|
+
|
|
493
|
+
### Validation Tools
|
|
494
|
+
|
|
495
|
+
| Tool | Purpose | Command |
|
|
496
|
+
|------|---------|---------|
|
|
497
|
+
| TypeScript | Type safety | `pnpm typecheck` |
|
|
498
|
+
| Biome | Linting & formatting | `pnpm biome check .` |
|
|
499
|
+
| Knip | Unused code detection | `pnpm knip` |
|
|
500
|
+
| Vitest | Test execution | `pnpm test` |
|
|
501
|
+
|
|
502
|
+
### Code Quality Rules (Biome)
|
|
503
|
+
|
|
504
|
+
- **Indent**: Tabs
|
|
505
|
+
- **Line width**: 100 characters
|
|
506
|
+
- **Quotes**: Single quotes
|
|
507
|
+
- **Semicolons**: Required
|
|
508
|
+
- **Trailing commas**: ES5 style
|
|
509
|
+
- **Imports**: Auto-organized
|
|
510
|
+
|
|
511
|
+
### Recommended Pre-commit Checks
|
|
512
|
+
|
|
513
|
+
```bash
|
|
514
|
+
pnpm typecheck && pnpm biome check . && pnpm test
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
---
|
|
518
|
+
|
|
519
|
+
## Maintaining This Blueprint
|
|
520
|
+
|
|
521
|
+
This document should be updated when:
|
|
522
|
+
- New feature modules are added
|
|
523
|
+
- Project structure patterns change
|
|
524
|
+
- Build or test configuration changes
|
|
525
|
+
- New shared libraries are introduced
|
|
526
|
+
|
|
527
|
+
**Document Version:** 1.0
|
|
528
|
+
**Last Updated:** November 25, 2025
|
|
529
|
+
**Generated By:** GitHub Copilot - Folder Structure Blueprint Generator
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
|
|
2
|
+
# Cybermate API
|
|
3
|
+
|
|
4
|
+
Fast TypeScript backend starter kit with Ultimate Express, Scalar API docs, and Drizzle ORM.
|
|
5
|
+
|
|
6
|
+
## Features & Stack
|
|
7
|
+
- Ultimate Express (Express framework)
|
|
8
|
+
- TypeScript
|
|
9
|
+
- Drizzle ORM (PostgreSQL)
|
|
10
|
+
- Scalar API Docs
|
|
11
|
+
- Biome (lint/format)
|
|
12
|
+
- Vitest (testing)
|
|
13
|
+
- pnpm (package manager)
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
```bash
|
|
17
|
+
pnpm install
|
|
18
|
+
cp .env.example .env # edit as needed
|
|
19
|
+
pnpm dev # start dev server
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Project Structure
|
|
23
|
+
```
|
|
24
|
+
cybermate-api/
|
|
25
|
+
├── src/
|
|
26
|
+
│ ├── index.ts # App entry
|
|
27
|
+
│ └── features/
|
|
28
|
+
│ ├── health/ # Health check
|
|
29
|
+
│ └── orders/ # Orders feature
|
|
30
|
+
├── build/ # Compiled output
|
|
31
|
+
├── biome.json # Biome config
|
|
32
|
+
├── drizzle.config.ts # Drizzle ORM config
|
|
33
|
+
├── tsconfig.json # TypeScript config
|
|
34
|
+
└── package.json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Feature Module Structure
|
|
38
|
+
```
|
|
39
|
+
features/{feature}/
|
|
40
|
+
├── index.ts # Router
|
|
41
|
+
├── controller.ts # HTTP handlers
|
|
42
|
+
├── service.ts # Business logic (optional)
|
|
43
|
+
├── repository.ts # DB access (optional)
|
|
44
|
+
├── schema.ts # Validation (optional)
|
|
45
|
+
├── types.ts # Types (optional)
|
|
46
|
+
└── *.test.ts # Unit tests
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Naming Conventions
|
|
50
|
+
| Type | Convention | Example |
|
|
51
|
+
|---------------------|-----------------------|------------------------|
|
|
52
|
+
| Folders | lowercase-hyphenated | `user-management/` |
|
|
53
|
+
| Files | lowercase-hyphenated | `controller.ts` |
|
|
54
|
+
| Test files | `*.test.ts` | `orders.test.ts` |
|
|
55
|
+
| Types/Interfaces | PascalCase | `Order`, `ApiResponse` |
|
|
56
|
+
| Variables/Functions | camelCase | `getOrders` |
|
|
57
|
+
| Constants | UPPER_SNAKE_CASE | `API_URL` |
|
|
58
|
+
| Routers | camelCase+Router | `ordersRouter` |
|
|
59
|
+
|
|
60
|
+
## API Endpoints
|
|
61
|
+
- `GET /api/health` - Health check
|
|
62
|
+
- `GET /api/orders` - List orders
|
|
63
|
+
- `POST /api/orders` - Create order
|
|
64
|
+
- `GET /api/docs` - API docs (Scalar)
|
|
65
|
+
|
|
66
|
+
## Add a Feature
|
|
67
|
+
1. Create `src/features/{feature}/`
|
|
68
|
+
2. Add `controller.ts`, `index.ts`, etc.
|
|
69
|
+
3. Mount router in `src/index.ts`
|
|
70
|
+
|
|
71
|
+
## Testing
|
|
72
|
+
- Use Vitest, place tests as `*.test.ts` next to code
|
|
73
|
+
|
|
74
|
+
## Code Style
|
|
75
|
+
- Format/lint: `pnpm biome check .`
|
|
76
|
+
- Indent: tabs, line width: 100, single quotes, semicolons
|
|
77
|
+
|
|
78
|
+
## Env Example
|
|
79
|
+
```env
|
|
80
|
+
PORT=3000
|
|
81
|
+
DATABASE_URL=postgres://user:pass@localhost:5432/db
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Best Practices
|
|
85
|
+
- Use named exports
|
|
86
|
+
- Use `.js` for local imports
|
|
87
|
+
- Type all handlers: `(req: Request, res: Response)`
|
|
88
|
+
- Use Zod for validation
|
|
89
|
+
- Keep features modular
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
[Your License Here]
|
|
93
|
+
|
|
94
|
+
## Links
|
|
95
|
+
- [Ultimate Express](https://github.com/sinclairzx81/ultimate-express)
|
|
96
|
+
- [Drizzle ORM](https://orm.drizzle.team/)
|
|
97
|
+
- [Scalar](https://scalar.com/)
|
|
98
|
+
- [Biome](https://biomejs.dev/)
|
|
99
|
+
- [Vitest](https://vitest.dev/)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.0.6/schema.json",
|
|
3
|
+
"vcs": {
|
|
4
|
+
"enabled": false,
|
|
5
|
+
"clientKind": "git",
|
|
6
|
+
"useIgnoreFile": false
|
|
7
|
+
},
|
|
8
|
+
"files": {
|
|
9
|
+
"ignoreUnknown": false
|
|
10
|
+
},
|
|
11
|
+
"formatter": {
|
|
12
|
+
"enabled": true,
|
|
13
|
+
"indentStyle": "tab",
|
|
14
|
+
"indentWidth": 2,
|
|
15
|
+
"lineWidth": 100
|
|
16
|
+
},
|
|
17
|
+
"linter": {
|
|
18
|
+
"enabled": true,
|
|
19
|
+
"rules": {
|
|
20
|
+
"recommended": true,
|
|
21
|
+
"suspicious": {
|
|
22
|
+
"noExplicitAny": "warn"
|
|
23
|
+
},
|
|
24
|
+
"style": {
|
|
25
|
+
"useConst": "error",
|
|
26
|
+
"useTemplate": "warn"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"javascript": {
|
|
31
|
+
"formatter": {
|
|
32
|
+
"quoteStyle": "single",
|
|
33
|
+
"trailingCommas": "es5",
|
|
34
|
+
"semicolons": "always"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"assist": {
|
|
38
|
+
"enabled": true,
|
|
39
|
+
"actions": {
|
|
40
|
+
"source": {
|
|
41
|
+
"organizeImports": "on"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineConfig } from 'drizzle-kit';
|
|
2
2
|
|
|
3
3
|
export default defineConfig({
|
|
4
|
-
schema: './src/infrastructure/database/schema.ts',
|
|
4
|
+
schema: './src/infrastructure/database/schema.ts', // TODO: update when fix database repo
|
|
5
5
|
out: './drizzle',
|
|
6
6
|
dialect: 'postgresql',
|
|
7
7
|
dbCredentials: {
|