Skip to content

Commit 99def55

Browse files
committed
chore(ci): add initial project configuration and setup scripts
- Add .editorconfig for consistent coding styles and line endings - Create .gitattributes to handle text and binary files properly - Expand .gitignore with common files, logs, environment files, and editor configs - Add .nvmrc to set Node.js version to 20 for the project - Introduce CONTRIBUTING.md outlining contribution guidelines and workflows - Update package.json scripts with format:check, lint:check, typecheck, setup, and verify commands - Enhance README.md with quick start instructions and development info - Add GitHub issue and PR templates for bug reports, feature requests, questions, and PR submissions - Set up GitHub Actions workflow for CI including lint, format, typecheck, tests, and build steps - Implement setup.sh script for automated local setup: node/npm checks, dependencies install, env file creation, optional Docker services startup, and smoke tests verification
1 parent 7e3a41c commit 99def55

30 files changed

Lines changed: 2067 additions & 1566 deletions

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2
16+
17+
[Makefile]
18+
indent_style = tab

.gitattributes

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Auto-detect text files
2+
* text=auto eol=lf
3+
4+
# Source code
5+
*.ts text eol=lf
6+
*.js text eol=lf
7+
*.json text eol=lf
8+
*.yml text eol=lf
9+
*.yaml text eol=lf
10+
*.md text eol=lf
11+
12+
# Shell scripts
13+
*.sh text eol=lf
14+
15+
# Windows-friendly batch files
16+
*.bat text eol=crlf
17+
18+
# Binary files
19+
*.png binary
20+
*.jpg binary
21+
*.jpeg binary
22+
*.gif binary
23+
*.ico binary
24+
*.pdf binary
25+
*.woff binary
26+
*.woff2 binary
27+
28+
# Prevent merge conflicts on lock files (generated)
29+
package-lock.json -diff
30+
yarn.lock -diff
31+
pnpm-lock.yaml -diff
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Bug report
2+
description: Report broken or unexpected behavior
3+
labels: ["bug", "triage"]
4+
---
5+
6+
## Describe the bug
7+
8+
<!-- A clear, one-paragraph description of what went wrong. -->
9+
10+
## Steps to reproduce
11+
12+
1.
13+
2.
14+
3.
15+
16+
## Expected behavior
17+
18+
<!-- What you thought would happen. -->
19+
20+
## Actual behavior
21+
22+
<!-- What actually happened. Paste error output, stack traces, or screenshots. -->
23+
24+
```text
25+
<paste logs here>
26+
```
27+
28+
## Environment
29+
30+
- OS: <!-- e.g. macOS 14.4, Ubuntu 22.04, Windows 11 -->
31+
- Node version: <!-- output of `node -v` -->
32+
- Branch / commit: <!-- output of `git rev-parse --abbrev-ref HEAD` and `git rev-parse --short HEAD` -->
33+
- Install method: <!-- npm ci / npm install / Docker -->
34+
- Are you running: <!-- local / docker-compose / production / staging -->
35+
36+
## Minimal reproduction
37+
38+
<!--
39+
If possible, a repo, code snippet, or curl command that reproduces the issue.
40+
Example:
41+
curl -X POST http://localhost:3000/api/v1/auth/wallet/challenge \
42+
-H 'Content-Type: application/json' \
43+
-d '{"walletAddress":"GABC..."}'
44+
-->
45+
46+
## Possible cause
47+
48+
<!-- Optional: your hypothesis about the root cause. -->
49+
50+
## Additional context
51+
52+
<!-- Anything else that might help — related issues, PRs, screenshots. -->
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Feature request
2+
description: Suggest a new feature or improvement
3+
labels: ["enhancement"]
4+
---
5+
6+
## Problem
7+
8+
<!-- What user-facing problem does this solve? Who is affected? -->
9+
10+
## Proposed solution
11+
12+
<!-- A clear description of what you want to happen. -->
13+
14+
## Alternatives considered
15+
16+
<!-- Other approaches you considered and why this one is better. -->
17+
18+
## Acceptance criteria
19+
20+
<!-- Bullet list of what "done" looks like. -->
21+
22+
- [ ]
23+
- [ ]
24+
- [ ]
25+
26+
## Out of scope
27+
28+
<!-- What this PR/feature will NOT do, to keep scope tight. -->
29+
30+
## Additional context
31+
32+
<!-- Mockups, related issues, prior art from other projects. -->

