DWP Ask is an AI-powered policy search and question-answering application that helps DWP staff quickly find accurate information from policy documents. The frontend provides an intuitive chat interface for users to interact with the AI system and access policy information efficiently.
- Overview
- Key Features
- Technology Stack
- Project Structure
- Getting Started
- Environment Configuration
- Available Scripts
- Development Workflow
- Testing
- Deployment
- Contributing
The DWP Ask frontend is a Next.js 15 application built with React 19 and TypeScript. It provides a modern, accessible, and responsive user interface that integrates with Azure OpenAI services and Azure AI Search to deliver intelligent policy search capabilities.
- Interactive chat interface for natural language policy queries
- Real-time streaming responses from Azure OpenAI (GPT-4o)
- Follow-up question suggestions based on context
- Query refinement and elaboration capabilities
- Semantic search across DWP policy documents
- Source citations with direct links to policy documents
- Document download functionality
- Advanced search filtering and pagination
- Role-based access control (Admin, User)
- User group management and permissions
- Comprehensive analytics and usage tracking
- Message history and conversation management
- Admin dashboard for system monitoring
- Feedback collection and management
- CSV export functionality for data analysis
- User activity and query analytics
- GOV.UK Design System compliance
- WCAG 2.1 AA accessibility standards
- Screen reader compatibility
- Keyboard navigation support
- Mobile-first responsive design
- Progressive Web App (PWA) capabilities
- Cross-browser compatibility
- Optimized performance
- Framework: Next.js 15 (App Router)
- Frontend: React 19, TypeScript
- Styling: SCSS, GOV.UK Frontend 5.13
- State Management: React Context API
- Testing: Jest, React Testing Library
- Code Quality: Biome, Husky
- Analytics: Google Tag Manager integration
- Security: Content Security Policy, DOMPurify
app/
βββ (pages)/ # Route groups
β βββ accessibility/ # Accessibility statement
β βββ admin/ # Admin dashboard
β βββ ai-notice/ # AI usage notice
β βββ chat/ # Main chat interface
β βββ feedback/ # Feedback forms
βββ api/ # API routes
β βββ query/ # Search queries
β βββ feedback/ # Feedback handling
β βββ messages/ # Message management
β βββ download/ # File downloads
βββ components/ # Reusable UI components
β βββ Analytics/ # Analytics components
β βββ Answer/ # AI response display
β βββ ChatInput/ # Chat input interface
β βββ Layout/ # Page layouts
β βββ Navbar/ # Navigation
β βββ Shared/ # Common components
βββ hooks/ # Custom React hooks
βββ providers/ # Context providers
βββ types/ # TypeScript definitions
βββ utils/ # Utility functions
βββ constants/ # Application constants
- Node.js 18+ and npm
- Access to DWP Ask backend services
- Environment variables (contact a-cubed group maintainers)
- Clone the repository:
git clone <repository-url>
cd a-cubed-new-frontend- Install dependencies:
npm install- Set up environment variables:
cp .env-example .env-
Contact the a-cubed group maintainers to obtain the required environment variables for your
.envfile. -
Start the development server:
npm run dev- Open http://localhost:3000 in your browser.
For testing with HTTPS locally:
npm run dev:httpsThe application requires several environment variables. Contact the a-cubed group maintainers to obtain the necessary values:
NEXT_PUBLIC_BASE_URL= # Backend API URL
NEXT_PUBLIC_APP_URL= # Frontend application URL
ACCESS_TOKEN= # API access token
NODE_ENV= # Environment (development/production)
NEXT_PUBLIC_MAX_ROW_CSV= # CSV export row limitnpm run dev- Start development servernpm run dev:https- Start development server with HTTPSnpm run build- Build production applicationnpm run start- Start production server
npm run lint- Run Biomenpm run type-check- Run TypeScript type checkingnpm run format- Format code with Biome
npm run test- Run testsnpm run test:watch- Run tests in watch modenpm run test:coverage- Run tests with coverage reportnpm run test:notest- Pass with no tests (for CI)
The project uses Husky for pre-commit hooks that automatically run:
- Code formatting check (Biome)
- Linting (Biome)
- Type checking
- Tests
- Commit message validation
Follow conventional commit format:
feat: A new feature
fix: A bug fix
docs: Documentation only changes
style: Changes that do not affect the meaning of the code
refactor: A code change that neither fixes a bug nor adds a feature
perf: A code change that improves performance
test: Adding missing tests or correcting existing tests
build: Changes that affect the build system or external dependencies
ci: Changes to our CI configuration files and scripts
chore: Other changes that don't modify source or test filesThe project uses Jest and React Testing Library for testing:
- Unit Tests: Component and utility function tests
- Integration Tests: API route and user interaction tests
- Coverage Reports: Available in
coverage/directory
Run tests with:
npm run test:coverageThe application is deployed using GitLab CI/CD pipelines:
- Development: Automatic deployment on merge to
develop - Test: Deployment to test environment
- Production: Manual deployment from
mainbranch
The application includes a Dockerfile for containerized deployment:
docker build -t dwp-ask-frontend .
docker run -p 3000:3000 dwp-ask-frontend- Create a feature branch from
develop - Make your changes following the coding standards
- Ensure all tests pass and pre-commit hooks succeed
- Submit a merge request with a clear description
- Request review from team members
- Use TypeScript for all new code
- Follow React best practices and hooks patterns
- Maintain accessibility standards (WCAG 2.1 AA)
- Write comprehensive tests for new features
- Document complex functionality
- Component Structure: Use functional components with hooks
- State Management: Context API for global state, local state for components
- API Integration: Custom hooks for data fetching
- Error Handling: Comprehensive error boundaries and user feedback
- Performance: Code splitting, lazy loading, and optimization
For technical support or questions:
- Contact the a-cubed group maintainers for environment variables and access
- Refer to the DWP Ask documentation for system overview