Thank you for your interest in contributing to the Nexlayer documentation! This guide will help you get started and understand our development process.
- Node.js 18+ (recommended: Node.js 20)
- pnpm (install with
npm install -g pnpm) - Git for version control
# 1. Fork and clone the repository
git clone https://github.com/your-username/documentation.git
cd documentation
# 2. Install dependencies
pnpm install
# 3. Start development server
pnpm dev
# 4. Open http://localhost:3000- Adding new documentation pages
- Updating existing content
- Fixing typos and grammar
- Improving clarity and readability
- Bug fixes
- Performance optimizations
- New features
- UI/UX improvements
- Build system improvements
- CI/CD enhancements
- Development tooling
- Testing infrastructure
/app- Next.js pages and layouts/components- Reusable React components/content- MDX documentation files/lib- Utility functions and configurations/data- Static data files (OpenAPI specs, etc.)/styles- Global CSS and styling
- Components: PascalCase (e.g.,
MyComponent.tsx) - Pages: kebab-case (e.g.,
my-page.tsx) - Utilities: camelCase (e.g.,
myUtility.ts) - Content: kebab-case (e.g.,
my-documentation.mdx)
- Clear and concise - Get to the point quickly
- Active voice - Use active voice when possible
- Consistent terminology - Use the same terms throughout
- Code examples - Include practical, working examples
---
title: "Page Title"
description: "Brief description for SEO and navigation"
---
# Page Title
Brief introduction to the topic.
## Section Heading
Content with examples:
```yaml
application:
name: "my-app"
pods:
- name: web
image: "my-image:latest"<Callout>- Info, warning, error callouts<YamlCodeBlock>- Syntax-highlighted YAML<CodeBlock>- General code blocks<FeatureCard>- Feature showcase cards<StepIndicator>- Step-by-step processes
// Use interfaces for public APIs
interface ComponentProps {
title: string;
description?: string;
className?: string;
}
// Use functional components with hooks
export function MyComponent({ title, description, className }: ComponentProps) {
const [state, setState] = useState(false);
return (
<div className={cn("base-classes", className)}>
<h2>{title}</h2>
{description && <p>{description}</p>}
</div>
);
}- Use functional components with hooks
- Prefer named exports
- Keep components small and focused
- Use TypeScript for all props
// Use Tailwind CSS classes
// Follow mobile-first responsive design
// Use CSS variables for theming
<div className="bg-background text-foreground p-4 md:p-6 lg:p-8">
<h1 className="text-2xl md:text-3xl lg:text-4xl font-bold">
Responsive Heading
</h1>
</div>-
Create the component file
touch components/my-component.tsx
-
Add TypeScript interface
interface MyComponentProps { title: string; children: React.ReactNode; className?: string; }
-
Implement the component
export function MyComponent({ title, children, className }: MyComponentProps) { return ( <div className={cn("base-styles", className)}> <h2>{title}</h2> {children} </div> ); }
-
Add to MDX components if needed
// app/mdx-components.tsx import { MyComponent } from "@/components/my-component"; export function useMDXComponents(components) { return { ...components, MyComponent, }; }
# 1. Start development server
pnpm dev
# 2. Test different pages
# - Home: http://localhost:3000
# - Documentation: http://localhost:3000/docs
# - Learn: http://localhost:3000/learn
# - Launchfile: http://localhost:3000/launchfile
# 3. Test responsive design
# - Use browser dev tools to test mobile/tablet views
# - Check dark/light mode toggle
# - Verify all links work correctly
# 4. Run linting and type checking
pnpm lint
npx tsc --noEmit- Test in Chrome, Firefox, Safari, Edge
- Verify mobile responsiveness
- Check accessibility features
feature/add-new-docs-page
fix/typo-in-readme
docs/update-api-reference
style/improve-button-design
Use conventional commit format:
type(scope): description
feat(docs): add new API reference page
fix(ui): resolve mobile navigation issue
docs(readme): update installation instructions
style(components): improve button hover states
- feat: New features
- fix: Bug fixes
- docs: Documentation changes
- style: Code style changes (formatting, etc.)
- refactor: Code refactoring
- test: Adding or updating tests
- chore: Maintenance tasks
git checkout -b feature/your-feature-name- Follow coding guidelines
- Test your changes thoroughly
- Update documentation if needed
git add .
git commit -m "feat: add new documentation page for X"git push origin feature/your-feature-name- Title: Clear, descriptive title
- Description: Explain what and why (not how)
- Screenshots: Include for UI changes
- Testing: Describe how you tested
- Related Issues: Link to any related issues
// components/__tests__/my-component.test.tsx
import { render, screen } from '@testing-library/react';
import { MyComponent } from '../my-component';
describe('MyComponent', () => {
it('renders with title', () => {
render(<MyComponent title="Test Title" />);
expect(screen.getByText('Test Title')).toBeInTheDocument();
});
});// e2e/my-component.spec.ts
import { test, expect } from '@playwright/test';
test('my component works correctly', async ({ page }) => {
await page.goto('/my-page');
await expect(page.locator('h1')).toContainText('Expected Title');
});- Keep components small and focused
- Use dynamic imports for large components
- Optimize images and assets
- LCP: Optimize largest contentful paint
- FID: Minimize first input delay
- CLS: Prevent cumulative layout shift
# Analyze bundle size
pnpm build
npx @next/bundle-analyzer- Sanitize user-generated content
- Validate external links
- Use HTTPS for all external resources
- Never commit sensitive data
- Use
NEXT_PUBLIC_prefix for client-side variables - Keep server-side variables secure
# Build the application
pnpm build
# Test production build locally
pnpm start- Push to main branch triggers automatic deployment
- GitHub Actions builds and deploys
- Nexlayer serves the site with global CDN
- GitHub Issues: For bugs and feature requests
- Discord: Join our community
- Documentation: Check existing docs first
- Automated Checks: CI/CD runs tests and linting
- Review: At least one maintainer reviews your PR
- Feedback: Address any feedback or requested changes
- Merge: Once approved, your changes are merged
- All contributors are listed in the repository
- Significant contributions are highlighted
- Community members are recognized
- Be respectful and inclusive
- Help others learn and grow
- Share knowledge and best practices
Thank you for contributing to Nexlayer documentation! Your contributions help make our platform better for everyone.