Skip to content

Availity/availity-starter-vite-typescript

Repository files navigation

Availity Starter Vite TypeScript

Template project for React web apps on the Availity Portal using @availity/workflow-vite and TypeScript

About Workflow Vite

This template uses @availity/workflow-vite, which is powered by Vite and Vitest under the hood. Unlike the webpack-based @availity/workflow, this provides:

  • ⚡ Instant dev server startup via Vite's native ESM support
  • 🔥 Lightning-fast HMR (Hot Module Replacement)
  • 📦 Optimized production builds using Rollup
  • 🧪 Vitest for unit testing (Vite-native, Jest-compatible API)

The av CLI wraps Vite's dev server, build, and test tooling with Availity-specific defaults (proxying, mock data, deployment configuration).

Requirements

  • Node.js 22+ or 24+
  • Yarn 4+

Getting Started

yarn
yarn start

Scripts

Script Description
yarn start Start the development server
yarn build Build for development
yarn build:production Build for production
yarn build:staging Build for staging
yarn test Run tests (Vitest)
yarn test:watch Run tests in watch mode
yarn test:coverage Run tests with coverage
yarn lint Lint source files (ESLint)
yarn format Format files (Prettier)
yarn format:check Check formatting

Project Structure

project/
├── app/
│   ├── index.tsx          # App entry point
│   ├── index.html         # HTML template
│   ├── App.tsx            # Root component with routing
│   ├── components/        # Shared components
│   ├── Request/           # Request page feature
│   └── Response/          # Response page feature
├── config/
│   └── workflow.js        # Workflow configuration
└── data/                  # Mock API data for local development

Configuration

File Purpose
project/config/workflow.js Dev server, Vite, and build configuration
eslint.config.js ESLint flat config
tsconfig.json TypeScript configuration (type-checking only)

This project uses ESM ("type": "module" in package.json). All config files use import/export syntax.

Tech Stack

Data Fetching

This template uses @tanstack/react-query for server state and data fetching.

react-query Example

import { useQuery } from '@tanstack/react-query';
import AvUsersApi from '@availity/api-axios';

const useCurrentUser = () =>
  useQuery({
    queryKey: ['user'],
    queryFn: () => AvUsersApi.me(),
  });

const Component = () => {
  const { data: user, isLoading } = useCurrentUser();

  if (isLoading) return null;

  return <p>{user ? user.name : 'A user has no name'}</p>;
};

The useCurrentUser hook is available in @availity/hooks

Mutations

import { useMutation } from '@tanstack/react-query';

const Component = () => {
  const { mutate, isPending, error } = useMutation({
    mutationFn: (variables) => updateUserInfo(variables),
  });

  return <button onClick={() => mutate({ active: false })}>Disable User</button>;
};

Resources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors