diff --git a/.gitattributes b/.gitattributes index fcb21d3..2080654 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 SecPal Contributors +# +# SPDX-License-Identifier: CC0-1.0 + * text=auto eol=lf *.blade.php diff=html diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index d5d1147..0000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,46 +0,0 @@ -# SPDX-FileCopyrightText: 2025 SecPal -# SPDX-License-Identifier: CC0-1.0 - -name: CodeQL - -on: - push: - branches: [main] - pull_request: - branches: [main] - schedule: - # Run at 00:00 UTC every Monday - - cron: "0 0 * * 1" - -permissions: - actions: read - contents: read - security-events: write - -jobs: - analyze: - name: Analyze with CodeQL - runs-on: ubuntu-latest - timeout-minutes: 360 - strategy: - fail-fast: false - matrix: - language: ["php"] - - steps: - - name: Checkout repository - uses: actions/checkout@v5 - - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - queries: +security-extended,security-and-quality - - - name: Autobuild - uses: github/codeql-action/autobuild@v3 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 - with: - category: "/language:${{ matrix.language }}" diff --git a/.github/workflows/license-compatibility.yml b/.github/workflows/license-compatibility.yml deleted file mode 100644 index 3d1e741..0000000 --- a/.github/workflows/license-compatibility.yml +++ /dev/null @@ -1,18 +0,0 @@ -# SPDX-FileCopyrightText: 2025 SecPal -# SPDX-License-Identifier: CC0-1.0 - -name: License Compatibility - -on: - push: - branches: [main] - pull_request: - branches: [main] - -permissions: - contents: read - -jobs: - license-compatibility: - name: Check License Compatibility - uses: SecPal/.github/.github/workflows/reusable-license-compatibility.yml@main diff --git a/.github/workflows/reuse.yml b/.github/workflows/reuse.yml deleted file mode 100644 index 0bc940e..0000000 --- a/.github/workflows/reuse.yml +++ /dev/null @@ -1,18 +0,0 @@ -# SPDX-FileCopyrightText: 2025 SecPal -# SPDX-License-Identifier: CC0-1.0 - -name: REUSE Compliance - -on: - push: - branches: [main] - pull_request: - branches: [main] - -permissions: - contents: read - -jobs: - reuse: - name: Check REUSE Compliance - uses: SecPal/.github/.github/workflows/reusable-reuse.yml@main diff --git a/.gitignore b/.gitignore index b71b1ea..88ba806 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2025 SecPal Contributors +# SPDX-License-Identifier: CC0-1.0 + *.log .DS_Store .env @@ -22,3 +25,4 @@ Homestead.json Homestead.yaml Thumbs.db +build/ diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml new file mode 100644 index 0000000..dd7fd0d --- /dev/null +++ b/.markdownlint-cli2.yaml @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: 2025 SecPal Contributors +# SPDX-License-Identifier: CC0-1.0 + +# markdownlint-cli2 configuration +# https://github.com/DavidAnson/markdownlint-cli2 + +# Ignore vendor directory and node_modules +ignores: + - vendor/** + - node_modules/** + - .git/** diff --git a/.markdownlint.json.license b/.markdownlint.json.license new file mode 100644 index 0000000..2c435df --- /dev/null +++ b/.markdownlint.json.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2025 SecPal Contributors + +SPDX-License-Identifier: CC0-1.0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ea496c2..1405eb3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,7 @@ repos: # REUSE compliance - repo: https://github.com/fsfe/reuse-tool - rev: v5.0.2 + rev: v6.1.2 hooks: - id: reuse @@ -29,26 +29,26 @@ repos: # YAML linting - repo: https://github.com/adrienverge/yamllint - rev: v1.35.1 + rev: v1.37.1 hooks: - id: yamllint args: ["-c", ".yamllint.yml"] # GitHub Actions workflow linting - repo: https://github.com/rhysd/actionlint - rev: v1.7.4 + rev: v1.7.8 hooks: - id: actionlint # Shell script linting - repo: https://github.com/shellcheck-py/shellcheck-py - rev: v0.10.0.1 + rev: v0.11.0.1 hooks: - id: shellcheck # Git hooks - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: check-added-large-files args: ["--maxkb=1000"] diff --git a/.preflight-allow-large-pr b/.preflight-allow-large-pr new file mode 100644 index 0000000..25a2056 --- /dev/null +++ b/.preflight-allow-large-pr @@ -0,0 +1,10 @@ +# SPDX-FileCopyrightText: 2025 SecPal Contributors +# SPDX-License-Identifier: CC0-1.0 + +# This file allows large PRs to bypass the 600-line size check. +# Only use this for exceptional cases like: +# - Initial repository setup +# - Major refactoring with unavoidable scope +# - Vendor library updates + +# Reason: Initial API-only setup with Laravel 12, PEST, PHPStan, REUSE compliance diff --git a/.prettierrc.json.license b/.prettierrc.json.license new file mode 100644 index 0000000..2c435df --- /dev/null +++ b/.prettierrc.json.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2025 SecPal Contributors + +SPDX-License-Identifier: CC0-1.0 diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 0000000..0c316dd --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,30 @@ +# SPDX-FileCopyrightText: 2025 SecPal +# SPDX-License-Identifier: AGPL-3.0-or-later + +extends: default + +rules: + # Allow longer lines (default is 80) + line-length: + max: 120 + level: warning + + # GitHub Actions workflows often have long keys + key-ordering: disable + + # Allow multiple spaces for alignment + colons: + max-spaces-after: -1 + + # Allow comments to be indented differently + comments-indentation: disable + + # Allow empty values in workflows + empty-values: + forbid-in-block-mappings: false + forbid-in-flow-mappings: false + + # Truthy values are common in GitHub Actions + truthy: + allowed-values: ["true", "false", "on", "off"] + check-keys: false diff --git a/README.md b/README.md index 2a6caee..8e5ac0b 100644 --- a/README.md +++ b/README.md @@ -1,122 +1,67 @@ - -SPDX-License-Identifier: CC0-1.0

