Thank you for your interest in contributing to the OpenSecFlow Website! This document provides guidelines and instructions for contributing to the project.
- Code of Conduct
- Getting Started
- Development Setup
- Development Workflow
- Pull Request Process
- Automated Workflow
- Code Standards
- Project-Specific Guidelines
- Troubleshooting
We are committed to providing a welcoming and inclusive environment. Please be respectful and considerate in all interactions.
We welcome various types of contributions:
- Bug fixes and bug reports
- New features and enhancements
- Documentation improvements
- Code refactoring
- Performance optimizations
- SEO improvements
- UI/UX enhancements
Before you begin, ensure you have the following installed:
- Node.js 18 or higher
- npm (comes with Node.js)
- Git
You can verify your installations:
node --version # Should be 18.x or higher
npm --version
git --version- Fork the repository on GitHub by clicking the "Fork" button
- Clone your fork to your local machine:
git clone https://github.com/YOUR_USERNAME/opensecflow-website.git
cd OpenSecFlow-Web
- Add the upstream repository (to sync with the main project):
git remote add upstream https://github.com/OpenSecFlow/opensecflow-website.gitInstall all project dependencies:
npm install- Start the development server:
npm run dev- Open your browser and navigate to
http://localhost:4321
The development server will automatically reload when you make changes to files.
If you're working with blog posts or need the database locally:
- The project uses Astro DB with SQLite
- The database is automatically created in
.astro/db.sqlitewhen you run the dev server - To seed the database with blog posts from markdown files:
npx astro db execute scripts/seed.tsFor more information about blog management, see BLOG_MANAGEMENT.md.
Important: Always create a new branch for your changes. Never commit directly to the main branch.
- Update your local main branch:
git checkout main
git pull upstream main- Create a new feature branch:
git checkout -b feat/your-feature-nameBranch Naming Conventions:
feat/- for new featuresfix/- for bug fixesdocs/- for documentation changesrefactor/- for code refactoringstyle/- for formatting/style changesperf/- for performance improvementstest/for testing purposes
Examples:
feature/add-search-functionalityfix/navigation-mobile-issuedocs/update-contributing-guide
- Make your changes to the codebase
- Test your changes locally:
# Run the dev server to test
npm run dev
# Build to ensure there are no build errors
npm run build
# Preview the production build
npm run preview- Ensure your code follows the project's code standards (see Code Standards)
Write clear, descriptive commit messages:
git add .
git commit -m "feat: add search functionality to blog page"Commit Message Guidelines:
- Use the present tense ("add feature" not "added feature")
- Use the imperative mood ("move cursor to..." not "moves cursor to...")
- Limit the first line to 72 characters or less
- Reference issues and pull requests when applicable
Commit Message Prefixes:
feat:- A new featurefix:- A bug fixdocs:- Documentation only changesstyle:- Code style changes (formatting, etc.)refactor:- Code refactoringperf:- Performance improvementstest:- Adding or updating testschore:- Maintenance tasks
Push your branch to your fork:
git push origin feature/your-feature-name- Go to your fork on GitHub
- Click "New Pull Request"
- Select your branch to compare with the main branch
- Fill out the PR template with:
- Clear title describing the change
- Detailed description of what was changed and why
- Screenshots (if applicable)
- Related issues (if any)
Title Format:
[Type] Brief description
Examples:
[Feature] Add search functionality to blog[Fix] Resolve mobile navigation menu issue[Docs] Update contributing guidelines
Description Should Include:
- What changes were made
- Why the changes were necessary
- How to test the changes
- Screenshots or examples (if applicable)
- Any breaking changes (if applicable)
- Automated checks will run (see Automated Workflow)
- Maintainers will review your PR
- Address any feedback by pushing additional commits to your branch
- Once approved, your PR will be merged into
main
Once your PR is merged:
- The automated workflow will trigger, it's pretty much automated.
- The site will be built and deployed to Cloudflare Pages
- Your changes will be live on the production site
This project uses GitHub Actions to automatically build and deploy the site when code is pushed to the main branch.
The workflow automatically runs when:
- Code is pushed to the
mainbranch - A pull request is merged into
main
Note: The workflow does NOT run on feature branches. It only runs on main to deploy to production.
The deployment workflow (.github/workflows/deploy.yaml) performs the following steps:
- Checkout Code: Checks out the repository code
- Setup Node.js: Sets up Node.js version 20
- Install Dependencies: Runs
npm cito install dependencies - Build Astro Site: Runs
npm run buildto create the production build - Deploy to Cloudflare Pages: Deploys the
distfolder to Cloudflare Pages
- Go to the Actions tab in the GitHub repository
- Click on the workflow run to see detailed logs
- Each step shows its status (success, failure, or in progress)
When the workflow succeeds:
- The site is built successfully
- The site is deployed to Cloudflare Pages
- Your changes are live on the production site
If the workflow fails:
- Check the workflow logs in the Actions tab
- Common causes:
- Build errors (TypeScript errors, missing dependencies)
- Test failures
- Deployment configuration issues
- Fix the issues and push again to trigger a new workflow run
- Never push directly to
main- Always use feature branches and pull requests - Test locally first - Run
npm run buildbefore pushing to catch errors early - The workflow only runs on
main- Feature branches won't trigger deployment - Deployment is automatic - Once merged to
main, deployment happens automatically
- Use TypeScript for all new code
- Define proper types and interfaces
- Avoid using
anytype when possible - Use meaningful variable and function names
- Use
.astroextension for Astro components - Keep components focused and reusable
- Use proper semantic HTML
- Follow the existing component structure
Example component structure:
---
// Component script (TypeScript)
interface Props {
title: string;
}
const { title } = Astro.props;
---
<!-- Component template -->
<div class="component">
<h1>{title}</h1>
</div>
<style>
/* Component styles */
.component {
/* styles */
}
</style>- Use Tailwind utility classes for styling
- Follow the existing design system
- Use responsive classes appropriately
- Keep custom CSS to a minimum
- Components: PascalCase (e.g.,
Navigation.astro,HeroSection.astro) - Pages: kebab-case (e.g.,
blog-index.astro,about-page.astro) - Utilities: camelCase (e.g.,
formatDate.ts,apiHelpers.ts) - Config files: kebab-case (e.g.,
astro.config.mjs,tailwind.config.mjs)
- Use consistent indentation (2 spaces)
- Add comments for complex logic
- Keep functions small and focused
- Follow existing code style in the project
If you're contributing blog posts:
- See BLOG_MANAGEMENT.md for detailed instructions
- Create markdown files in
src/content/blog/ - Run the seed script to add to database:
npx astro db execute scripts/seed.ts
- Create reusable components in
src/components/ - Use TypeScript for type safety
- Follow the existing component patterns
- Ensure components are responsive
- Use semantic HTML elements
- Include proper meta tags (handled by SEO component)
- Add alt text to images
- Use descriptive headings (h1, h2, h3, etc.)
- Ensure proper heading hierarchy
Before submitting a PR:
- Test locally: Run
npm run devand verify your changes work - Build successfully: Run
npm run buildto ensure no build errors - Preview production: Run
npm run previewto see the production build - Check responsiveness: Test on different screen sizes
- Verify accessibility: Ensure proper semantic HTML and ARIA attributes
Issue: npm install fails
- Solution: Ensure you have Node.js 18+ installed. Try deleting
node_modulesandpackage-lock.json, then runnpm installagain.
Issue: Dev server won't start
- Solution: Check if port 4321 is already in use. Try
npm run dev -- --port 4322
Issue: Database errors
- Solution: Delete
.astro/db.sqliteand let it recreate. Run the seed script if needed.
Issue: TypeScript errors
- Solution: Check your TypeScript syntax. Ensure all imports are correct.
Issue: Missing dependencies
- Solution: Run
npm installto ensure all dependencies are installed.
Issue: Build fails in CI but works locally
- Solution: Ensure you're using the same Node.js version. The workflow uses Node.js 20.
Issue: Workflow fails on "Install dependencies"
- Solution: Check
package-lock.jsonis committed and up to date.
Issue: Workflow fails on "Build Astro site"
- Solution: Test the build locally with
npm run buildto catch errors before pushing.
Issue: Workflow fails on "Deploy to Cloudflare Pages"
- Solution: This is usually a configuration issue. Check that the Cloudflare project exists and secrets are configured correctly.
If you encounter issues not covered here:
- Check existing issues on GitHub
- Search the documentation
- Ask for help in a new GitHub issue
- Reach out to maintainers
- Astro Documentation
- Tailwind CSS Documentation
- TypeScript Documentation
- BLOG_MANAGEMENT.md - Guide for managing blog posts
Thank you for contributing to OpenSecFlow Website!