Skip to content

Jeelislive/NOC-client

Repository files navigation

Frontend

A fast, accessible, and modular frontend built with React. Designed with developer experience and a clean architecture in mind.

Features

  • Modern React with hooks and functional components
  • Type-safe APIs and components (TypeScript-ready)
  • Routing, code-splitting, and lazy loading
  • Global state with light-weight patterns (Context/Zustand/Redux)
  • Accessible UI (WAI-ARIA), keyboard-friendly interactions
  • Environment-driven configuration
  • Zero-config formatting and linting
  • Production-ready build and preview

Tech Stack

  • React + Vite
  • React Router
  • Styling: Tailwind CSS / CSS Modules / Styled Components
  • State: Context / Zustand / Redux Toolkit
  • HTTP: Fetch / Axios
  • Tooling: ESLint, Prettier, Husky (pre-commit)
  • Testing: Vitest + React Testing Library

Choose the exact options that fit your setup; this README supports common stacks out of the box.


Getting Started

Prerequisites

  • Node.js >= 18
  • npm, pnpm, or yarn

Installation

# Using npm
npm install

# Using pnpm
pnpm install

# Using yarn
yarn

Local Development

# start dev server
npm run dev
# or
pnpm dev
# or
yarn dev

The app will be available at http://localhost:5173.

Build for Production

npm run build
npm run preview   # optional: serve the production build locally

Environment Variables

Create a .env file at the project root. Example:

VITE_API_BASE_URL=https://api.example.com
VITE_SENTRY_DSN=
VITE_FEATURE_FLAG_X=false
  • For Vite, variables must be prefixed with VITE_.
  • Never commit secrets. Use .env.local for machine-specific overrides (gitignored).

Scripts

Update these to match your package.json:

# Dev and build
npm run dev         # start development server (Vite)
npm run build       # build for production
npm run preview     # preview production build (Vite)

# Quality
npm run lint        # run ESLint
npm run lint:fix    # fix lint issues
npm run format      # run Prettier
npm run test        # unit tests
npm run test:watch  # watch mode

Project Structure

Example structure—adjust to your app:

frontend/
├─ public/               # static assets
├─ src/
│  ├─ app/               # app shell, providers
│  ├─ components/        # shared UI components
│  ├─ features/          # feature-based modules
│  ├─ pages/             # route views
│  ├─ routes/            # route definitions
│  ├─ hooks/             # reusable hooks
│  ├─ lib/               # utils, API clients
│  ├─ store/             # global state
│  ├─ styles/            # global styles / tailwind.css
│  ├─ assets/            # images, icons
│  ├─ main.tsx           # app entry
│  └─ index.css
├─ .env.example
├─ package.json
└─ README.md

Code Style

  • ESLint and Prettier are configured to ensure consistent code style.
  • Recommended VS Code extensions:
    • ESLint
    • Prettier
    • Tailwind CSS IntelliSense (if applicable)

Optional pre-commit hook (Husky + lint-staged):

  • Formats staged files and runs quick lint/tests before committing.

Contributing

We love contributions! To get started:

  1. Fork the repository and create a feature branch:
    git checkout -b feat/your-feature
  2. Install dependencies and run the app locally.
  3. Ensure npm run lint and npm run test pass.
  4. Commit with Conventional Commits:
    • feat: add user profile card
    • fix: handle empty API response
  5. Open a pull request and fill out the PR template.

Please read .github/CONTRIBUTING.md and .github/CODE_OF_CONDUCT.md (if present).


Testing

  • Unit tests with Vitest and React Testing Library.
  • Example:
    npm run test
    npm run test:watch
  • Add tests for new components, hooks, and utilities.
  • Aim for meaningful coverage, not 100% for its own sake.

Performance and Accessibility

  • Use React.lazy and dynamic imports for code-splitting heavy routes.
  • Preload critical assets where appropriate.
  • Follow WAI-ARIA best practices; verify with:
    • Lighthouse
    • axe DevTools

Deployment

Common options:

  • Netlify / Vercel / GitHub Pages / Cloudflare Pages

Basic flow:

  1. Build: npm run build
  2. Deploy the dist/ directory.

Set environment variables in your hosting provider.


FAQ

  • Q: Where do I configure API base URL?
    • A: In .env using the VITE_ prefix.
  • Q: How do I add a new route?
    • A: Add a component in src/pages/ and register it in src/routes/.

Roadmap

  • Dark mode theme
  • Offline support (PWA)
  • i18n
  • Component documentation with Storybook

License

This project is licensed under the MIT License. See LICENSE for details.


Acknowledgements

  • React, Vite, and the OSS community
  • ESLint, Prettier, and Testing Library teams

Releases

No releases published

Packages

No packages published

Languages