Use Bleu Logo

Development Guidelines

Version 2.1 | Updated January 2025

Document Status
Active - Living Document
Last Review
January 15, 2025
Next Review
April 15, 2025
1

Overview & Purpose

These development guidelines serve as the comprehensive reference for all Use Bleu development projects. They establish consistent standards, promote best practices, and ensure high-quality deliverables across all client engagements.

Objectives

  • Maintain consistent code quality across all projects
  • Reduce development time through standardization
  • Ensure security and compliance requirements
  • Facilitate team collaboration and knowledge sharing

Scope

  • • Web application development
  • • Mobile application development
  • • API and backend services
  • • Database design and management
  • • DevOps and deployment processes
2

Coding Standards

JavaScript & TypeScript Standards

Naming Conventions

// Variables and functions: camelCase
const userName = 'john_doe';
const calculateTotalPrice = (items) => { ... };

// Constants: UPPER_SNAKE_CASE
const API_BASE_URL = 'https://api.example.com';
const MAX_RETRY_ATTEMPTS = 3;

// Classes and Components: PascalCase
class UserManager { ... }
const UserProfile = () => { ... };

// Files: kebab-case
user-profile.tsx
api-client.ts
form-validation.utils.ts

Code Structure

  • • Use TypeScript for all new projects
  • • Implement strict type checking
  • • Follow ESLint and Prettier configurations
  • • Maximum function length: 50 lines
  • • Maximum file length: 300 lines

Example: Component Structure

import React from 'react';
import { Button } from '@/components/ui/button';
import { UserProfileProps } from './types';

interface UserProfileState {
  isLoading: boolean;
  error: string | null;
}

export const UserProfile: React.FC<UserProfileProps> = ({ 
  userId, 
  onUpdate 
}) => {
  const [state, setState] = useState<UserProfileState>({
    isLoading: false,
    error: null
  });

  const handleSubmit = async (data: FormData) => {
    setState(prev => ({ ...prev, isLoading: true }));
    
    try {
      await updateUserProfile(userId, data);
      onUpdate?.();
    } catch (error) {
      setState(prev => ({ 
        ...prev, 
        error: error.message 
      }));
    } finally {
      setState(prev => ({ ...prev, isLoading: false }));
    }
  };

  return (
    <div className="user-profile">
      {/* Component JSX */}
    </div>
  );
};
CSS & Styling Standards

Tailwind CSS Guidelines

  • • Use Tailwind utility classes as primary styling method
  • • Create custom components for repeated patterns
  • • Use CSS modules for complex custom styles
  • • Follow mobile-first responsive design approach

Class Organization

// Order: Layout → Spacing → Typography → Colors → Effects
<div className="
  flex flex-col items-center justify-center
  p-6 mx-auto max-w-4xl
  text-lg font-semibold text-center
  bg-white text-gray-900 border border-gray-200
  rounded-lg shadow-md hover:shadow-lg transition-shadow
">
  Content
</div>
3

Best Practices

Performance Optimization
  • • Implement code splitting and lazy loading
  • • Optimize images with Next.js Image component
  • • Use React.memo for expensive components
  • • Implement proper caching strategies
  • • Monitor Core Web Vitals
  • • Use service workers for offline functionality
Accessibility (a11y)
  • • Use semantic HTML elements
  • • Implement proper ARIA attributes
  • • Ensure keyboard navigation support
  • • Maintain color contrast ratios (WCAG AA)
  • • Provide alt text for images
  • • Test with screen readers
Error Handling
  • • Implement global error boundaries
  • • Use try-catch blocks for async operations
  • • Provide meaningful error messages
  • • Log errors for monitoring
  • • Implement graceful degradation
  • • Create fallback UI components
Code Documentation
  • • Write clear, concise comments
  • • Document complex business logic
  • • Use JSDoc for function documentation
  • • Maintain README files
  • • Document API endpoints
  • • Keep documentation up-to-date
4

Technology Guidelines

Frontend Technologies

Preferred Stack

Primary
Next.js 14+ with App Router
Primary
React 18+ with TypeScript
Primary
Tailwind CSS + shadcn/ui
State
Zustand or React Query

Alternative Options

Alternative
Vite + React for SPAs
Alternative
Vue.js 3 + Nuxt.js
Alternative
Svelte + SvelteKit
Backend Technologies

API Development

  • • Next.js API Routes
  • • Node.js + Express
  • • FastAPI (Python)
  • • GraphQL with Apollo

Databases

  • • PostgreSQL (Primary)
  • • MongoDB (Document)
  • • Redis (Caching)
  • • Supabase (BaaS)

Authentication

  • • NextAuth.js
  • • Supabase Auth
  • • Auth0
  • • JWT + Refresh Tokens
5

Version Control

Git Workflow & Branching Strategy

Branch Structure