.github/ISSUE_TEMPLATE/question.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Question / Support
2+
description: Ask a question or request help (not a bug)
3+
labels: ["question"]
4+
---
5+
6+
## What are you trying to do?
7+
8+
<!-- One paragraph describing your goal. -->
9+
10+
## What have you tried?
11+
12+
<!-- Links to docs you read, commands you ran, etc. -->
13+
14+
## Environment (if relevant)
15+
16+
- OS:
17+
- Node version:
18+
- Branch / commit:
19+
20+
## Additional context
21+
22+
<!-- Anything else that might help us answer. -->

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
## What does this PR do?
2+
3+
<!-- One sentence summary. Example: "Adds JWT-based session refresh for the wallet-auth flow." -->
4+
5+
## Why?
6+
7+
<!-- Link the issue: Fixes #123, Closes #456, or "Part of #789" -->
8+
9+
## Type of change
10+
11+
- [ ] Bug fix (non-breaking change that fixes an issue)
12+
- [ ] New feature (non-breaking change that adds functionality)
13+
- [ ] Breaking change (fix or feature that would cause existing behavior to change)
14+
- [ ] Refactor (no behavior change)
15+
- [ ] Docs / CI / tooling
16+
17+
## How was it tested?
18+
19+
- [ ] Unit tests added/updated
20+
- [ ] E2E test added/updated
21+
- [ ] Manual verification steps below
22+
23+
<!-- Describe the manual verification you ran, including curl commands or screenshots. -->
24+
25+
## Checklist
26+
27+
- [ ] `npm run lint` passes
28+
- [ ] `npm run format:check` passes (run `npm run format` if not)
29+
- [ ] `npm run typecheck` passes
30+
- [ ] `npm test` passes
31+
- [ ] I added/updated tests for the change
32+
- [ ] I updated relevant docs (README, JSDoc, comments)
33+
- [ ] I added a changeset / migration if schema changed
34+
- [ ] I read `CONTRIBUTING.md`
35+
36+
## Screenshots / Logs
37+
38+
<!-- Paste logs, screenshots, or curl output that proves the change works. -->
39+
40+
## Risk & rollout
41+
42+
<!-- Who is affected? Does it need a feature flag? A migration? Backwards-incompatible? -->

.github/workflows/ci.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,23 @@ jobs:
1717
- name: Setup Node.js
1818
uses: actions/setup-node@v4
1919
with:
20-
node-version: '20' # Matches modern NextJs/NestJs standards
20+
node-version: '20'
2121
cache: 'npm'
2222

2323
- name: Install Dependencies
2424
run: npm ci
2525

2626
- name: Lint Check
27-
run: npm run lint # Ensures code quality before testing
27+
run: npm run lint:check
28+
29+
- name: Format Check
30+
run: npm run format:check
31+
32+
- name: TypeScript Type Check
33+
run: npm run typecheck
2834

2935
- name: Run Unit Tests
30-
run: npm run test
36+
run: npm test
3137

32-
- name: Run E2E Tests (Optional)
33-
run: npm run test:e2e
34-
continue-on-error: true # Prevents blocking if E2E is still in progress
38+
- name: Build
39+
run: npm run build

.gitignore

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,51 @@
1-
node_modules
1+
# Dependencies
2+
node_modules/
3+
jspm_packages/
4+
5+
# Build output
6+
dist/
7+
build/
8+
*.tsbuildinfo
9+
coverage/
10+
.nyc_output/
11+
12+
# Logs
213
*.log
14+
npm-debug.log*
15+
yarn-debug.log*
16+
yarn-error.log*
17+
pnpm-debug.log*
18+
lerna-debug.log*
319

