Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# SPDX-FileCopyrightText: 2025 SecPal Contributors
# SPDX-License-Identifier: CC0-1.0

# Dependencies
node_modules/

# Build artifacts
dist/
build/
.vite/
.turbo/

# Environment & Secrets
.env
.env.*
!.env.example
secrets/
credentials/
*.key
*.pem
*.p12
*.pfx
*.keystore
*.jks
.npmrc
.yarnrc

# Testing
coverage/
.nyc_output/

# IDE
.idea/
.vscode/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db
Desktop.ini

# Logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# Temporary files
*.tmp
*.temp
.cache/

# Storybook
storybook-static/
6 changes: 6 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"default": true,
"MD013": false,
"MD033": false,
"MD041": false
}
3 changes: 3 additions & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
LICENSES/
CHANGELOG.md
11 changes: 11 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SPDX-FileCopyrightText: 2025 SecPal
# SPDX-License-Identifier: CC0-1.0

node_modules/
dist/
build/
coverage/
package-lock.json
pnpm-lock.yaml
yarn.lock
.vite/
10 changes: 10 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"semi": true,
"trailingComma": "es5",
"singleQuote": false,
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"arrowParens": "always",
"endOfLine": "lf"
}
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- Initial repository setup
- React + TypeScript + Vite configuration
- Testing setup with Vitest and React Testing Library
- REUSE 3.3 compliance
- Pre-commit and pre-push quality gates

[unreleased]: https://github.com/SecPal/frontend/commits/main
5 changes: 5 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This project is licensed under the GNU Affero General Public License v3.0 or later.

See LICENSES/AGPL-3.0-or-later.txt for the full license text.

For third-party licenses, see the LICENSES/ directory.
210 changes: 208 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,208 @@
# frontend
React/TypeScript frontend for SecPal platform
<!--
SPDX-FileCopyrightText: 2025 SecPal
SPDX-License-Identifier: CC0-1.0
-->

# SecPal Frontend