- --->Build Status - -Total Downloads - -# SecPal APILatest Stable Version +# SecPal API -License - -> Laravel backend API for SecPal - Digital guard book and security service management

- -[![REUSE Compliance](https://img.shields.io/badge/REUSE-compliant-green)](https://reuse.software/)## About Laravel +> Laravel backend API for SecPal - Digital guard book and security service management +[![REUSE Compliance](https://img.shields.io/badge/REUSE-compliant-green)](https://reuse.software/) [![License: AGPL-3.0-or-later](https://img.shields.io/badge/License-AGPL%203.0+-blue.svg)](LICENSE) -Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as: - ## About -- [Simple, fast routing engine](https://laravel.com/docs/routing). +SecPal API is the backend service for the SecPal platform, built with Laravel 12 and PostgreSQL. It provides a RESTful API for managing security service operations, guard books, and related functionality. -SecPal API is the backend service for the SecPal platform, built with Laravel 12 and PostgreSQL. It provides a RESTful API for managing security service operations, guard books, and related functionality.- [Powerful dependency injection container](https://laravel.com/docs/container). - -- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. - -## Tech Stack- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent). - -- Database agnostic [schema migrations](https://laravel.com/docs/migrations). - -- **Framework:** Laravel 12- [Robust background job processing](https://laravel.com/docs/queues). - -- **Database:** PostgreSQL- [Real-time event broadcasting](https://laravel.com/docs/broadcasting). +## Tech Stack +- **Framework:** Laravel 12 +- **Database:** PostgreSQL - **Testing:** PEST - -- **Code Style:** Laravel Pint (PSR-12)Laravel is accessible, powerful, and provides tools required for large, robust applications. - +- **Code Style:** Laravel Pint (PSR-12) - **Static Analysis:** PHPStan (Level Max) with Larastan +- **PHP Version:** 8.4+ -- **PHP Version:** 8.4+## Learning Laravel - -## RequirementsLaravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework. - -- PHP 8.4 or higherYou may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch. +## Requirements +- PHP 8.4 or higher - Composer 2.x - -- PostgreSQL 15+ or 16+If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library. - +- PostgreSQL 15+ or 16+ - Extensions: `mbstring`, `xml`, `ctype`, `iconv`, `intl`, `pdo_pgsql` -## Laravel Sponsors - ## Installation -We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com). - ### 1. Clone the repository -### Premium Partners - -````bash - -git clone https://github.com/SecPal/api.git- **[Vehikl](https://vehikl.com)** - -cd api- **[Tighten Co.](https://tighten.co)** - -```- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)** - -- **[64 Robots](https://64robots.com)** - -### 2. Install dependencies- **[Curotec](https://www.curotec.com/services/technologies/laravel)** - -- **[DevSquad](https://devsquad.com/hire-laravel-developers)** - -```bash- **[Redberry](https://redberry.international/laravel-development)** - -composer install- **[Active Logic](https://activelogic.com)** +```bash +git clone https://github.com/SecPal/api.git +cd api +``` -```` +### 2. Install dependencies -## Contributing +```bash +composer install +``` ### 3. Configure environment -Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions). - -````bash - -cp .env.example .env## Code of Conduct - +```bash +cp .env.example .env php artisan key:generate +``` -```In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). - - - -Edit `.env` and configure your database:## Security Vulnerabilities - - - -```envIf you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed. +Edit `.env` and configure your database: +```env DB_CONNECTION=pgsql - -DB_HOST=127.0.0.1## License - +DB_HOST=127.0.0.1 DB_PORT=5432 - -DB_DATABASE=secpalThe Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). - +DB_DATABASE=secpal DB_USERNAME=your_username DB_PASSWORD=your_password -```` +``` ### 4. Run migrations @@ -142,11 +87,11 @@ php artisan migrate php artisan serve ``` -The API will be available at `http://localhost:8000`. +The API will be available at . ### Code Quality -#### Code Style (Laravel Pint) +**Code Style (Laravel Pint):** ```bash # Check code style @@ -156,13 +101,13 @@ The API will be available at `http://localhost:8000`. ./vendor/bin/pint ``` -#### Static Analysis (PHPStan) +**Static Analysis (PHPStan):** ```bash ./vendor/bin/phpstan analyse ``` -#### Testing (PEST) +**Testing (PEST):** ```bash # Run all tests @@ -210,13 +155,12 @@ git push --no-verify ## Project Structure -``` +```text api/ ├── app/ # Application code │ ├── Http/ # Controllers, Middleware, Requests, Resources │ ├── Models/ # Eloquent models -│ ├── Services/ # Business logic -│ └── Repositories/ # Data access layer +│ └── Providers/ # Service providers ├── config/ # Configuration files ├── database/ # Migrations, factories, seeders ├── routes/ # API routes @@ -224,7 +168,7 @@ api/ │ ├── Unit/ # Unit tests │ └── Feature/ # Feature/Integration tests ├── scripts/ # Development scripts -└── docs/ # Additional documentation +└── storage/ # Logs, cache, uploads ``` ## API Documentation @@ -239,15 +183,8 @@ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduc The `main` branch is protected with the following rules: -- Required status checks must pass: - - REUSE Compliance - - License Compatibility - - Laravel Pint - - PHPStan - - PEST Tests - - Formatting Check - - CodeQL Analysis -- Pull request reviews (0 required for single maintainer, will increase) +- Required status checks must pass +- Pull request reviews required - Conversations must be resolved - Force pushes are disabled - Deletions are disabled diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 8677cd5..02fa486 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -1,5 +1,8 @@ withRouting( - web: __DIR__.'/../routes/web.php', + api: __DIR__.'/../routes/api.php', commands: __DIR__.'/../routes/console.php', health: '/up', ) diff --git a/bootstrap/cache/.gitignore b/bootstrap/cache/.gitignore index d6b7ef3..21a2ce2 100644 --- a/bootstrap/cache/.gitignore +++ b/bootstrap/cache/.gitignore @@ -1,2 +1,5 @@ +# SPDX-FileCopyrightText: 2025 SecPal Contributors +# SPDX-License-Identifier: CC0-1.0 + * !.gitignore diff --git a/bootstrap/providers.php b/bootstrap/providers.php index 38b258d..810f842 100644 --- a/bootstrap/providers.php +++ b/bootstrap/providers.php @@ -1,5 +1,8 @@ + + + Options -MultiViews -Indexes diff --git a/public/favicon.ico b/public/favicon.ico deleted file mode 100644 index e69de29..0000000 diff --git a/public/index.php b/public/index.php index ee8f07e..788f1be 100644 --- a/public/index.php +++ b/public/index.php @@ -1,5 +1,8 @@ - - - - - - {{ config('app.name', 'Laravel') }} - - - - - - - @if (file_exists(public_path('build/manifest.json')) || file_exists(public_path('hot'))) - @vite(['resources/css/app.css', 'resources/js/app.js']) - @else - - @endif - - -
- @if (Route::has('login')) - - @endif -
-
-
-
-

Let's get started

-

Laravel has an incredibly rich ecosystem.
We suggest starting with the following.

- - -
-
- {{-- Laravel Logo --}} - - - - - - - - - - - {{-- Light Mode 12 SVG --}} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{-- Dark Mode 12 SVG --}} - -
-
-
-
- - @if (Route::has('login')) - - @endif - - diff --git a/routes/api.php b/routes/api.php new file mode 100644 index 0000000..2e2e068 --- /dev/null +++ b/routes/api.php @@ -0,0 +1,38 @@ +json([ + 'status' => 'ok', + 'timestamp' => now()->toIso8601String(), + 'service' => 'SecPal API', + 'version' => config('app.version', '1.0.0'), + ]); +}); + +// API v1 routes +Route::prefix('v1')->group(function () { + // Authentication routes + // Route::post('/login', [AuthController::class, 'login']); + // Route::post('/register', [AuthController::class, 'register']); + + // Protected routes + // Route::middleware('auth:sanctum')->group(function () { + // Route::apiResource('users', UserController::class); + // }); +}); diff --git a/routes/console.php b/routes/console.php index 3c9adf1..489db00 100644 --- a/routes/console.php +++ b/routes/console.php @@ -1,5 +1,8 @@ get('/'); + $response = $this->get('/api/health'); - $response->assertStatus(200); + $response->assertStatus(200) + ->assertJson([ + 'status' => 'ok', + ]); } } diff --git a/tests/Pest.php b/tests/Pest.php index 60f04a4..7ceb217 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -1,5 +1,8 @@ extend('toBeOne', function () { - return $this->toBe(1); -}); - /* |-------------------------------------------------------------------------- | Functions @@ -40,8 +39,3 @@ | global functions to help you to reduce the number of lines of code in your test files. | */ - -function something() -{ - // .. -} diff --git a/tests/TestCase.php b/tests/TestCase.php index fe1ffc2..1c5a7f4 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,5 +1,8 @@ assertTrue(true); + $this->assertEquals('testing', config('app.env')); } } diff --git a/vite.config.js b/vite.config.js deleted file mode 100644 index 29fbfe9..0000000 --- a/vite.config.js +++ /dev/null @@ -1,13 +0,0 @@ -import { defineConfig } from 'vite'; -import laravel from 'laravel-vite-plugin'; -import tailwindcss from '@tailwindcss/vite'; - -export default defineConfig({ - plugins: [ - laravel({ - input: ['resources/css/app.css', 'resources/js/app.js'], - refresh: true, - }), - tailwindcss(), - ], -});