A React/TypeScript gaming application with a feature-based folder structure for better organization and maintainability.
This application uses a feature-based architecture where code is organized by business domain rather than technical type.
src/
├── features/ # Feature-based modules
│ ├── army/ # Army management feature
│ ├── battle/ # Battle system feature
│ ├── ranking/ # Ranking system feature
│ ├── auth/ # Authentication feature
│ └── user/ # User management feature
├── shared/ # Shared/reusable components
│ ├── components/
│ │ ├── ui/ # Basic UI components
│ │ ├── layout/ # Layout components
│ │ └── tables/ # Table components
│ └── index.ts # Shared exports
├── Homepage/ # Main landing page
├── assets/ # Static assets
├── store/ # Global state management
├── utils/ # Utility functions
└── App.tsx # Root application component
- Army creation and management
- Army statistics and rankings
- Ally and nemesis tracking
- Emblem selection and customization
- Battle creation and scheduling
- Real-time battle management
- Battle results and scoring
- Battle history tracking
- 40K and Fantasy leaderboards
- Ranking progression tracking
- Top player showcases
- Visual ranking graphs
- User login and registration
- Password reset functionality
- Session management
- Security validation
- User dashboard
- Personal statistics
- Profile management
- User-specific data views
Reusable components organized by purpose:
- UI: Basic form inputs, buttons, pills
- Layout: Headers, navigation, hero sections
- Tables: Table headers, rows, and data display
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Run tests
npm test// Import from feature index
import { ArmyDash, AddArmy } from 'src/features/army';
import { BattleCard, CreateBattle } from 'src/features/battle';// Import from shared index
import { Header, InputBox, NavButton } from 'src/shared';// Avoid when possible, use shared components instead
import { SomeComponent } from 'src/features/other-feature';- Create feature folder in
/features/ - Add
components/andpages/subdirectories - Create feature
index.tsfor exports - Update main imports in
App.tsx - Add feature documentation
- Determine component category (ui/layout/tables)
- Add to appropriate shared subfolder
- Export from shared
index.ts - Update shared documentation
- Use feature exports for feature-specific components
- Use shared exports for reusable components
- Avoid deep imports into feature internals
- Prefer relative imports within the same feature
- Warhammer 40K: Sci-fi tabletop gaming
- Warhammer Fantasy: Fantasy tabletop gaming
- Army rankings and progression
- Battle win/loss ratios
- Player statistics and achievements
- Ally and nemesis relationships
- Frontend: React 18 + TypeScript
- Build Tool: Vite
- UI Library: Material-UI
- State Management: Zustand
- Styling: SCSS modules
- Routing: React Router
This project was recently restructured from a flat component structure to a feature-based architecture for:
- Better code organization
- Improved maintainability
- Clearer feature boundaries
- Enhanced team collaboration
- Easier testing and debugging
When contributing:
- Follow the feature-based structure
- Add appropriate documentation
- Use TypeScript for type safety
- Follow existing code patterns
- Test your changes thoroughly
Each feature includes its own README with:
- Component descriptions
- Usage examples
- Key features
- Dependencies
- Import patterns
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
- Configure the top-level
parserOptionsproperty like this:
export default {
// other rules...
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
}- Replace
plugin:@typescript-eslint/recommendedtoplugin:@typescript-eslint/recommended-type-checkedorplugin:@typescript-eslint/strict-type-checked - Optionally add
plugin:@typescript-eslint/stylistic-type-checked - Install eslint-plugin-react and add
plugin:react/recommended&plugin:react/jsx-runtimeto theextendslist