Skip to content

naqvinayyab/p11d-digital-service

Repository files navigation

P11D Digital Service

A GOV.UK compliant digital service for reporting employee expenses and benefits (P11D forms) to HMRC.

Features

  • GOV.UK Design System - Uses official components and patterns
  • WCAG 2.2 AA Compliant - Fully accessible to all users
  • Progressive Enhancement - Works without JavaScript
  • Responsive Design - Mobile-first approach
  • Security Focused - CSRF protection, CSP headers, session management
  • Performance Optimized - Fast loading, efficient codebase

Quick Start

# Install dependencies
npm install

# Build CSS assets
npm run build:css

# Start development server
npm run dev

# Visit http://localhost:3000

Project Structure

├── app/
│   ├── routes/          # Express routes and validation
│   ├── views/           # Nunjucks templates
│   │   ├── benefits/    # Benefit-specific form pages
│   │   └── _layout.html # Base template
│   └── assets/sass/     # SCSS source files
├── public/              # Static assets (CSS, JS)
├── tests/               # Test files
└── docs/                # Documentation

User Journey

  1. Start page - Service overview and requirements
  2. Employee details - Capture employee and employer information
  3. Benefit selection - Choose which benefits were provided
  4. Benefit details - Enter specific details for each benefit type
  5. Check answers - Review all information
  6. Confirmation - Success page with reference number

Technology Stack

  • Node.js & Express - Server framework
  • Nunjucks - Templating engine
  • GOV.UK Frontend - Design system components
  • Express Validator - Form validation
  • Helmet - Security headers
  • SASS - CSS preprocessing

Accessibility

This service meets WCAG 2.2 AA standards:

  • Screen reader compatible
  • Keyboard navigation throughout
  • High contrast mode support
  • Descriptive error messages
  • Semantic HTML structure
  • Progressive enhancement

See ACCESSIBILITY_CHECKLIST.md for detailed testing requirements.

Security Features

  • Content Security Policy headers
  • CSRF protection ready (commented for demo)
  • Secure session management
  • Input validation and sanitization
  • Timeout warnings
  • No sensitive data logging

Development

Running Tests

npm test

Building Assets

npm run build:css    # Compile SCSS to CSS
npm run dev         # Watch mode for development

Code Style

  • Follow GOV.UK Service Manual guidelines
  • Use semantic HTML5
  • Progressive enhancement approach
  • Accessibility-first development

Deployment

See DEPLOYMENT_GUIDE.md for production deployment instructions.

Key requirements:

  • Node.js 18+
  • HTTPS/SSL certificate
  • Session storage (Redis recommended)
  • Environment variables configured

API Integration

For production use, integrate with HMRC APIs:

// Example HMRC API call
const submitP11D = async (formData) => {
  const response = await fetch(`${process.env.HMRC_API_ENDPOINT}/p11d`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${apiToken}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(formData)
  })
  return response.json()
}

Browser Support

Supports all browsers listed in GOV.UK Service Manual:

  • Chrome (latest 2 versions)
  • Firefox (latest 2 versions)
  • Safari (latest 2 versions)
  • Edge (latest 2 versions)
  • Internet Explorer 11 (where required)

Contributing

  1. Follow GOV.UK Design System patterns
  2. Ensure WCAG 2.2 AA compliance
  3. Test with assistive technologies
  4. Write semantic, accessible HTML
  5. Include proper error handling

License

MIT License - see LICENSE file for details.

Support

For technical support or questions about implementation:


Built with ❤️ following GOV.UK Service Standards

About

P11D digital service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published