create-pnpm-custom-app 1.0.0
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 +217 -0
- package/bin/cli.js +185 -0
- package/package.json +39 -0
- package/templates/.github/copilot-instructions.md +184 -0
- package/templates/.nvmrc +1 -0
- package/templates/.vscode/settings.json +51 -0
- package/templates/CONTRIBUTING.md +184 -0
- package/templates/LICENSE +21 -0
- package/templates/README.md +324 -0
- package/templates/apps/api/.env.example +36 -0
- package/templates/apps/api/.prettierrc.json +7 -0
- package/templates/apps/api/eslint.config.js +17 -0
- package/templates/apps/api/gitignore +45 -0
- package/templates/apps/api/jest.config.ts +22 -0
- package/templates/apps/api/package.json +49 -0
- package/templates/apps/api/src/app.ts +121 -0
- package/templates/apps/api/src/config/config.ts +38 -0
- package/templates/apps/api/src/config/logger.ts +57 -0
- package/templates/apps/api/src/db/mongo.ts +30 -0
- package/templates/apps/api/src/index.ts +40 -0
- package/templates/apps/api/src/middlewares/middleware.ts +75 -0
- package/templates/apps/api/src/models/example.model.ts +89 -0
- package/templates/apps/api/src/routes/routes.ts +54 -0
- package/templates/apps/api/src/schemas/swagger.schema.ts +58 -0
- package/templates/apps/api/src/services/example.service.ts +63 -0
- package/templates/apps/api/src/tests/health.test.ts +90 -0
- package/templates/apps/api/src/tests/helpers/test-helpers.ts +40 -0
- package/templates/apps/api/src/tests/mocks/mocks.ts +29 -0
- package/templates/apps/api/src/tests/setup.ts +11 -0
- package/templates/apps/api/src/types/fastify.d.ts +44 -0
- package/templates/apps/api/tsconfig.json +24 -0
- package/templates/apps/web/.env.example +25 -0
- package/templates/apps/web/.prettierignore +7 -0
- package/templates/apps/web/.prettierrc +9 -0
- package/templates/apps/web/app/ICONS.md +42 -0
- package/templates/apps/web/app/[locale]/(routes)/layout.tsx +13 -0
- package/templates/apps/web/app/[locale]/(routes)/page.tsx +49 -0
- package/templates/apps/web/app/[locale]/[...not-found]/page.tsx +8 -0
- package/templates/apps/web/app/[locale]/layout.tsx +35 -0
- package/templates/apps/web/app/[locale]/not-found.tsx +12 -0
- package/templates/apps/web/app/components/layout/Footer.component.tsx +30 -0
- package/templates/apps/web/app/components/layout/Nav.component.tsx +34 -0
- package/templates/apps/web/app/components/ui/README.md +39 -0
- package/templates/apps/web/app/components/ui/atoms/README.md +55 -0
- package/templates/apps/web/app/components/ui/molecules/README.md +51 -0
- package/templates/apps/web/app/globals.css +104 -0
- package/templates/apps/web/app/icon.svg +5 -0
- package/templates/apps/web/app/layout.tsx +37 -0
- package/templates/apps/web/app/manifest.json +22 -0
- package/templates/apps/web/app/providers.tsx +25 -0
- package/templates/apps/web/app/robots.ts +12 -0
- package/templates/apps/web/app/sitemap.ts +18 -0
- package/templates/apps/web/eslint.config.mjs +16 -0
- package/templates/apps/web/gitignore +56 -0
- package/templates/apps/web/hooks/README.md +25 -0
- package/templates/apps/web/i18n/config.ts +9 -0
- package/templates/apps/web/i18n/request.ts +15 -0
- package/templates/apps/web/interfaces/README.md +5 -0
- package/templates/apps/web/lib/README.md +45 -0
- package/templates/apps/web/lib/utils.ts +18 -0
- package/templates/apps/web/messages/en.json +34 -0
- package/templates/apps/web/messages/es.json +34 -0
- package/templates/apps/web/next.config.ts +50 -0
- package/templates/apps/web/package.json +34 -0
- package/templates/apps/web/postcss.config.mjs +7 -0
- package/templates/apps/web/proxy.ts +17 -0
- package/templates/apps/web/public/README.md +7 -0
- package/templates/apps/web/tsconfig.json +27 -0
- package/templates/apps/web/types/README.md +3 -0
- package/templates/docs/README.md +13 -0
- package/templates/gitignore-root +51 -0
- package/templates/package.json +30 -0
- package/templates/packages/shared/eslint.config.js +26 -0
- package/templates/packages/shared/package.json +22 -0
- package/templates/packages/shared/src/index.ts +39 -0
- package/templates/packages/shared/tsconfig.json +19 -0
- package/templates/pnpm-workspace.yaml +3 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# Contributing to {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to this project! We welcome contributions from the community.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Code of Conduct](#code-of-conduct)
|
|
8
|
+
- [Getting Started](#getting-started)
|
|
9
|
+
- [Development Setup](#development-setup)
|
|
10
|
+
- [Making Changes](#making-changes)
|
|
11
|
+
- [Commit Guidelines](#commit-guidelines)
|
|
12
|
+
- [Pull Request Process](#pull-request-process)
|
|
13
|
+
- [Coding Standards](#coding-standards)
|
|
14
|
+
|
|
15
|
+
## Code of Conduct
|
|
16
|
+
|
|
17
|
+
This project adheres to a code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [project-email@example.com].
|
|
18
|
+
|
|
19
|
+
## Getting Started
|
|
20
|
+
|
|
21
|
+
1. Fork the repository
|
|
22
|
+
2. Clone your fork: `git clone https://github.com/your-username/{{PROJECT_NAME}}.git`
|
|
23
|
+
3. Add upstream remote: `git remote add upstream https://github.com/original-owner/{{PROJECT_NAME}}.git`
|
|
24
|
+
4. Create a new branch: `git checkout -b feature/your-feature-name`
|
|
25
|
+
|
|
26
|
+
## Development Setup
|
|
27
|
+
|
|
28
|
+
### Prerequisites
|
|
29
|
+
|
|
30
|
+
- Node.js 20+ (use the version specified in `.nvmrc`)
|
|
31
|
+
- pnpm 9+
|
|
32
|
+
- MongoDB (for local development)
|
|
33
|
+
|
|
34
|
+
### Installation
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Install dependencies
|
|
38
|
+
pnpm install
|
|
39
|
+
|
|
40
|
+
# Copy environment files
|
|
41
|
+
cp apps/web/.env.example apps/web/.env.local
|
|
42
|
+
cp apps/api/.env.example apps/api/.env
|
|
43
|
+
|
|
44
|
+
# Start development servers
|
|
45
|
+
pnpm --filter web dev # Frontend on http://localhost:3000
|
|
46
|
+
pnpm --filter api dev # Backend on http://localhost:3002
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Making Changes
|
|
50
|
+
|
|
51
|
+
### Branch Naming
|
|
52
|
+
|
|
53
|
+
- Feature: `feature/description`
|
|
54
|
+
- Bug fix: `fix/description`
|
|
55
|
+
- Documentation: `docs/description`
|
|
56
|
+
- Refactor: `refactor/description`
|
|
57
|
+
|
|
58
|
+
### Code Style
|
|
59
|
+
|
|
60
|
+
- Follow existing code patterns
|
|
61
|
+
- Use TypeScript for all new code
|
|
62
|
+
- Add JSDoc comments for functions and components
|
|
63
|
+
- Ensure your code passes linting: `pnpm run lint`
|
|
64
|
+
- Format code with Prettier (automatic on save if configured)
|
|
65
|
+
|
|
66
|
+
### Testing
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Run tests
|
|
70
|
+
pnpm run test
|
|
71
|
+
|
|
72
|
+
# Run tests in watch mode
|
|
73
|
+
pnpm --filter api test:watch
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Commit Guidelines
|
|
77
|
+
|
|
78
|
+
We follow [Conventional Commits](https://www.conventionalcommits.org/):
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
<type>(<scope>): <subject>
|
|
82
|
+
|
|
83
|
+
<body>
|
|
84
|
+
|
|
85
|
+
<footer>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Types
|
|
89
|
+
|
|
90
|
+
- `feat`: New feature
|
|
91
|
+
- `fix`: Bug fix
|
|
92
|
+
- `docs`: Documentation changes
|
|
93
|
+
- `style`: Code style changes (formatting, etc.)
|
|
94
|
+
- `refactor`: Code refactoring
|
|
95
|
+
- `test`: Adding or updating tests
|
|
96
|
+
- `chore`: Maintenance tasks
|
|
97
|
+
|
|
98
|
+
### Examples
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
feat(auth): add Google OAuth integration
|
|
102
|
+
fix(api): resolve MongoDB connection timeout
|
|
103
|
+
docs(readme): update installation instructions
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Pull Request Process
|
|
107
|
+
|
|
108
|
+
1. **Update documentation** - Update README.md if needed
|
|
109
|
+
2. **Add tests** - Ensure new features have test coverage
|
|
110
|
+
3. **Run quality checks**:
|
|
111
|
+
```bash
|
|
112
|
+
pnpm run lint
|
|
113
|
+
pnpm run build
|
|
114
|
+
pnpm run test
|
|
115
|
+
```
|
|
116
|
+
4. **Create pull request** - Use a clear title and description
|
|
117
|
+
5. **Link issues** - Reference related issues in the PR description
|
|
118
|
+
6. **Wait for review** - Address feedback from maintainers
|
|
119
|
+
|
|
120
|
+
### PR Template
|
|
121
|
+
|
|
122
|
+
```markdown
|
|
123
|
+
## Description
|
|
124
|
+
Brief description of changes
|
|
125
|
+
|
|
126
|
+
## Type of Change
|
|
127
|
+
- [ ] Bug fix
|
|
128
|
+
- [ ] New feature
|
|
129
|
+
- [ ] Breaking change
|
|
130
|
+
- [ ] Documentation update
|
|
131
|
+
|
|
132
|
+
## Testing
|
|
133
|
+
Describe the tests you ran
|
|
134
|
+
|
|
135
|
+
## Checklist
|
|
136
|
+
- [ ] Code follows project style guidelines
|
|
137
|
+
- [ ] Self-review completed
|
|
138
|
+
- [ ] Comments added for complex code
|
|
139
|
+
- [ ] Documentation updated
|
|
140
|
+
- [ ] No new warnings generated
|
|
141
|
+
- [ ] Tests added/updated
|
|
142
|
+
- [ ] All tests passing
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Coding Standards
|
|
146
|
+
|
|
147
|
+
### TypeScript
|
|
148
|
+
|
|
149
|
+
- Use strict TypeScript (`strict: true`)
|
|
150
|
+
- Avoid `any` - use proper types
|
|
151
|
+
- Define interfaces for props and data structures
|
|
152
|
+
- Use descriptive variable and function names
|
|
153
|
+
|
|
154
|
+
### React/Next.js
|
|
155
|
+
|
|
156
|
+
- Use Server Components by default
|
|
157
|
+
- Add `'use client'` only when necessary
|
|
158
|
+
- Use `forwardRef` for components that need refs
|
|
159
|
+
- Implement proper error boundaries
|
|
160
|
+
- Optimize images with Next.js Image component
|
|
161
|
+
|
|
162
|
+
### Tailwind CSS
|
|
163
|
+
|
|
164
|
+
- Use utility classes only (no custom CSS)
|
|
165
|
+
- Follow mobile-first responsive design
|
|
166
|
+
- Use design tokens from `globals.css`
|
|
167
|
+
- Maintain consistent spacing and sizing
|
|
168
|
+
|
|
169
|
+
### Backend/API
|
|
170
|
+
|
|
171
|
+
- Write descriptive Swagger documentation
|
|
172
|
+
- Validate all input with proper schemas
|
|
173
|
+
- Handle errors consistently
|
|
174
|
+
- Add JSDoc comments for all functions
|
|
175
|
+
- Use Mongoose models for database operations
|
|
176
|
+
|
|
177
|
+
## Questions?
|
|
178
|
+
|
|
179
|
+
If you have questions, please:
|
|
180
|
+
1. Check existing documentation
|
|
181
|
+
2. Search existing issues
|
|
182
|
+
3. Create a new issue with the `question` label
|
|
183
|
+
|
|
184
|
+
Thank you for contributing! 🎉
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 [Your Name or Organization]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
# {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
> A professional full-stack monorepo with Next.js 16, Fastify, MongoDB, and TypeScript
|
|
4
|
+
|
|
5
|
+
[](https://www.typescriptlang.org/)
|
|
6
|
+
[](https://nextjs.org/)
|
|
7
|
+
[](https://www.fastify.io/)
|
|
8
|
+
[](./LICENSE)
|
|
9
|
+
|
|
10
|
+
## Table of Contents
|
|
11
|
+
|
|
12
|
+
- [Features](#features)
|
|
13
|
+
- [Tech Stack](#tech-stack)
|
|
14
|
+
- [Project Structure](#project-structure)
|
|
15
|
+
- [Getting Started](#getting-started)
|
|
16
|
+
- [Development](#development)
|
|
17
|
+
- [Building for Production](#building-for-production)
|
|
18
|
+
- [Testing](#testing)
|
|
19
|
+
- [Documentation](#documentation)
|
|
20
|
+
- [Contributing](#contributing)
|
|
21
|
+
- [License](#license)
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
- **Modern UI** - Next.js 16 with App Router and React Server Components
|
|
26
|
+
- **Type-Safe** - Full TypeScript coverage across frontend and backend
|
|
27
|
+
- **Internationalization** - Built-in i18n support with next-intl (English/Spanish)
|
|
28
|
+
- **Tailwind CSS 4** - Utility-first styling with custom design system
|
|
29
|
+
- **Fast API** - Fastify backend with MongoDB and Mongoose
|
|
30
|
+
- **Authentication** - JWT-based auth with secure cookie handling
|
|
31
|
+
- **API Documentation** - Interactive Swagger/OpenAPI documentation
|
|
32
|
+
- **Testing Ready** - Jest configured for both frontend and backend
|
|
33
|
+
- **Monorepo** - pnpm workspaces for efficient dependency management
|
|
34
|
+
- **Shared Types** - Common interfaces between frontend and backend
|
|
35
|
+
|
|
36
|
+
## Tech Stack
|
|
37
|
+
|
|
38
|
+
### Frontend (`apps/web`)
|
|
39
|
+
|
|
40
|
+
- **Framework**: Next.js 16.1.1+ (App Router)
|
|
41
|
+
- **Language**: TypeScript 5+
|
|
42
|
+
- **Styling**: Tailwind CSS 4
|
|
43
|
+
- **i18n**: next-intl
|
|
44
|
+
|
|
45
|
+
### Backend (`apps/api`)
|
|
46
|
+
|
|
47
|
+
- **Framework**: Fastify 5+
|
|
48
|
+
- **Language**: TypeScript 5+
|
|
49
|
+
- **Database**: MongoDB + Mongoose
|
|
50
|
+
- **Authentication**: @fastify/jwt + bcrypt
|
|
51
|
+
- **Validation**: Fastify schemas
|
|
52
|
+
- **Documentation**: @fastify/swagger + @fastify/swagger-ui
|
|
53
|
+
- **Logging**: Pino
|
|
54
|
+
- **Testing**: Jest + Supertest
|
|
55
|
+
|
|
56
|
+
### Shared (`packages/shared`)
|
|
57
|
+
|
|
58
|
+
- TypeScript interfaces and types
|
|
59
|
+
- Shared utilities and constants
|
|
60
|
+
|
|
61
|
+
## Project Structure
|
|
62
|
+
|
|
63
|
+
```txt
|
|
64
|
+
{{PROJECT_NAME}}/
|
|
65
|
+
├── apps/
|
|
66
|
+
│ ├── web/ # Next.js frontend
|
|
67
|
+
│ │ ├── app/
|
|
68
|
+
│ │ │ ├── [locale]/ # Internationalized routes
|
|
69
|
+
│ │ │ │ ├── (routes)/ # Main application routes
|
|
70
|
+
│ │ │ │ │ ├── layout.tsx
|
|
71
|
+
│ │ │ │ │ └── page.tsx
|
|
72
|
+
│ │ │ │ ├── layout.tsx
|
|
73
|
+
│ │ │ │ └── not-found.tsx
|
|
74
|
+
│ │ │ ├── api/ # API routes (if needed)
|
|
75
|
+
│ │ │ ├── components/ # React components
|
|
76
|
+
│ │ │ │ ├── layout/ # Layout components
|
|
77
|
+
│ │ │ │ └── ui/ # UI components
|
|
78
|
+
│ │ │ │ ├── atoms/ # Basic components
|
|
79
|
+
│ │ │ │ └── molecules/ # Composite components
|
|
80
|
+
│ │ │ ├── globals.css # Global styles + Tailwind config
|
|
81
|
+
│ │ │ ├── layout.tsx # Root layout
|
|
82
|
+
│ │ │ └── providers.tsx # Context providers
|
|
83
|
+
│ │ ├── hooks/ # Custom React hooks
|
|
84
|
+
│ │ ├── i18n/ # Internationalization config
|
|
85
|
+
│ │ ├── interfaces/ # TypeScript interfaces
|
|
86
|
+
│ │ ├── lib/ # Utility functions and API clients
|
|
87
|
+
│ │ ├── messages/ # Translation files
|
|
88
|
+
│ │ │ ├── en.json
|
|
89
|
+
│ │ │ └── es.json
|
|
90
|
+
│ │ ├── public/ # Static assets
|
|
91
|
+
│ │ ├── types/ # TypeScript type definitions
|
|
92
|
+
│ │ └── package.json
|
|
93
|
+
│ │
|
|
94
|
+
│ └── api/ # Fastify backend
|
|
95
|
+
│ ├── src/
|
|
96
|
+
│ │ ├── config/ # Configuration files
|
|
97
|
+
│ │ │ ├── config.ts # Environment config
|
|
98
|
+
│ │ │ └── logger.ts # Pino logger setup
|
|
99
|
+
│ │ ├── db/ # Database connection
|
|
100
|
+
│ │ │ └── mongo.ts # MongoDB connection
|
|
101
|
+
│ │ ├── middlewares/ # Custom middlewares
|
|
102
|
+
│ │ ├── models/ # Mongoose models
|
|
103
|
+
│ │ ├── routes/ # API route handlers
|
|
104
|
+
│ │ ├── schemas/ # Validation and Swagger schemas
|
|
105
|
+
│ │ ├── services/ # Business logic services
|
|
106
|
+
│ │ ├── tests/ # Test files
|
|
107
|
+
│ │ ├── types/ # TypeScript types
|
|
108
|
+
│ │ ├── app.ts # Fastify app setup
|
|
109
|
+
│ │ └── index.ts # Entry point
|
|
110
|
+
│ └── package.json
|
|
111
|
+
│
|
|
112
|
+
├── packages/
|
|
113
|
+
│ └── shared/ # Shared code between apps
|
|
114
|
+
│ └── src/
|
|
115
|
+
│ └── index.ts # Exported types and utilities
|
|
116
|
+
│
|
|
117
|
+
├── docs/ # Project documentation
|
|
118
|
+
├── .github/ # GitHub specific files
|
|
119
|
+
│ └── copilot-instructions.md # AI assistant guidelines
|
|
120
|
+
├── .vscode/ # VS Code settings
|
|
121
|
+
│ └── settings.json
|
|
122
|
+
├── .nvmrc # Node version
|
|
123
|
+
├── pnpm-workspace.yaml # pnpm workspace config
|
|
124
|
+
├── package.json # Root package.json
|
|
125
|
+
├── CONTRIBUTING.md # Contribution guidelines
|
|
126
|
+
├── LICENSE # MIT License
|
|
127
|
+
└── README.md # This file
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Getting Started
|
|
131
|
+
|
|
132
|
+
### Prerequisites
|
|
133
|
+
|
|
134
|
+
Ensure you have the following installed:
|
|
135
|
+
|
|
136
|
+
- **Node.js** 20+ (specified in `.nvmrc`)
|
|
137
|
+
- **pnpm** 9+
|
|
138
|
+
- **MongoDB** (local or remote instance)
|
|
139
|
+
|
|
140
|
+
### Installation
|
|
141
|
+
|
|
142
|
+
1. **Clone the repository**
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
git clone https://github.com/your-username/{{PROJECT_NAME}}.git
|
|
146
|
+
cd {{PROJECT_NAME}}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
2. **Install dependencies**
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
pnpm install
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
3. **Configure environment variables**
|
|
156
|
+
|
|
157
|
+
**Frontend** (`apps/web/.env.local`):
|
|
158
|
+
|
|
159
|
+
```env
|
|
160
|
+
# API Configuration
|
|
161
|
+
NEXT_PUBLIC_API_URL=http://localhost:3002
|
|
162
|
+
|
|
163
|
+
# Add other environment variables as needed
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Backend** (`apps/api/.env`):
|
|
167
|
+
|
|
168
|
+
```env
|
|
169
|
+
# Server
|
|
170
|
+
PORT=3002
|
|
171
|
+
NODE_ENV=development
|
|
172
|
+
|
|
173
|
+
# Database
|
|
174
|
+
MONGODB_URI=mongodb://localhost:27017/your-database
|
|
175
|
+
|
|
176
|
+
# Authentication
|
|
177
|
+
JWT_SECRET=your-super-secret-jwt-key-change-this
|
|
178
|
+
BCRYPT_ROUNDS=10
|
|
179
|
+
|
|
180
|
+
# CORS
|
|
181
|
+
CORS_ORIGIN=http://localhost:3000
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
4. **Start development servers**
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Frontend (http://localhost:3000)
|
|
188
|
+
pnpm --filter web dev
|
|
189
|
+
|
|
190
|
+
# Backend (http://localhost:3002)
|
|
191
|
+
pnpm --filter api dev
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Development
|
|
195
|
+
|
|
196
|
+
### Available Scripts
|
|
197
|
+
|
|
198
|
+
#### Root Level
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
pnpm install # Install all dependencies
|
|
202
|
+
pnpm run lint # Lint all packages
|
|
203
|
+
pnpm run build # Build all packages
|
|
204
|
+
pnpm run test # Run all tests
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
#### Frontend Development (`apps/web`)
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
pnpm --filter web dev # Start dev server
|
|
211
|
+
pnpm --filter web build # Build for production
|
|
212
|
+
pnpm --filter web start # Start production server
|
|
213
|
+
pnpm --filter web lint # Lint code
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
#### Backend Development (`apps/api`)
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
pnpm --filter api dev # Start dev server
|
|
220
|
+
pnpm --filter api build # Build TypeScript
|
|
221
|
+
pnpm --filter api start # Start production server
|
|
222
|
+
pnpm --filter api test # Run tests
|
|
223
|
+
pnpm --filter api lint # Lint code
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Code Style
|
|
227
|
+
|
|
228
|
+
This project uses:
|
|
229
|
+
|
|
230
|
+
- **ESLint** for code linting
|
|
231
|
+
- **Prettier** for code formatting
|
|
232
|
+
- **TypeScript** for type safety
|
|
233
|
+
|
|
234
|
+
Configuration files:
|
|
235
|
+
|
|
236
|
+
- `.eslintrc.*` - ESLint rules
|
|
237
|
+
- `.prettierrc` - Prettier formatting rules
|
|
238
|
+
- `tsconfig.json` - TypeScript configuration
|
|
239
|
+
|
|
240
|
+
## Building for Production
|
|
241
|
+
|
|
242
|
+
### Frontend
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
pnpm --filter web build
|
|
246
|
+
pnpm --filter web start
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
The build will be optimized for production with:
|
|
250
|
+
|
|
251
|
+
- Static page generation where possible
|
|
252
|
+
- Image optimization
|
|
253
|
+
- Code splitting
|
|
254
|
+
- Minification
|
|
255
|
+
|
|
256
|
+
### Backend
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
pnpm --filter api build
|
|
260
|
+
NODE_ENV=production pnpm --filter api start
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Testing
|
|
264
|
+
|
|
265
|
+
### Run All Tests
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
pnpm run test
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Backend Tests
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
pnpm --filter api test # Run once
|
|
275
|
+
pnpm --filter api test:watch # Watch mode
|
|
276
|
+
pnpm --filter api test:coverage # With coverage
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Writing Tests
|
|
280
|
+
|
|
281
|
+
Example test structure:
|
|
282
|
+
|
|
283
|
+
```typescript
|
|
284
|
+
import { describe, it, expect } from '@jest/globals';
|
|
285
|
+
|
|
286
|
+
describe('Feature Name', () => {
|
|
287
|
+
it('should do something', () => {
|
|
288
|
+
expect(true).toBe(true);
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## Documentation
|
|
294
|
+
|
|
295
|
+
- **API Documentation**: Available at `http://localhost:3002/docs` when running the backend
|
|
296
|
+
- **Copilot Instructions**: See `.github/copilot-instructions.md` for AI-assisted development guidelines
|
|
297
|
+
- **Contributing Guide**: See `CONTRIBUTING.md` for contribution guidelines
|
|
298
|
+
|
|
299
|
+
## Contributing
|
|
300
|
+
|
|
301
|
+
We welcome contributions! Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for details.
|
|
302
|
+
|
|
303
|
+
### Quick Contribution Guide
|
|
304
|
+
|
|
305
|
+
1. Fork the repository
|
|
306
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
307
|
+
3. Commit your changes (`git commit -m 'feat: add amazing feature'`)
|
|
308
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
309
|
+
5. Open a Pull Request
|
|
310
|
+
|
|
311
|
+
## License
|
|
312
|
+
|
|
313
|
+
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
|
|
314
|
+
|
|
315
|
+
## Acknowledgments
|
|
316
|
+
|
|
317
|
+
- Built with [Next.js](https://nextjs.org/)
|
|
318
|
+
- Powered by [Fastify](https://www.fastify.io/)
|
|
319
|
+
- Styled with [Tailwind CSS](https://tailwindcss.com/)
|
|
320
|
+
- Created with [create-pnpm-custom-app](https://github.com/your-username/create-pnpm-custom-app)
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
**Made by [Your Name]**
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# ==================================================
|
|
2
|
+
# SERVER CONFIGURATION
|
|
3
|
+
# ==================================================
|
|
4
|
+
PORT=3002
|
|
5
|
+
NODE_ENV=development
|
|
6
|
+
|
|
7
|
+
# ==================================================
|
|
8
|
+
# DATABASE
|
|
9
|
+
# ==================================================
|
|
10
|
+
# MongoDB connection string
|
|
11
|
+
# Local: mongodb://localhost:27017/your-database
|
|
12
|
+
# Atlas: mongodb+srv://username:password@cluster.mongodb.net/database
|
|
13
|
+
MONGODB_URI=mongodb://localhost:27017/your-database
|
|
14
|
+
|
|
15
|
+
# ==================================================
|
|
16
|
+
# AUTHENTICATION
|
|
17
|
+
# ==================================================
|
|
18
|
+
# Secret key for JWT tokens (generate a strong random string)
|
|
19
|
+
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
|
|
20
|
+
BCRYPT_ROUNDS=10
|
|
21
|
+
|
|
22
|
+
# ==================================================
|
|
23
|
+
# CORS
|
|
24
|
+
# ==================================================
|
|
25
|
+
# Allowed origins for CORS (comma-separated for multiple origins)
|
|
26
|
+
# Development: http://localhost:3000
|
|
27
|
+
# Production: https://your-domain.com
|
|
28
|
+
CORS_ORIGIN=http://localhost:3000
|
|
29
|
+
|
|
30
|
+
# ==================================================
|
|
31
|
+
# THIRD-PARTY SERVICES (Examples)
|
|
32
|
+
# ==================================================
|
|
33
|
+
# EMAIL_SERVICE_API_KEY=
|
|
34
|
+
# STRIPE_SECRET_KEY=
|
|
35
|
+
# AWS_ACCESS_KEY_ID=
|
|
36
|
+
# AWS_SECRET_ACCESS_KEY=
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import eslint from '@eslint/js';
|
|
2
|
+
import tseslint from 'typescript-eslint';
|
|
3
|
+
|
|
4
|
+
export default tseslint.config(
|
|
5
|
+
eslint.configs.recommended,
|
|
6
|
+
...tseslint.configs.recommended,
|
|
7
|
+
{
|
|
8
|
+
ignores: ['node_modules/**', 'dist/**', 'coverage/**'],
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
rules: {
|
|
12
|
+
'@typescript-eslint/no-explicit-any': 'error',
|
|
13
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
14
|
+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
.pnp
|
|
4
|
+
.pnp.js
|
|
5
|
+
|
|
6
|
+
# Production
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
|
|
10
|
+
# Environment variables
|
|
11
|
+
.env
|
|
12
|
+
.env.local
|
|
13
|
+
.env.*.local
|
|
14
|
+
!.env.example
|
|
15
|
+
|
|
16
|
+
# Logs
|
|
17
|
+
*.log
|
|
18
|
+
npm-debug.log*
|
|
19
|
+
yarn-debug.log*
|
|
20
|
+
yarn-error.log*
|
|
21
|
+
pnpm-debug.log*
|
|
22
|
+
lerna-debug.log*
|
|
23
|
+
|
|
24
|
+
# Testing
|
|
25
|
+
coverage/
|
|
26
|
+
.nyc_output
|
|
27
|
+
|
|
28
|
+
# OS
|
|
29
|
+
.DS_Store
|
|
30
|
+
*.pem
|
|
31
|
+
Thumbs.db
|
|
32
|
+
|
|
33
|
+
# IDE
|
|
34
|
+
.vscode/*
|
|
35
|
+
!.vscode/settings.json
|
|
36
|
+
!.vscode/extensions.json
|
|
37
|
+
.idea/
|
|
38
|
+
*.swp
|
|
39
|
+
*.swo
|
|
40
|
+
*~
|
|
41
|
+
|
|
42
|
+
# Temporary files
|
|
43
|
+
*.tmp
|
|
44
|
+
.cache
|
|
45
|
+
.tsbuildinfo
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
preset: 'ts-jest/presets/default-esm',
|
|
3
|
+
testEnvironment: 'node',
|
|
4
|
+
roots: ['<rootDir>/src'],
|
|
5
|
+
testMatch: ['**/__tests__/**/*.ts', '**/?(*.)+(spec|test).ts'],
|
|
6
|
+
setupFilesAfterEnv: ['<rootDir>/src/tests/setup.ts'],
|
|
7
|
+
transform: {
|
|
8
|
+
'^.+\\.ts$': [
|
|
9
|
+
'ts-jest',
|
|
10
|
+
{
|
|
11
|
+
useESM: true,
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
moduleNameMapper: {
|
|
16
|
+
'^(\\.{1,2}/.*)\\.js$': '$1',
|
|
17
|
+
},
|
|
18
|
+
extensionsToTreatAsEsm: ['.ts'],
|
|
19
|
+
coverageDirectory: 'coverage',
|
|
20
|
+
collectCoverageFrom: ['src/**/*.ts', '!src/**/*.test.ts', '!src/**/*.d.ts'],
|
|
21
|
+
coveragePathIgnorePatterns: ['/node_modules/', '/dist/'],
|
|
22
|
+
};
|