420
# Environment files
521
.env
22+
.env.local
23+
.env.*.local
24+
.env.development
25+
.env.production
26+
27+
# Editor / OS
28+
.DS_Store
29+
Thumbs.db
30+
.idea/
31+
.vscode/*
32+
!.vscode/extensions.json
33+
!.vscode/settings.json
34+
*.swp
35+
*.swo
36+
37+
# Testing
38+
junit.xml
39+
test-results/
40+
playwright-report/
41+
playwright/.cache/
42+
43+
# Prisma / TypeORM generated
44+
prisma/migrations/dev/
645

7-
dist
46+
# Misc
47+
*.tgz
48+
.pnp.*
49+
.cache/
50+
.tmp/
51+
.temp/

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20

CONTRIBUTING.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Contributing to Quest Service
2+
3+
Thanks for your interest in contributing! This guide is intentionally short — it covers the **three things** that will get your PR merged fastest.
4+
5+
---
6+
7+
## 1. Local setup (one command)
8+
9+
```bash
10+
# Prereqs: Node 20+, npm 10+, Docker (for Postgres/Redis/RabbitMQ)
11+
nvm use # picks up the version pinned in .nvmrc
12+
npm install
13+
npm run setup # creates .env from .env.example and brings up docker
14+
```
15+
16+
> If you don't use Docker, edit `.env` to point at a local Postgres/Redis/RabbitMQ.
17+
18+
Verify the install with a quick smoke test:
19+
20+
```bash
21+
npm run typecheck # zero errors expected
22+
npm run lint # zero errors expected
23+
npm test # unit tests pass
24+
```
25+
26+
---
27+
28+
## 2. Before opening a PR — run this checklist
29+
30+
Run the same checks CI runs:
31+
32+
```bash
33+
npm run lint
34+
npm run format:check
35+
npm run typecheck
36+
npm test
37+
```
38+
39+
All four must pass. If `format:check` fails, run `npm run format` to auto-fix.
40+
41+
### Style at a glance
42+
43+
- **TypeScript**: 2-space indent, single quotes, trailing commas, semicolons (see `.editorconfig` + `.prettierrc`).
44+
- **NestJS**: one module per folder under `src/`. Each module exports a `*.module.ts` plus a controller, service, and DTOs.
45+
- **Naming**: `kebab-case` for files & folders, `PascalCase` for classes, `camelCase` for variables/functions.
46+
- **Imports**: use the explicit relative path (e.g. `../users/users.module`) — avoid deep `@/` aliases unless one already exists.
47+
- **Don't**: disable ESLint rules, add `// @ts-ignore`, or weaken `tsconfig.json` to make errors go away. Fix the code.
48+
49+
### Common bug sources to avoid
50+
51+
| Symptom | Fix |
52+
| --- | --- |
53+
| `Type 'undefined' is not assignable` after an `await` | Add a null-check or use `?? defaultValue` |
54+
| Service method returns `Promise<undefined>` | Return a value or annotate as `Promise<void>` |
55+
| Config value is `string \| undefined` | Use `configService.get<...>('KEY', defaultValue)` and provide a default |
56+
| Circular dependency crash | Move shared code into a third module; never import services across `app.module.ts` siblings |
57+
58+
---
59+
60+
## 3. PR rules
61+
62+
- **One concern per PR.** Don't bundle a refactor with a feature.
63+
- **Reference an issue** with `Fixes #123` in the description.
64+
- **Add or update tests** for any behavior change. New code without a test will be asked to add one.
65+
- **Fill in the PR template** (`.github/PULL_REQUEST_TEMPLATE.md`). The CI bot blocks PRs that don't.
66+
- **Keep diffs small.** Aim for <300 lines changed. Large refactors should be split.
67+
68+
A maintainer will review within 2 business days. If you don't hear back, ping the issue.
69+
70+
---
71+
72+
## Reporting bugs
73+
74+
Use the **Bug report** issue template at `.github/ISSUE_TEMPLATE/bug_report.md`. A great bug report includes:
75+
76+
1. What you did (steps to reproduce)
77+
2. What you expected
78+
3. What happened (logs/screenshots)
79+
4. Environment: OS, Node version, branch, commit SHA
80+
81+
Security issues: see `SECURITY.md` (or open a private security advisory — **do not** file a public issue).
82+
83+
---
84+
85+
## Project layout (the short version)
86+
87+
```
88+
src/
89+
app.module.ts # root composition root — add new modules here
90+
main.ts # bootstrap, helmet, cors, validation, sentry
91+
config/ # env validation + app config
92+
common/ # filters, interceptors, pipes, decorators
93+
<feature>/ # one folder per feature module
94+
<feature>.module.ts
95+
<feature>.controller.ts
96+
<feature>.service.ts
97+
dto/
98+
entities/
99+
tests/ # *.spec.ts colocated with source
100+
```
101+
102+
---
103+
104+
## Need help?
105+
106+
Open a question in Discussions, or ask in the PR — there's no such thing as a dumb question.

0 commit comments

Comments
 (0)