neb-react-ui-components
v1.0.0
Published
A modern React UI component library built with Radix UI and Tailwind CSS
Readme
NEBULA Frontend Platform
Overview
NEBULA is a modern web application built with React, TypeScript, and Vite, following Domain-Driven Design (DDD) principles. The platform provides a comprehensive UI component library and implements best practices for frontend development.
Table of Contents
- Architecture Overview
- Project Structure
- Technology Stack
- Getting Started
- Development Workflow
- Component Library
- Domain Structure
- Available Scripts
- Project Configuration
- Contributing Guidelines
Architecture Overview
The application follows Domain-Driven Design (DDD) principles, organizing code around business domains rather than technical layers. This approach provides:
- Clear separation of concerns
- Domain-specific components and logic
- Scalable and maintainable codebase
- Isolated domain dependencies
- Reusable shared components
Technology Stack
Core Technologies
- React (Version 18)
- Vite
- React Query (Version 4)
- React Hook Form (Version 7) + Zod
- Zustand
- React Router Dom (Version 6)
UI & styling
Static type checking & linting
Testing Libraries
- Vitest
- @testing-library/react
- @testing-library/dom
- @testing-library/jest-dom
- @testing-library/user-event
ESLint + Prettier
- Eslint
- Prettier
- eslint-config-prettier
- eslint-plugin-prettier
- prettier-plugin-tailwindcss
- @ianvs/prettier-plugin-sort-imports
Others
- Install the “Tailwind CSS IntelliSense” Visual Studio Code extension
- Add the following to your settings.json(opens in a new tab):
{
"tailwindCSS.experimental.classRegex": [
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
["cx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
]
}Getting Started
Prerequisites
- Node.js (v16 or higher)
- npm or yarn
- Docker (for containerization)
Environment Setup
- Clone the repository:
git clone <repository-url>
cd nebula-frontend- Create environment file:
cp .env.example .env- Install dependencies:
npm install- Start development server:
npm run devAvailable Scripts
npm run dev- Start development servernpm run build- Build for productionnpm run test- Run unit testsnpm run storybook- Start Storybook servernpm run lint- Run ESLintnpm run format- Format code with Prettiernpm run commit- Interactive commit message helper
Docker Support
# Build Docker image
docker build -t nebula-frontend .
# Run container
docker run -p 3000:3000 nebula-frontendDevelopment Workflow
Source Version Control
Git branch naming convention:
- New feature: feat/NEB-{Ticker Number}_{Ticker Name}
- Fix bug: fix/NEB-{Ticker Number}_{Ticker Name}
- Chore: chore/NEB-{Ticker Number}_{Ticker Name}
Example: feat/NEB-229_integrate_api_add_new_internal_usersGit commit message convention:
- New feature: git commit -m “feat: [NEB-{Ticker Number}] message”
- Fix bug: git commit -m “fix: [NEB-{Ticker Number}] message”
- Chore: git commit -m “chore: [NEB-{Ticker Number}] message”
Example: git commit -m "feat: [NEB-229] integrate api add new internal users"Gitflow
- git add .
- npm run commit
- git fetch
- git rebase origin/main
- git push —set-upstream origin {Name branch}
Coding Convention
- All variables named as const or enum should be in UPPERCASE according to naming conventions.
const COLOR = '#FF0000';
enum DAYS {
MONDAY,
TUESDAY,
WEDNESDAY,
}- Types and Interfaces should be in CapitalizedCamelCase.
interface PersonDetails {
firstName: string;
lastName: string;
age: number;
}
type ProductInfo = {
name: string;
price: number;
};- Using path aliases for cleaner React and TypeScript imports.
import Button from '@/components/NEBButton';
import Input from '@/components/NEBInput';- File Naming Conventions, all files and folders should be named in kebab-case.
Reference Material
Project Structure
The project follows a Domain-Driven Design (DDD) architecture with the following structure:
src/
├── assets/ # Static assets (images, fonts)
├── components/ # Shared UI components
├── domains/ # Domain-specific modules
│ ├── authentication/ # Authentication domain
│ │ ├── components/ # Domain-specific components
│ │ ├── pages/ # Route components
│ │ ├── hooks/ # Custom hooks
│ │ ├── services/ # API services
│ │ ├── types/ # TypeScript definitions
│ │ └── utils/ # Helper functions
│ └── [other-domains]/
├── hooks/ # Shared hooks
├── services/ # Shared API services
├── libs/ # Third-party integrations
├── router/ # Route definitions
├── store/ # Global state management
├── types/ # Shared TypeScript types
└── utils/ # Shared utilitiesDomain Structure
Each domain follows a consistent structure:
components/: Domain-specific UI componentspages/: Route components and layoutshooks/: Custom React hooksservices/: API integration and business logictypes/: TypeScript interfaces and typesutils/: Helper functions and utilities
Component Library
The project uses a comprehensive UI component library built with:
- Storybook for component documentation
- Tailwind CSS for styling
- Radix UI for accessible components
- Shadcn UI for prebuilt components
- Class Variance Authority for component variants
Component Development
- Create new components in
src/components - Add Storybook documentation
- Include unit tests
- Follow accessibility guidelines
Project Configuration
Tools and Linting
- ESLint for code linting
- Prettier for code formatting
- Husky for git hooks
- Commitlint for commit message validation
CI/CD
The project uses Bitbucket Pipelines for continuous integration and deployment:
- Automated testing
- Code quality checks
- Build verification
- Deployment to staging/production
Contributing
- Create a new branch following the naming convention:
- Features:
feat/NEB-{Ticket}-description - Fixes:
fix/NEB-{Ticket}-description - Chores:
chore/NEB-{Ticket}-description
Make your changes following the coding standards
Commit using conventional commits:
npm run commit- Push and create a pull request
Support
For support and questions, please contact the development team.