main/master     ← Production-ready code
├── develop     ← Integration branch for features
├── feature/*   ← Feature development branches
├── hotfix/*    ← Critical production fixes
└── release/*   ← Release preparation branches

Examples:
feature/user-authentication
feature/payment-integration
hotfix/security-patch-2024-01
release/v2.1.0

Commit Message Convention

Format: <type>(<scope>): <description>

Types:
feat:     New feature
fix:      Bug fix
docs:     Documentation changes
style:    Code style changes (formatting, etc.)
refactor: Code refactoring
test:     Adding or updating tests
chore:    Maintenance tasks

Examples:
feat(auth): add OAuth2 integration
fix(api): resolve user data validation error
docs(readme): update installation instructions
refactor(utils): optimize date formatting functions

Pull Request Guidelines

  • • Create descriptive PR titles and descriptions
  • • Link related issues and tickets
  • • Require at least one code review
  • • Ensure all CI/CD checks pass
  • • Update documentation if needed
  • • Delete feature branches after merging
6

Testing Procedures

Testing Strategy

Testing Pyramid

  • • 70% Unit Tests
  • • 20% Integration Tests
  • • 10% End-to-End Tests

Coverage Requirements

  • • Minimum 80% code coverage
  • • 100% coverage for critical paths
  • • All public APIs must be tested
Testing Tools

Frontend Testing

  • • Jest + React Testing Library
  • • Cypress for E2E testing
  • • Storybook for component testing

Backend Testing

  • • Jest for unit tests
  • • Supertest for API testing
  • • Postman for manual testing
Test Examples

Unit Test Example

import { render, screen, fireEvent } from '@testing-library/react';
import { UserProfile } from './UserProfile';

describe('UserProfile Component', () => {
  const mockUser = {
    id: '1',
    name: 'John Doe',
    email: 'john@example.com'
  };

  it('renders user information correctly', () => {
    render(<UserProfile user={mockUser} />);
    
    expect(screen.getByText('John Doe')).toBeInTheDocument();
    expect(screen.getByText('john@example.com')).toBeInTheDocument();
  });

  it('calls onEdit when edit button is clicked', () => {
    const mockOnEdit = jest.fn();
    render(<UserProfile user={mockUser} onEdit={mockOnEdit} />);
    
    fireEvent.click(screen.getByRole('button', { name: /edit/i }));
    expect(mockOnEdit).toHaveBeenCalledWith(mockUser.id);
  });
});
7

Deployment Strategies

CI/CD Pipeline

Deployment Environments

Development
  • • Auto-deploy from develop branch
  • • Latest features and changes
  • • Internal testing environment
Staging
  • • Production-like environment
  • • Client review and UAT
  • • Performance testing
Production
  • • Manual deployment approval
  • • Blue-green deployment
  • • Monitoring and rollback ready

Deployment Checklist

Pre-Deployment
  • All tests passing
  • Code review completed
  • Security scan passed
  • Database migrations ready
Post-Deployment
  • Health checks passing
  • Performance metrics normal
  • Error rates within limits
  • Rollback plan confirmed
Preferred Hosting Platforms

Frontend Hosting

  • Primary
    Vercel (Next.js optimized)
  • Alternative
    Netlify
  • Alternative
    AWS Amplify

Backend Hosting

  • Primary
    AWS (EC2, Lambda)
  • Alternative
    Google Cloud Platform
  • Alternative
    Railway, Render
8

Security & Compliance

Security Best Practices

Authentication & Authorization

  • • Implement multi-factor authentication
  • • Use secure session management
  • • Apply principle of least privilege
  • • Regular access reviews

Data Protection

  • • Encrypt data at rest and in transit
  • • Implement proper input validation
  • • Use parameterized queries
  • • Regular security audits
Compliance Requirements

GDPR Compliance

  • • Privacy policy implementation
  • • Cookie consent management
  • • Data subject rights
  • • Data breach procedures

Accessibility (WCAG 2.1)

  • • AA level compliance minimum
  • • Screen reader compatibility
  • • Keyboard navigation support
  • • Color contrast requirements
Security Checklist

Critical Security Items

  • No hardcoded secrets or API keys
  • HTTPS enforced on all environments
  • Input validation on all user inputs
  • Regular dependency updates

Security Tools

  • ESLint security plugins
  • Snyk for vulnerability scanning
  • OWASP ZAP for penetration testing
  • SonarQube for code quality
9

Maintenance & Updates

Regular Maintenance Tasks

Weekly Tasks

  • • Review and update dependencies
  • • Monitor application performance
  • • Check error logs and alerts
  • • Review security advisories

Monthly Tasks

  • • Comprehensive security audit
  • • Performance optimization review
  • • Backup and recovery testing
  • • Documentation updates
Update Procedures

Dependency Updates

  • • Use automated dependency updates
  • • Test updates in development first
  • • Review breaking changes
  • • Update documentation accordingly

Emergency Updates

  • • Immediate security patches
  • • Critical bug fixes
  • • Expedited review process
  • • Post-incident analysis
10

Appendix & Resources

Useful Resources

Tools & Extensions

  • • VS Code with recommended extensions
  • • React Developer Tools
  • • Redux DevTools
  • • Lighthouse for performance audits
Contact Information

Development Team

  • • Lead Developer: dev-lead@usebleu.com
  • • DevOps Team: devops@usebleu.com
  • • Security Team: security@usebleu.com

Emergency Contacts

  • • On-call Developer: +1 (555) 123-4567
  • • System Administrator: +1 (555) 987-6543
  • • Project Manager: pm@usebleu.com
Document History
VersionDateChangesAuthor
2.1Jan 15, 2025Added security compliance section, updated testing proceduresDevelopment Team
2.0Dec 1, 2024Major revision: Added deployment strategies, updated tech stackLead Developer
1.5Oct 15, 2024Updated coding standards, added accessibility guidelinesDevelopment Team
1.0Aug 1, 2024Initial version of development guidelinesCTO