···11+# Contributor Covenant Code of Conduct
22+33+## Our pledge
44+55+In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
66+77+## Our standards
88+99+Examples of behavior that contributes to creating a positive environment include:
1010+1111+- Using welcoming and inclusive language
1212+- Being respectful of differing viewpoints and experiences
1313+- Gracefully accepting constructive criticism
1414+- Focusing on what is best for the community
1515+- Showing empathy towards other community members
1616+1717+Examples of unacceptable behavior by participants include:
1818+1919+- The use of sexualized language or imagery and unwelcome sexual attention or advances
2020+- Trolling, insulting/derogatory comments, and personal or political attacks
2121+- Public or private harassment
2222+- Publishing others' private information, such as a physical or electronic address, without explicit permission
2323+- Other conduct which could reasonably be considered inappropriate in a professional setting
2424+2525+## Our responsibilities
2626+2727+Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
2828+2929+Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
3030+3131+## Scope
3232+3333+This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
3434+3535+## Enforcement
3636+3737+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [daniel@roe.dev](mailto:daniel@roe.dev). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
3838+3939+Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
4040+4141+## Attribution
4242+4343+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
4444+4545+[homepage]: https://www.contributor-covenant.org
4646+4747+For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq
+227
CONTRIBUTING.md
···11+# Contributing to npmx.dev
22+33+Thank you for your interest in contributing! ❤️ This document provides guidelines and instructions for contributing.
44+55+> [!IMPORTANT]
66+> Please be respectful and constructive in all interactions. We aim to maintain a welcoming environment for all contributors.
77+> [👉 Read more](./CODE_OF_CONDUCT.md)
88+99+## Goals
1010+1111+We want to create 'a fast, modern browser for the npm registry for power users.' This means, among other things:
1212+1313+- We don't aim to replace the [npmjs.com](https://www.npmjs.com/) registry, just provide a better UI and DX.
1414+- Layout shift, flakiness, slowness is The Worst. We need to continually iterate to create the most performant, best DX for power users.
1515+- We want to provide information in the best way. We don't want noise, cluttered display, or confusing UI. If in doubt: choose simplicity.
1616+1717+## Getting started
1818+1919+### Prerequisites
2020+2121+- [Node.js](https://nodejs.org/) (LTS version recommended)
2222+- [pnpm](https://pnpm.io/) v10.28.1 or later
2323+2424+### Setup
2525+2626+1. fork and clone the repository
2727+2. install dependencies:
2828+2929+ ```bash
3030+ pnpm install
3131+ ```
3232+3333+3. start the development server:
3434+3535+ ```bash
3636+ pnpm dev
3737+ ```
3838+3939+4. (optional) if you want to test the admin UI/flow, you can run the local connector:
4040+4141+ ```bash
4242+ pnpm npmx-connector
4343+ ```
4444+4545+## Development workflow
4646+4747+### Available commands
4848+4949+```bash
5050+# Development
5151+pnpm dev # Start development server
5252+pnpm build # Production build
5353+pnpm preview # Preview production build
5454+5555+# Code Quality
5656+pnpm lint # Run linter (oxlint + oxfmt)
5757+pnpm lint:fix # Auto-fix lint issues
5858+pnpm test:types # TypeScript type checking
5959+6060+# Testing
6161+pnpm test # Run all Vitest tests
6262+pnpm test:unit # Unit tests only
6363+pnpm test:nuxt # Nuxt component tests
6464+pnpm test:browser # Playwright E2E tests
6565+```
6666+6767+### Project structure
6868+6969+```
7070+app/ # Nuxt 4 app directory
7171+├── components/ # Vue components (PascalCase.vue)
7272+├── composables/ # Vue composables (useFeature.ts)
7373+├── pages/ # File-based routing
7474+├── plugins/ # Nuxt plugins
7575+├── app.vue # Root component
7676+└── error.vue # Error page
7777+7878+server/ # Nitro server
7979+├── api/ # API routes
8080+└── utils/ # Server utilities
8181+8282+shared/ # Shared between app and server
8383+└── types/ # TypeScript type definitions
8484+8585+cli/ # Local connector CLI (separate workspace)
8686+test/ # Vitest tests
8787+├── unit/ # Unit tests (*.spec.ts)
8888+└── nuxt/ # Nuxt component tests
8989+tests/ # Playwright E2E tests
9090+```
9191+9292+> [!TIP]
9393+> For more about the meaning of these directories, check out the docs on the [Nuxt directory structure](https://nuxt.com/docs/4.x/directory-structure).
9494+9595+## Code style
9696+9797+### Typescript
9898+9999+- We care about good types – never cast things to `any` 💪
100100+- Validate rather than just assert
101101+102102+### Import order
103103+104104+1. Type imports first (`import type { ... }`)
105105+2. External packages
106106+3. Internal aliases (`#shared/types`, `#server/`, etc.)
107107+4. No blank lines between groups
108108+109109+```typescript
110110+import type { Packument, NpmSearchResponse } from '#shared/types'
111111+import type { Tokens } from 'marked'
112112+import { marked } from 'marked'
113113+import { hasProtocol } from 'ufo'
114114+```
115115+116116+### Naming conventions
117117+118118+| Type | Convention | Example |
119119+| ---------------- | ------------------------ | ------------------------------ |
120120+| Vue components | PascalCase | `MarkdownText.vue` |
121121+| Pages | kebab-case | `search.vue`, `[...name].vue` |
122122+| Composables | camelCase + `use` prefix | `useNpmRegistry.ts` |
123123+| Server routes | kebab-case + method | `search.get.ts` |
124124+| Functions | camelCase | `fetchPackage`, `formatDate` |
125125+| Constants | SCREAMING_SNAKE_CASE | `NPM_REGISTRY`, `ALLOWED_TAGS` |
126126+| Types/Interfaces | PascalCase | `NpmSearchResponse` |
127127+128128+### Vue components
129129+130130+- Use Composition API with `<script setup lang="ts">`
131131+- Define props with TypeScript: `defineProps<{ text: string }>()`
132132+- Keep functions under 50 lines
133133+- Accessibility is a first-class consideration – always consider ARIA attributes and keyboard navigation
134134+135135+```vue
136136+<script setup lang="ts">
137137+import type { PackumentVersion } from '#shared/types'
138138+139139+const props = defineProps<{
140140+ version: PackumentVersion
141141+}>()
142142+</script>
143143+```
144144+145145+Ideally, extract utilities into separate files so they can be unit tested. 🙏
146146+147147+## Testing
148148+149149+### Unit tests
150150+151151+Write unit tests for core functionality using Vitest:
152152+153153+```typescript
154154+import { describe, it, expect } from 'vitest'
155155+156156+describe('featureName', () => {
157157+ it('should handle expected case', () => {
158158+ expect(result).toBe(expected)
159159+ })
160160+})
161161+```
162162+163163+> [!TIP]
164164+> If you need access to the Nuxt context in your unit or component test, place your test in the `test/nuxt/` directory and run with `pnpm test:nuxt`
165165+166166+### E2e tests
167167+168168+Write end-to-end tests using Playwright:
169169+170170+```bash
171171+pnpm test:browser # Run tests
172172+pnpm test:browser:ui # Run with Playwright UI
173173+```
174174+175175+Make sure to read about [Playwright best practices](https://playwright.dev/docs/best-practices) and don't rely on classes/IDs but try to follow user-replicable behaviour (like selecting an element based on text content instead).
176176+177177+## Submitting changes
178178+179179+### Before submitting
180180+181181+1. Ensure your code follows the style guidelines
182182+2. Run linting: `pnpm lint:fix`
183183+3. Run type checking: `pnpm test:types`
184184+4. Run tests: `pnpm test`
185185+5. Write or update tests for your changes
186186+187187+### Pull request process
188188+189189+1. Create a feature branch from `main`
190190+2. Make your changes with clear, descriptive commits
191191+3. Push your branch and open a pull request
192192+4. Ensure CI checks pass (lint, type check, tests)
193193+5. Request review from maintainers
194194+195195+### Commit messages
196196+197197+Write clear, concise commit messages that explain the "why" behind changes:
198198+199199+- `fix: resolve search pagination issue`
200200+- `feat: add package version comparison`
201201+- `docs: update installation instructions`
202202+203203+## Pre-commit hooks
204204+205205+The project uses `lint-staged` with `simple-git-hooks` to automatically lint files on commit.
206206+207207+## Using AI
208208+209209+You're welcome to use AI tools to help you contribute. But there are two important ground rules:
210210+211211+### 1. Never let an LLM speak for you
212212+213213+When you write a comment, issue, or PR description, use your own words. Grammar and spelling don't matter – real connection does. AI-generated summaries tend to be long-winded, dense, and often inaccurate. Simplicity is an art. The goal is not to sound impressive, but to communicate clearly.
214214+215215+### 2. Never let an LLM think for you
216216+217217+Feel free to use AI to write code, tests, or point you in the right direction. But always understand what it's written before contributing it. Take personal responsibility for your contributions. Don't say "ChatGPT says..." – tell us what _you_ think.
218218+219219+For more context, see [Using AI in open source](https://roe.dev/blog/using-ai-in-open-source).
220220+221221+## Questions?
222222+223223+If you have questions or need help, feel free to open an issue for discussion or join our [Discord server](https://chat.npmx.dev).
224224+225225+## License
226226+227227+By contributing to npmx.dev, you agree that your contributions will be licensed under the [MIT License](LICENSE).