[![REUSE Compliance](https://github.com/SecPal/frontend/actions/workflows/reuse.yml/badge.svg)](https://github.com/SecPal/frontend/actions/workflows/reuse.yml)
[![License Check](https://github.com/SecPal/frontend/actions/workflows/license-compatibility.yml/badge.svg)](https://github.com/SecPal/frontend/actions/workflows/license-compatibility.yml)
[![Quality Gates](https://github.com/SecPal/frontend/actions/workflows/quality.yml/badge.svg)](https://github.com/SecPal/frontend/actions/workflows/quality.yml)

React/TypeScript frontend for the SecPal platform.

## πŸ“‹ Prerequisites

- Node.js >= 20.0.0
- npm >= 10.0.0
- Git with GPG signing configured

## πŸš€ Getting Started

### Clone Repository

```bash
cd ~/code/SecPal
git clone https://github.com/SecPal/frontend.git
cd frontend
```

### ⚠️ IMPORTANT: Create Symlinks (DRY Principle)

**Before installing dependencies**, you MUST create symlinks to avoid file duplication:

```bash
# Navigate to frontend repository
cd ~/code/SecPal/frontend

# Create symlinks to .github repository (governance files)
ln -sf ../.github/CONTRIBUTING.md .
ln -sf ../.github/SECURITY.md .
ln -sf ../.github/CODE_OF_CONDUCT.md .
ln -sf ../.github/CODEOWNERS .
ln -sf ../.github/.editorconfig .editorconfig
ln -sf ../.github/.gitattributes .gitattributes

# Verify symlinks were created correctly
file CONTRIBUTING.md # Should show: symbolic link to ../.github/CONTRIBUTING.md
```

**Why symlinks?** To maintain DRY (Don't Repeat Yourself) principle across repositories. All governance files are centralized in the `.github` repository.

### Install Dependencies

```bash
npm install
```

### Setup Pre-Commit Hooks

```bash
./scripts/setup-pre-commit.sh
```

## πŸ› οΈ Development

### Start Development Server

```bash
npm run dev
```

### Build for Production

```bash
npm run build
```

### Run Tests

```bash
# Run all tests
npm test

# Run tests in watch mode
npm run test:ui

# Generate coverage report
npm run test:coverage
```

### Code Quality

```bash
# Lint code
npm run lint

# Type checking
npm run typecheck

# Format code
npm run format

# Check formatting
npm run format:check
```

### Pre-Push Validation

**Before every push**, run the preflight script:

```bash
./scripts/preflight.sh
```

This runs:

- βœ… Prettier formatting check
- βœ… Markdownlint
- βœ… REUSE compliance
- βœ… ESLint
- βœ… TypeScript type checking
- βœ… Vitest test suite
- βœ… PR size validation (≀600 lines)

## πŸ“ Project Structure

```
frontend/
β”œβ”€β”€ src/
β”‚ β”œβ”€β”€ components/ # React components
β”‚ β”œβ”€β”€ hooks/ # Custom hooks
β”‚ β”œβ”€β”€ pages/ # Page components
β”‚ β”œβ”€β”€ services/ # API services
β”‚ β”œβ”€β”€ types/ # TypeScript types
β”‚ β”œβ”€β”€ utils/ # Utility functions
β”‚ β”œβ”€β”€ App.tsx # Root component
β”‚ └── main.tsx # Entry point
β”œβ”€β”€ public/ # Static assets
β”œβ”€β”€ tests/ # Test files
β”œβ”€β”€ .github/ # GitHub workflows and templates
β”œβ”€β”€ scripts/ # Build and utility scripts
└── package.json # Dependencies and scripts
```

## πŸ§ͺ Testing Guidelines

- **Coverage target:** 80%+ for new code, 100% for critical paths
- **TDD mandatory:** Write failing test first, implement, refactor
- Use `@testing-library/react` for component testing
- Mock API calls with MSW (Mock Service Worker)
- Test user-visible behavior, not implementation

## πŸ”’ Security

- **Secret scanning:** Enabled with push protection
- **Dependabot:** Daily security updates (04:00 CET)
- **SAST:** CodeQL analysis on pull requests
- **Never commit:** API keys, passwords, tokens, `.env` files

See [SECURITY.md](SECURITY.md) for reporting vulnerabilities.

## πŸ“ Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

### Branch Naming Convention

- `feature/` - New features
- `fix/` - Bug fixes
- `docs/` - Documentation
- `refactor/` - Code refactoring
- `test/` - Test additions/fixes
- `chore/` - Maintenance
- `spike/` - Exploration (no TDD required, cannot merge to main)

### Commit Messages

Follow [Conventional Commits](https://www.conventionalcommits.org/):

```
feat: add user authentication
fix: resolve memory leak in dashboard
docs: update API integration guide
test: add tests for login form
```

## πŸ“œ License

**AGPL-3.0-or-later** - See [LICENSE](LICENSE) for details.

This project is REUSE 3.3 compliant. All files contain SPDX license headers.

## πŸ”— Related Repositories

- [API](https://github.com/SecPal/api) - Laravel backend
- [Contracts](https://github.com/SecPal/contracts) - OpenAPI specifications
- [.github](https://github.com/SecPal/.github) - Organization defaults

## πŸ“ž Support

- **Issues:** [GitHub Issues](https://github.com/SecPal/frontend/issues)
- **Security:** See [SECURITY.md](SECURITY.md)
- **Code of Conduct:** [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)

---

**Maintained by:** SecPal Team
**Last Updated:** October 2025
68 changes: 68 additions & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# SPDX-FileCopyrightText: 2025 SecPal
# SPDX-License-Identifier: CC0-1.0

version = 1
SPDX-FileCopyrightText = "SecPal Contributors"

[[annotations]]
path = "src/**"
SPDX-License-Identifier = "AGPL-3.0-or-later"

[[annotations]]
path = "public/**"
SPDX-License-Identifier = "AGPL-3.0-or-later"

[[annotations]]
path = "package.json"
SPDX-License-Identifier = "CC0-1.0"

[[annotations]]
path = "package-lock.json"
SPDX-License-Identifier = "CC0-1.0"

[[annotations]]
path = "tsconfig*.json"
SPDX-License-Identifier = "CC0-1.0"

[[annotations]]
path = "vite.config.ts"
SPDX-License-Identifier = "CC0-1.0"

[[annotations]]
path = ".prettierrc.json"
SPDX-License-Identifier = "CC0-1.0"

[[annotations]]
path = ".prettierignore"
SPDX-License-Identifier = "CC0-1.0"

[[annotations]]
path = ".gitignore"
SPDX-License-Identifier = "CC0-1.0"

[[annotations]]
path = "README.md"
SPDX-FileCopyrightText = "2025 SecPal"
SPDX-License-Identifier = "CC0-1.0"

[[annotations]]
path = ".github/**"
SPDX-FileCopyrightText = "2025 SecPal"
SPDX-License-Identifier = "CC0-1.0"

[[annotations]]
path = "CHANGELOG.md"
SPDX-License-Identifier = "CC0-1.0"

[[annotations]]
path = ".markdownlint*.json"
SPDX-License-Identifier = "CC0-1.0"

[[annotations]]
path = ".markdownlintignore"
SPDX-License-Identifier = "CC0-1.0"

[[annotations]]
path = "scripts/**"
SPDX-FileCopyrightText = "2025 SecPal Contributors"
SPDX-License-Identifier = "MIT"
Loading