First off, thank you for considering contributing to Metarang Admin Panel! It's people like you that make Metarang better. 🎉
- Code of Conduct
- Getting Started
- How Can I Contribute?
- Development Workflow
- Coding Standards
- Commit Guidelines
- Testing Requirements
- Documentation
This project and everyone participating in it is governed by the Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to the project maintainers.
- PHP 8.2+
- Node.js 18+
- Composer
- NPM or Yarn
- MySQL/PostgreSQL
# Fork the repository
# Then clone your fork
git clone https://github.com/YOUR_USERNAME/microservice-admin-panel.git
cd microservice-admin-panel
# Install dependencies
composer install
npm install
# Setup environment
cp .env.example .env
php artisan key:generate
# Setup database
php artisan migrate --seed
# Start development servers
php artisan serve
npm run devBefore creating bug reports, please check the issue list as you might find out that you don't need to create one. When you are creating a bug report, please include as many details as possible:
Bug Report Template:
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Environment (please complete the following information):**
- OS: [e.g., Ubuntu 22.04]
- PHP Version: [e.g., 8.2.5]
- Node Version: [e.g., 18.15.0]
- Browser: [e.g., chrome, safari]
- Version: [e.g., 22]
**Additional context**
Add any other context about the problem here.Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, please include:
- Use a clear and descriptive title
- Provide a step-by-step description of the suggested enhancement
- Provide specific examples to demonstrate the steps
- Describe the current behavior and explain which behavior you expected to see instead
- Explain why this enhancement would be useful
- Fork the repository and create your branch from
main - Update the documentation if you're changing functionality
- Add tests for any new code
- Ensure the test suite passes
- Make sure your code lints (PSR-12 for PHP, ESLint for JS/Vue)
- Issue that pull request 🎉
## Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
Fixes # (issue)
## Type of change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
## How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
- [ ] Unit Tests
- [ ] Feature Tests
- [ ] Manual Testing
## Checklist:
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changesUse meaningful branch names:
feature/description- for new featuresbugfix/description- for bug fixeshotfix/description- for critical fixesdocs/description- for documentationrefactor/description- for code refactoringtest/description- for adding tests
Examples:
feature/user-authenticationbugfix/fix-file-uploaddocs/update-readme
- Always create an issue first - Discuss the change before implementing
- Assign yourself to the issue - Let others know you're working on it
- Create a branch from
mainwith the naming convention above - Make your changes following the coding standards
- Write/update tests for your changes
- Run tests locally to ensure everything passes
- Push your branch and create a Pull Request
- Request review from maintainers
We follow PSR-1, PSR-12, and Laravel best practices:
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Http\Requests\UserRequest;
use Illuminate\Http\JsonResponse;
class UserController extends Controller
{
/**
* Display a listing of users.
*
* @return JsonResponse
*/
public function index(): JsonResponse
{
$users = User::paginate(15);
return response()->json($users);
}
/**
* Store a newly created user.
*
* @param UserRequest $request
* @return JsonResponse
*/
public function store(UserRequest $request): JsonResponse
{
$validated = $request->validated();
$user = User::create($validated);
return response()->json($user, 201);
}
}Key Rules:
- Use type hints and return types
- Use Laravel's built-in validation (Form Requests)
- Follow Laravel naming conventions (snake_case for variables, camelCase for methods)
- Use dependency injection where possible
- Keep controllers thin - use Services/Repositories
- Add PHPDoc blocks for complex methods
We use Vue 3 Composition API with TypeScript:
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { useUserStore } from '@/stores/user'
interface Props {
userId: number
isActive?: boolean
}
const props = withDefaults(defineProps<Props>(), {
isActive: false
})
const emit = defineEmits<{
(e: 'update', value: User): void
(e: 'delete', id: number): void
}>()
const userStore = useUserStore()
const loading = ref(false)
onMounted(async () => {
await fetchUserData()
})
const fetchUserData = async () => {
loading.value = true
try {
await userStore.fetchUser(props.userId)
} finally {
loading.value = false
}
}
</script>
<template>
<div class="p-4" :class="{ 'bg-gray-100': isActive }">
<h2 class="text-xl font-bold">User Profile</h2>
<p v-if="loading" class="text-gray-500">Loading...</p>
<slot name="content" />
</div>
</template>
<style scoped>
/* Component-specific styles */
</style>Key Rules:
- Use Composition API with
<script setup> - Use TypeScript for props, emits, and complex logic
- Prefer
refoverreactivefor simple values - Use composables for reusable logic (e.g.,
useBreakpoint) - Keep components focused and under 300 lines
- Use meaningful component names (PascalCase)
- Use Tailwind CSS utility classes primarily
- Use
<style scoped>for component-specific styles - Avoid inline styles
- Follow BEM naming if writing custom CSS
- Maintain responsive design (mobile-first approach)
<template>
<!-- Good: Mobile-first responsive design -->
<div class="w-full md:w-1/2 lg:w-1/3 p-4">
<button class="px-4 py-2 bg-blue-500 hover:bg-blue-600 rounded">
Click me
</button>
</div>
</template>
<style scoped>
/* Only for complex animations or overrides */
.custom-animation {
transition: all 0.3s ease;
}
</style>We follow Conventional Commits specification:
<type>(<scope>): <subject>
<body>
<footer>
| Type | Description | Example |
|---|---|---|
feat |
New feature | feat: add user profile page |
fix |
Bug fix | fix: resolve file upload issue |
docs |
Documentation | docs: update API documentation |
style |
Code style (formatting, missing semicolons, etc) | style: format code with prettier |
refactor |
Code refactoring | refactor: extract validation logic |
test |
Adding tests | test: add user model unit tests |
chore |
Maintenance tasks | chore: update composer dependencies |
perf |
Performance improvements | perf: optimize database queries |
# Feature commit
git commit -m "feat(user): add email verification on registration"
# Bug fix commit
git commit -m "fix(upload): fix FileInput loading state not resetting"
# Documentation commit
git commit -m "docs(readme): update installation instructions"
# Breaking change
git commit -m "feat(api)!: change authentication response format
BREAKING CHANGE: API now returns JWT token instead of session cookie"# Run all tests
php artisan test
# Run specific test suite
php artisan test --testsuite=Feature
# Run with coverage
php artisan test --coverageRequirements:
- Write tests for all new features
- Maintain at least 80% code coverage
- Test both success and failure scenarios
Example Test:
<?php
namespace Tests\Feature;
use Tests\TestCase;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
class UserControllerTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function it_can_create_a_user()
{
$userData = [
'name' => 'John Doe',
'email' => 'john@example.com',
'password' => 'password123'
];
$response = $this->postJson('/api/users', $userData);
$response->assertStatus(201)
->assertJsonPath('name', 'John Doe');
$this->assertDatabaseHas('users', ['email' => 'john@example.com']);
}
}# Run Vue tests
npm run test
# Run with watch mode
npm run test:watchExample Component Test:
import { mount } from '@vue/test-utils'
import FileInput from '@/components/FileInput.vue'
describe('FileInput.vue', () => {
it('emits file when uploaded', async () => {
const wrapper = mount(FileInput)
const file = new File(['content'], 'test.txt')
await wrapper.find('input').trigger('change', { files: [file] })
expect(wrapper.emitted()).toHaveProperty('file-uploaded')
})
})- Use PHPDoc for PHP classes and methods
- Use JSDoc for JavaScript/Vue functions
- Comment complex logic, not obvious code
/**
* Process user upload with validation and optimization.
*
* @param UploadedFile $file The uploaded file instance
* @param array $options Processing options (resize, compress)
* @return ProcessedFile|null Returns processed file or null on failure
* @throws \InvalidArgumentException When file type is not supported
*/- Update README.md when adding features
- Document API endpoints in wiki
- Keep installation instructions up-to-date
Pull requests require at least one approval from a maintainer. The review checks for:
- Code quality and standards compliance
- Test coverage
- Documentation updates
- No breaking changes without discussion
- Performance implications
Contributors will be:
- Added to the README contributors list
- Mentioned in release notes
- Featured on our contributors wall (coming soon)
- GitHub Issues: For bug reports and feature requests
- Discord: Join our Discord server for real-time chat
- Email: contributors@metarang.com
Thank you for contributing to Metarang! 🚀
Happy Coding! 💻
**END OF CONTRIBUTING GUIDE**