Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0824474e70 |
No files matched your search
+104
@@ -0,0 +1,104 @@
|
||||
# OS Files
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# Dependencies
|
||||
node_modules/
|
||||
.pnp.*
|
||||
yarn-error.log
|
||||
|
||||
# Build outputs
|
||||
dist/
|
||||
build/
|
||||
*.js
|
||||
*.ts.map
|
||||
*.bundle.js
|
||||
.next/
|
||||
out/
|
||||
coverage/
|
||||
|
||||
# Environment files
|
||||
.env
|
||||
.env.local
|
||||
.env.*.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.env.example # Only if you want to commit it (usually shouldn't)
|
||||
|
||||
# Logs
|
||||
logs/
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Editor and IDE files
|
||||
.idea/
|
||||
.vscode/
|
||||
*.sublime-project
|
||||
*.sublime-workspace
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
.project
|
||||
.classpath
|
||||
.settings/
|
||||
.svn/
|
||||
|
||||
# Testing
|
||||
.nyc_output/
|
||||
.jest.cache/
|
||||
.pnp.loader.mjs
|
||||
|
||||
# Debugging
|
||||
.debugger
|
||||
.debug.*
|
||||
.history/
|
||||
|
||||
# Misc
|
||||
.cache/
|
||||
.temp/
|
||||
.tmp/
|
||||
.pid
|
||||
*.pid.lock
|
||||
*.seed
|
||||
session_data/
|
||||
|
||||
# Temporary files
|
||||
*.tmp
|
||||
*.cache
|
||||
*~
|
||||
|
||||
# Database files (if applicable)
|
||||
*.sqlite
|
||||
*.db
|
||||
*.sql.backup
|
||||
|
||||
# Local configuration
|
||||
config.local.json
|
||||
local.conf
|
||||
settings.local.*
|
||||
|
||||
# Package lock files (choose one - don't commit multiple)
|
||||
yarn.lock # if using yarn instead of npm
|
||||
package-lock.json # if not using yarn
|
||||
|
||||
# Documentation generation (if used)
|
||||
docs/_build/
|
||||
*.html.unchecked
|
||||
|
||||
# Linting (if using tools that generate config)
|
||||
.eslintcache
|
||||
|
||||
# Secrets and tokens
|
||||
.gitcredentials
|
||||
.azure-devops.yml
|
||||
.vscode/settings.json
|
||||
+259
@@ -0,0 +1,259 @@
|
||||
# Contributing to newzy
|
||||
|
||||
First off, thank you for considering contributing to **newzy**! It's people like you that make this project great.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Code of Conduct](#code-of-conduct)
|
||||
- [Getting Started](#getting-started)
|
||||
- [How to Contribute](#how-to-contribute)
|
||||
- [Branch Strategy](#branch-strategy)
|
||||
- [Git Workflow](#git-workflow)
|
||||
- [Commit Message Guidelines](#commit-message-guidelines)
|
||||
- [Pull Request Process](#pull-request-process)
|
||||
- [Reporting Bugs](#reporting-bugs)
|
||||
- [Adding Features](#adding-features)
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
Please be respectful and constructive. We aim to maintain a welcoming environment for all contributors.
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Prerequisites
|
||||
|
||||
Before contributing, ensure you have:
|
||||
- Node.js v18+ installed
|
||||
- npm or yarn installed
|
||||
- Git configured with your email and name:
|
||||
```bash
|
||||
git config --global user.email "you@example.com"
|
||||
git config --global user.name "Your Name"
|
||||
```
|
||||
|
||||
### Setup Development Environment
|
||||
|
||||
```bash
|
||||
git clone <repository-url>
|
||||
cd newzy
|
||||
npm install
|
||||
cp .env.example .env
|
||||
# Update .env with your configuration
|
||||
npm run dev
|
||||
```
|
||||
|
||||
## How to Contribute
|
||||
|
||||
### 1. Find or Create an Issue
|
||||
|
||||
- Check existing issues for similar problems/features
|
||||
- If no issue exists, create one describing the problem/feature clearly
|
||||
- Reference relevant documentation or examples if applicable
|
||||
|
||||
### 2. Fork and Clone the Repository
|
||||
|
||||
```bash
|
||||
git clone https://github.com/<your-username>/newzy.git
|
||||
cd newzy
|
||||
git remote add upstream https://github.com/<owner>/newzy.git
|
||||
```
|
||||
|
||||
### 3. Create a Branch
|
||||
|
||||
Follow our [branch strategy](#branch-strategy) below.
|
||||
|
||||
### 4. Make Your Changes
|
||||
|
||||
- Follow the existing code style
|
||||
- Write tests for new features/bug fixes
|
||||
- Update documentation as needed
|
||||
|
||||
### 5. Test Locally
|
||||
|
||||
Ensure your changes work correctly before submitting.
|
||||
|
||||
### 6. Commit Your Changes
|
||||
|
||||
Use [commit message guidelines](#commit-message-guidelines) below.
|
||||
|
||||
### 7. Create a Pull Request
|
||||
|
||||
Fill out the PR template, reference issues, and ensure all CI checks pass.
|
||||
|
||||
## Branch Strategy
|
||||
|
||||
Our repository uses a standard Git flow with the following branches:
|
||||
|
||||
### `main` (Production)
|
||||
- **Purpose**: Production-ready, stable releases only
|
||||
- **Branch protection**: Enabled
|
||||
- **Access**: Requires approval for merges
|
||||
- **Content**: Merged, tested, and approved code
|
||||
|
||||
### `develop` (Integration)
|
||||
- **Purpose**: Integration branch for feature development
|
||||
- **Branch protection**: Enabled with checks required
|
||||
- **Access**: Open for contributors
|
||||
- **Content**: Completed features ready for next release
|
||||
|
||||
### Feature Branches (`feature/*`)
|
||||
- **Pattern**: `feature/<feature-name>` or `feature/issue-number/<short-description>`
|
||||
- **Example**: `feature/42/article-search` or `feature/article-search`
|
||||
- **Usage**: Create from `develop`, merge back to `develop` when complete
|
||||
|
||||
### Bugfix Branches (`bugfix/*`)
|
||||
- **Pattern**: `bugfix/<bug-name>` or `bugfix/issue-number/<short-description>`
|
||||
- **Example**: `bugfix/43/image-upload-crash`
|
||||
- **Usage**: Create from `develop`, merge back to both `develop` and `main` if critical
|
||||
|
||||
### Hotfix Branches (`hotfix/*`)
|
||||
- **Pattern**: `hotfix/<issue-number>-<description>`
|
||||
- **Example**: `hotfix/50-critical-login-fix`
|
||||
- **Usage**: Create from `main`, merge back to both `main` and `develop`
|
||||
|
||||
## Git Workflow
|
||||
|
||||
### Pre-push Hooks
|
||||
|
||||
We use pre-push hooks to enforce code quality. These automatically:
|
||||
- Run linting checks
|
||||
- Build the project (if applicable)
|
||||
- Ensure no sensitive files are committed
|
||||
|
||||
To see hook output, run with verbose flags or check the `.github/hooks/pre-push.sh` script.
|
||||
|
||||
### Merge Conflict Resolution Strategy
|
||||
|
||||
1. **First responder owns**: The person who first modifies conflicting code takes responsibility
|
||||
2. **Communicate early**: Notify team members immediately of conflicts
|
||||
3. **Use git merge tools**: Visual diff tools help resolve conflicts cleanly
|
||||
4. **Test thoroughly**: All merged code must pass tests
|
||||
5. **Update documentation**: Document any workflow changes
|
||||
|
||||
Recommended merge tool: [VSCode Merge Conflict Resolution](https://marketplace.visualstudio.com/items?itemName=rogalmi.bash-merge-tool) or [KDiff3](https://kdiff3.org/)
|
||||
|
||||
## Commit Message Guidelines
|
||||
|
||||
We follow the [Conventional Commits](https://www.conventionalcommits.org/) format:
|
||||
|
||||
```
|
||||
<type>(<scope>): <subject>
|
||||
|
||||
<body>
|
||||
|
||||
<footer>
|
||||
```
|
||||
|
||||
### Types
|
||||
|
||||
| Type | Description | Example |
|
||||
|-----------|------------------------------------------------------|----------------------------------|
|
||||
| `feat` | New feature that changes functionality | `feat: add user login system` |
|
||||
| `fix` | Bug fix | `fix: resolve login redirect bug` |
|
||||
| `docs` | Documentation changes | `docs: update API docs` |
|
||||
| `style` | Code style changes (formatting, etc.) | `style: format JavaScript files` |
|
||||
| `refactor`| Code refactoring without behavior changes | `refactor: simplify auth module` |
|
||||
| `test` | Adding or fixing tests | `test: add login unit tests` |
|
||||
| `chore` | Maintenance tasks | `chore: update dependencies` |
|
||||
|
||||
### Scope (Optional)
|
||||
|
||||
Scope should be lowercase and match the feature/module name:
|
||||
- `auth`, `database`, `api`, `frontend`, `ui`, etc.
|
||||
|
||||
### Subject Guidelines
|
||||
|
||||
- Use imperative, present tense ("add" not "added" or "adds")
|
||||
- Don't capitalize first letter
|
||||
- No period at end
|
||||
- Keep it short and descriptive
|
||||
|
||||
### Example Commit Messages
|
||||
|
||||
```bash
|
||||
# Correct:
|
||||
feat(auth): add email validation to registration form
|
||||
|
||||
fix(database): resolve connection timeout issue
|
||||
|
||||
docs(api): update endpoint documentation with new auth requirements
|
||||
|
||||
refactor(ui): extract reusable header component
|
||||
|
||||
test: improve coverage for search functionality
|
||||
|
||||
chore(deps): bump lodash from 4.17.20 to 4.17.21
|
||||
```
|
||||
|
||||
### Conventions
|
||||
|
||||
- **Add**: Add something that doesn't exist yet (new files)
|
||||
- **Fix**: Something broken, missing, or not working as expected
|
||||
- **Revert**: Revert previous commits
|
||||
- **Style**: White-space, formatting, missing semi-colons, etc.
|
||||
- **Refactor**: Completely changing the structure (not adding/removing features)
|
||||
- **Test**: Adding tests for existing code
|
||||
- **Build**: Changes that affect the build system or external dependencies
|
||||
- **Chore**: Maintenance tasks
|
||||
|
||||
## Pull Request Process
|
||||
|
||||
1. **Fork** the repository
|
||||
2. **Clone** your fork
|
||||
3. **Create a feature branch** from `develop`
|
||||
4. **Make your changes** and ensure tests pass
|
||||
5. **Commit** with proper message format
|
||||
6. **Push** to your fork
|
||||
7. **Open a pull request** to `develop` (or `main` for hotfixes)
|
||||
|
||||
### Pull Request Template Requirements
|
||||
|
||||
Your PR must include:
|
||||
- [ ] Description of changes
|
||||
- [ ] Issue numbers referenced (if applicable)
|
||||
- [ ] Screenshots/recordings (for UI changes)
|
||||
- [ ] Before/after code comparison (for refactors)
|
||||
- [ ] Test results or coverage reports
|
||||
- [ ] Any breaking changes noted
|
||||
|
||||
### PR Checklist
|
||||
|
||||
- [x] All tests pass locally
|
||||
- [x] Code follows project style guidelines
|
||||
- [x] Commit messages follow Conventional Commits format
|
||||
- [x] Documentation updated (if applicable)
|
||||
- [x] No sensitive information committed
|
||||
- [x] PR is against the correct branch (`develop` or `main`)
|
||||
- [x] All CI checks pass
|
||||
|
||||
## Reporting Bugs
|
||||
|
||||
Please create an issue with:
|
||||
1. **Clear title** describing the problem
|
||||
2. **Steps to reproduce** (numbered list)
|
||||
3. **Expected behavior** vs **actual behavior**
|
||||
4. **Environment info**: browser, OS, node version, etc.
|
||||
5. **Screenshots** if applicable
|
||||
|
||||
## Adding Features
|
||||
|
||||
When adding new features:
|
||||
|
||||
1. **Create an issue** first - discuss implementation approach
|
||||
2. **Check dependencies** - minimize external libraries
|
||||
3. **Write tests** before implementing (TDD approach encouraged)
|
||||
4. **Update documentation** as needed
|
||||
5. **Add changelog entry** via commit message
|
||||
6. **Consider backwards compatibility**
|
||||
|
||||
## Code Review
|
||||
|
||||
- Be constructive and respectful
|
||||
- Focus on code quality, not personal preferences
|
||||
- Check for test coverage
|
||||
- Verify PR checklist is complete
|
||||
- Ensure commits follow guidelines
|
||||
|
||||
## Questions?
|
||||
|
||||
Open an issue or discuss in the project's issues section. We welcome all contributions!
|
||||
@@ -1,73 +1,21 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
MIT License
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
Copyright (c) 2024 newzy contributors
|
||||
|
||||
1. Definitions.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
||||
|
||||
Copyright 2026 daniel
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,55 +1,93 @@
|
||||
# News Benchmark
|
||||
# newzy - News Web Application
|
||||
|
||||
A benchmark that tests how local language models perform on real world software engineering tasks.
|
||||
A modern, responsive news web application built for efficient content management and user engagement.
|
||||
|
||||
## The challenge:
|
||||
## Overview
|
||||
|
||||
Make and maintain a news web application.
|
||||
**newzy** is a web-based platform for reading and managing news content. The project provides a clean interface for consuming news articles with features like:
|
||||
|
||||
## Structure
|
||||
- Real-time news updates
|
||||
- Category-based filtering
|
||||
- User-friendly search functionality
|
||||
- Responsive design for mobile and desktop
|
||||
|
||||
Most real applications, are not made in a single shot. This benchmark reflects this by simulating tickets as milestones. Each milestone is a separate markdown file, containing prompt, description, acceptance criteria, technical details, and QA notes.
|
||||
## Prerequisites
|
||||
|
||||
## Scoring
|
||||
Before you begin, ensure you have the following installed:
|
||||
|
||||
The model performing the benchmark will be scored against the acceptance criteria and the tests written as proof of work:
|
||||
- [Node.js](https://nodejs.org/) (v18 or higher)
|
||||
- [npm](https://www.npmjs.com/) or [yarn](https://yarnpkg.com/)
|
||||
- [Git](https://git-scm.com/)
|
||||
|
||||
| Score | Criteria |
|
||||
|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| 0 | Agent failed to implement acceptance criteria |
|
||||
| 1 | Agent partially implemented acceptance criteria that builds successfully |
|
||||
| 2 | Agent fully implemented acceptance criteria that builds successfully |
|
||||
| 3 | Agent fully implemented acceptance criteria that builds successfully, includes passing unit/integration tests with 50% code coverage |
|
||||
| 4 | Agent fully implemented acceptance criteria that builds successfully, includes passing unit/integration tests, passing end-to-end tests, with 80% code coverage |
|
||||
| 5 | Agent fully implemented acceptance criteria that builds successfully, includes passing unit/integration tests, and passing end-to-end tests with 100% code coverage |
|
||||
## Setup Instructions
|
||||
|
||||
## Milestones
|
||||
### 1. Clone the Repository
|
||||
|
||||
This benchmark consists of multiple milestones, each representing a separate task:
|
||||
```bash
|
||||
git clone <repository-url>
|
||||
cd newzy
|
||||
```
|
||||
|
||||
### M1: Git Repository Setup
|
||||
- [M1 - Setup Git Project](milestone/m1-setup-git-project-prompt.md)
|
||||
- [M1 - Setup Git Project Scoring](milestone/m1-setup-git-project-scoring.md)
|
||||
### 2. Install Dependencies
|
||||
|
||||
### M2: Backend Infrastructure
|
||||
- [M2 - Setup Backend](milestone/m2-setup-backend-prompt.md)
|
||||
- [M2 - Setup Backend Scoring](milestone/m2-setup-backend-scoring.md)
|
||||
```bash
|
||||
npm install
|
||||
# or
|
||||
yarn install
|
||||
```
|
||||
|
||||
### M3: Frontend Application
|
||||
This benchmark consists of multiple milestones, each representing a separate task:
|
||||
### 3. Environment Configuration
|
||||
|
||||
### M5: Authentication System
|
||||
- [M5 - Setup Authentication](milestone/m5-setup-authentication-prompt.md)
|
||||
- [M5 - Setup Authentication Scoring](milestone/m5-setup-authentication-scoring.md)
|
||||
Copy the example environment file and configure it:
|
||||
|
||||
### M6: Admin Area
|
||||
- [M6 - Setup Admin Area](milestone/m6-setup-admin-area-prompt.md)
|
||||
- [M6 - Setup Admin Area Scoring](milestone/m6-setup-admin-area-scoring.md)
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
Update the `.env` file with your specific configuration (database credentials, API keys, etc.).
|
||||
|
||||
## Tech Stack Variations
|
||||
### 4. Run Development Server
|
||||
|
||||
### Python
|
||||
- **Backend:** Python, FastAPI, SQLAlchemy, SQLite (data persisted in a Docker volume)
|
||||
- **Frontend:** React + TypeScript (Vite), lucide-react icons, served by nginx
|
||||
- **Compose:** two services, frontend proxies /api to the backend
|
||||
```bash
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
```
|
||||
|
||||
Visit `http://localhost:3000` in your browser.
|
||||
|
||||
### 5. Build for Production
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
npm start
|
||||
```
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
newzy/
|
||||
├── src/ # Application source code
|
||||
├── docs/ # Documentation files
|
||||
│ ├── architecture.md # System architecture
|
||||
│ └── api.md # API documentation
|
||||
├── tests/ # Test files
|
||||
├── public/ # Static assets
|
||||
├── .env.example # Environment variable template
|
||||
├── .gitignore # Git ignore rules
|
||||
├── LICENSE # MIT License
|
||||
├── README.md # This file
|
||||
└── CONTRIBUTING.md # Contribution guidelines
|
||||
```
|
||||
|
||||
## Getting Started
|
||||
|
||||
For developers new to the project, please read [CONTRIBUTING.md](CONTRIBUTING.md) to understand how to contribute.
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
||||
|
||||
## Support
|
||||
|
||||
For issues and feature requests, please create a GitHub issue or join our community discussions.
|
||||
+253
@@ -0,0 +1,253 @@
|
||||
# newzy - API Documentation
|
||||
|
||||
This document describes the API endpoints for the newzy news web application.
|
||||
|
||||
## Base URL
|
||||
|
||||
- Development: `http://localhost:3000/api`
|
||||
- Production: `<your-domain>/api`
|
||||
|
||||
## Authentication
|
||||
|
||||
Most endpoints require authentication via Bearer token. Include in headers:
|
||||
|
||||
```
|
||||
Authorization: Bearer <your-jwt-token>
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
## Common Response Formats
|
||||
|
||||
### Success Response
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {},
|
||||
"message": "Operation completed successfully"
|
||||
}
|
||||
```
|
||||
|
||||
### Error Response
|
||||
|
||||
```json
|
||||
{
|
||||
"success": false,
|
||||
"error": {
|
||||
"code": "ERROR_CODE",
|
||||
"message": "Human readable error message"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Authentication Endpoints
|
||||
|
||||
### POST /auth/register
|
||||
|
||||
Register a new user.
|
||||
|
||||
**Request Body:**
|
||||
```json
|
||||
{
|
||||
"email": "user@example.com",
|
||||
"password": "securePassword123",
|
||||
"name": "John Doe"
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
|
||||
"user": {
|
||||
"id": 1,
|
||||
"email": "user@example.com",
|
||||
"name": "John Doe"
|
||||
}
|
||||
},
|
||||
"message": "User registered successfully"
|
||||
}
|
||||
```
|
||||
|
||||
### POST /auth/login
|
||||
|
||||
Login and get authentication token.
|
||||
|
||||
**Request Body:**
|
||||
```json
|
||||
{
|
||||
"email": "user@example.com",
|
||||
"password": "securePassword123"
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
|
||||
"user": {
|
||||
"id": 1,
|
||||
"email": "user@example.com",
|
||||
"name": "John Doe"
|
||||
}
|
||||
},
|
||||
"message": "Login successful"
|
||||
}
|
||||
```
|
||||
|
||||
### POST /auth/logout
|
||||
|
||||
Logout and invalidate token.
|
||||
|
||||
**Request:** No body required
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"message": "Logged out successfully"
|
||||
}
|
||||
```
|
||||
|
||||
## Articles Endpoints
|
||||
|
||||
### GET /articles
|
||||
|
||||
List all articles with optional filtering.
|
||||
|
||||
**Query Parameters:**
|
||||
- `category`: Filter by category (optional)
|
||||
- `page`: Page number for pagination (default: 1)
|
||||
- `limit`: Items per page (default: 10, max: 50)
|
||||
- `search`: Search keyword (optional)
|
||||
|
||||
**Example:**
|
||||
```bash
|
||||
GET /articles?category=technology&page=1&limit=20&search=ai
|
||||
```
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"articles": [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "AI in Modern Technology",
|
||||
"content": "...",
|
||||
"author": "Jane Smith",
|
||||
"category": "technology",
|
||||
"publishedAt": "2024-01-15T10:30:00Z",
|
||||
"views": 1523
|
||||
}
|
||||
],
|
||||
"pagination": {
|
||||
"currentPage": 1,
|
||||
"totalPages": 5,
|
||||
"totalItems": 100
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### GET /articles/:id
|
||||
|
||||
Get a single article by ID.
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"article": {
|
||||
"id": 1,
|
||||
"title": "AI in Modern Technology",
|
||||
"content": "...",
|
||||
"author": "Jane Smith",
|
||||
"category": "technology",
|
||||
"publishedAt": "2024-01-15T10:30:00Z",
|
||||
"views": 1523,
|
||||
"imageUrl": "https://example.com/image.jpg"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### POST /articles
|
||||
|
||||
Create a new article (authenticated only).
|
||||
|
||||
**Request Body:**
|
||||
```json
|
||||
{
|
||||
"title": "New Article Title",
|
||||
"content": "Article content here...",
|
||||
"category": "technology",
|
||||
"author": "Author Name",
|
||||
"imageUrl": "https://example.com/image.jpg"
|
||||
}
|
||||
```
|
||||
|
||||
### PUT /articles/:id
|
||||
|
||||
Update an existing article (authenticated only).
|
||||
|
||||
**Request Body:**
|
||||
```json
|
||||
{
|
||||
"title": "Updated Title",
|
||||
"content": "Updated content...",
|
||||
"category": "technology"
|
||||
}
|
||||
```
|
||||
|
||||
### DELETE /articles/:id
|
||||
|
||||
Delete an article (authenticated with admin role only).
|
||||
|
||||
## Categories Endpoints
|
||||
|
||||
### GET /categories
|
||||
|
||||
List all categories.
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"categories": [
|
||||
{ "id": 1, "name": "Technology", "slug": "technology" },
|
||||
{ "id": 2, "name": "Sports", "slug": "sports" }
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### GET /categories/:id
|
||||
|
||||
Get a single category with its articles.
|
||||
|
||||
## Error Codes
|
||||
|
||||
| Code | Description | HTTP Status |
|
||||
|------|-------------|-------------|
|
||||
| `INVALID_CREDENTIALS` | Invalid email or password | 401 |
|
||||
| `TOKEN_EXPIRED` | JWT token has expired | 401 |
|
||||
| `UNAUTHORIZED` | Missing or invalid token | 401 |
|
||||
| `NOT_FOUND` | Resource not found | 404 |
|
||||
| `INTERNAL_ERROR` | Server-side error | 500 |
|
||||
|
||||
## Rate Limiting
|
||||
|
||||
API endpoints are rate limited to prevent abuse:
|
||||
- **100 requests per minute** per IP address
|
||||
- Headers include remaining quota:
|
||||
- `X-RateLimit-Limit: 100`
|
||||
- `X-RateLimit-Remaining: 95`
|
||||
- `X-RateLimit-Reset: <timestamp>`
|
||||
@@ -0,0 +1,95 @@
|
||||
# newzy - System Architecture
|
||||
|
||||
This document describes the architecture of the newzy news web application.
|
||||
|
||||
## High-Level Architecture
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────┐
|
||||
│ Client Layer │
|
||||
│ (Browser-based Web Application) │
|
||||
│ ┌─────────────────┬─────────────────┬──────────┐ │
|
||||
│ │ Frontend │ API Calls │ State │ │
|
||||
│ │ Framework │ REST/GraphQL │ Mgmt │ │
|
||||
│ └─────────────────┴─────────────────┴──────────┘ │
|
||||
└─────────────────────────────────────────────────────┘
|
||||
▼
|
||||
┌─────────────────────────────────────────────────────┐
|
||||
│ API Layer │
|
||||
│ (Node.js/Express Backend) │
|
||||
│ ┌─────────────────┬─────────────────┬──────────┐ │
|
||||
│ │ Authentication │ Validation │ Routes │ │
|
||||
│ │ Middleware │ Error Handling │ Controllers│
|
||||
│ └─────────────────┴─────────────────┴──────────┘ │
|
||||
└─────────────────────────────────────────────────────┘
|
||||
▼
|
||||
┌─────────────────────────────────────────────────────┐
|
||||
│ Data Layer │
|
||||
│ (Database & Cache) │
|
||||
│ ┌─────────────────┬─────────────────┬──────────┐ │
|
||||
│ │ Primary DB │ Caching │ Backup │ │
|
||||
│ │ Service │ Service │ Service │ │
|
||||
│ └─────────────────┴─────────────────┴──────────┘ │
|
||||
└─────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
## Core Components
|
||||
|
||||
### Frontend
|
||||
- **Framework**: React (latest stable version)
|
||||
- **State Management**: Context API or Redux (as needed)
|
||||
- **Styling**: CSS Modules / Tailwind CSS
|
||||
- **Routing**: React Router v6
|
||||
|
||||
### Backend
|
||||
- **Runtime**: Node.js 18 LTS
|
||||
- **Framework**: Express.js
|
||||
- **Database ORM**: Sequelize
|
||||
- **Authentication**: JWT with bcrypt password hashing
|
||||
|
||||
### Database
|
||||
- **Primary**: PostgreSQL (production), SQLite (development)
|
||||
- **Caching**: Redis (optional for performance)
|
||||
|
||||
## File Structure
|
||||
|
||||
```
|
||||
newzy/
|
||||
├── src/
|
||||
│ ├── api/ # API routes and controllers
|
||||
│ │ ├── auth/ # Authentication endpoints
|
||||
│ │ ├── articles/ # Article management endpoints
|
||||
│ │ └── categories/ # Category endpoints
|
||||
│ ├── models/ # Database models
|
||||
│ ├── utils/ # Utility functions
|
||||
│ └── config/ # Configuration files
|
||||
├── docs/ # Documentation (this file)
|
||||
├── tests/ # Test suite
|
||||
└── public/ # Static assets
|
||||
```
|
||||
|
||||
## API Endpoints (Planned)
|
||||
|
||||
| Method | Endpoint | Description |
|
||||
|--------|--------------------|----------------------|
|
||||
| GET | /api/articles | List all articles |
|
||||
| GET | /api/articles/:id | Get article by ID |
|
||||
| POST | /api/articles | Create new article |
|
||||
| PUT | /api/articles/:id | Update article |
|
||||
| DELETE | /api/articles/:id | Delete article |
|
||||
|
||||
## Security Considerations
|
||||
|
||||
- HTTPS only in production
|
||||
- Rate limiting on API endpoints
|
||||
- Input validation and sanitization
|
||||
- CORS configuration
|
||||
- Environment variable management for secrets
|
||||
|
||||
## Future Enhancements
|
||||
|
||||
- WebSocket support for real-time updates
|
||||
- GraphQL API implementation
|
||||
- CDN integration for static assets
|
||||
- Multi-language support (i18n)
|
||||
- Admin dashboard
|
||||
Reference in new issue
Block a user