A modern, production-ready React application blueprint built with TypeScript, Vite, Material-UI, and comprehensive tooling for enterprise-grade development.
| Statements | Branches | Functions | Lines |
|---|---|---|---|
This React app blueprint provides a robust foundation for building modern web applications with enterprise-grade tooling and best practices. It includes authentication flows, GraphQL integration, comprehensive testing setup, and automated documentation generation.
- React 18 with TypeScript for type-safe development
- Vite for fast development and optimized builds
- Material-UI (MUI) with styled-components integration
- Apollo GraphQL client with code generation
- Authentication system with login/forgot password flows
- Vitest testing framework with comprehensive setup
- ESLint & Prettier for code quality and formatting
- Docusaurus for documentation
- Docker support for containerization
- Plop.js templates for code generation
- Feature-based architecture for scalability
├── app/ # Main React application
│ ├── src/
│ │ ├── core/ # Reusable components, hooks, utilities
│ │ ├── features/ # Feature-specific modules
│ │ │ ├── authentication/
│ │ │ ├── app/
│ │ │ └── 404/
│ │ └── vitest/ # Test configuration
│ ├── templates/ # Plop.js code generation templates
│ └── vite.config.js # Vite configuration
├── docs/ # Docusaurus documentation site
├── deployment/ # Deployment scripts and utilities
├── Dockerfile # Container configuration
└── .github/ # CI/CD workflows
- Node.js 18+ (LTS recommended)
- Yarn 4+ (configured with
.yarnrc.yml) - Docker (optional, for containerized development)
git clone <repository-url>
cd react-app-blueprint
yarn installStart the development server:
cd app
yarn devThe application will be available at http://localhost:5173
Copy and configure environment variables:
cd app
cp .env.example .env
# Edit .env with your configuration# Development
yarn dev # Start development server
yarn build # Build for production
yarn preview # Preview production build
# Testing
yarn test # Run tests
yarn test:ui # Run tests with UI interface
yarn test:coverage # Generate coverage report
# Code Quality
yarn lint # Run ESLint
yarn lint:fix # Fix ESLint issues
yarn format # Format code with Prettier
# Code Generation
yarn codegen # Generate GraphQL types (local)
yarn codegen:remote # Generate GraphQL types (remote)
yarn generate # Run Plop.js generatorsyarn start # Start documentation server
yarn build # Build documentation
yarn serve # Serve built documentationyarn install # Install all dependencies
yarn workspace app dev # Run app development server
yarn workspace docs start # Run documentation serverThe project uses Vitest with a comprehensive testing setup including:
- Unit tests for components and utilities
- Integration tests for features
- Code coverage reporting
- Custom test utilities and setup
# Run all tests
yarn test
# Watch mode
yarn test --watch
# UI interface
yarn test:ui
# Coverage report
yarn test:coverageTest files are co-located with source files using .test.ts or .test.tsx extensions.
The app includes Apollo GraphQL client with automated code generation:
- Configure your GraphQL endpoint in
codegen.tsorcodegen-remote.ts - Add your queries/mutations in
.graphqlfiles - Generate types:
yarn codegen - Use generated hooks in your components
yarn codegen # Generate from local schema
yarn codegen:remote # Generate from remote endpointyarn generate # Interactive Plop.js generatorTemplates available:
- React components with tests
- Complete features with routing
The blueprint includes a complete authentication system:
- Login page with email/password
- Forgot password flow with email reset
- Protected routes and navigation
- Apollo GraphQL integration for auth APIs
- Form validation with proper error handling
- Material-UI (MUI) components with custom theme
- Styled-components integration via
@mui/styled-engine-sc - Responsive design with theme breakpoints
- Dark/light mode support
- Custom icons and animations
Build and run with Docker:
# Build the image
docker build -t react-app-blueprint .
# Run the container
docker run -p 3000:3000 react-app-blueprintThe Dockerfile uses multi-stage builds for optimized production images.
Documentation is built with Docusaurus and includes:
- Getting started guides
- API documentation
- Component documentation
- Architecture decisions
cd docs
yarn start # Development server at http://localhost:3000
yarn build # Build static documentationcd app
yarn build
yarn preview # Test production build locallycd deployment
./utilities.sh # Available deployment commandsGitHub Actions workflows handle:
- Automated testing on pull requests
- Build verification
- Dependency updates via Dependabot
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes following the coding standards
- Add tests for new functionality
- Run quality checks:
yarn lint && yarn test - Update documentation if needed
- Submit a pull request
- TypeScript strict mode enabled
- ESLint with React and TypeScript rules
- Prettier for consistent formatting
- Conventional commits for clear history
- Test coverage for new features
- Use the feature generator:
yarn generate - Follow the feature-based architecture
- Include tests and documentation
- Update fence.json for feature boundaries
src/
├── core/ # Shared utilities
│ ├── components/ # Reusable UI components
│ ├── hooks/ # Custom React hooks
│ ├── stores/ # Global state management
│ └── utils/ # Utility functions
└── features/ # Feature modules
├── authentication/
├── app/
└── 404/
- Feature isolation with fence.json boundaries
- Apollo GraphQL for data fetching
- Material-UI for consistent design system
- Vite for fast development experience
- Vitest for modern testing approach
- Styled components not working in tests: Ensure
@mui/styled-engine-scis properly configured - GraphQL codegen fails: Check your schema URL and authentication
- Build failures: Clear node_modules and yarn cache, then reinstall
- Check the documentation
- Review existing issues
- Create a new issue with detailed reproduction steps
[Add your license information here]
When using this blueprint for a new project:
- Clone this repository
- Replace
{{APP_NAME}}with your actual app name in:- This README.md
- app/index.html
- docs/docusaurus.config.js
- Any other template files
- Update repository URLs and project-specific information
- Configure environment variables and API endpoints
- Customize branding, themes, and styling
- Delete this "Blueprint Usage" section
To contribute to the blueprint itself:
- Test changes across different scenarios
- Maintain template placeholders using
{{}}format - Update documentation for new features
- Ensure backward compatibility when possible
- Add comprehensive tests for new functionality