Getting Statrted

Project Structure

Understanding how KiviCare is organized will help you navigate the codebase efficiently and know exactly where to make changes.


Directory Overview

kivicare-clinic-management-system/

├── app/ # 📁 Core application code
│ ├── dashboard/ # 🎯 React Dashboard (PRIMARY WORKSPACE)
│ ├── shortcodes/ # Frontend widgets
│ ├── elementor/ # Elementor widgets
│ ├── baseClasses/ # PHP base classes
│ ├── controllers/ # PHP controllers
│ ├── models/ # Database models
│ └── database/ # Migrations

├── dist/ # 🏗️ Generated build output
├── docs/ # 📚 Documentation
├── templates/ # 📄 PHP templates
├── languages/ # 🌐 Translation files
├── vendor/ # PHP dependencies
├── node_modules/ # Node.js dependencies

├── vite.config.js # ⚙️ Build configuration
├── package.json # NPM dependencies and scripts
├── composer.json # PHP dependencies
└── kivicare-clinic-management-system.php # Main plugin file

React Dashboard (app/dashboard/)

👉 This is the main development area for frontend features.

app/dashboard/

├── main.jsx # 🚀 Application entry point

├── router/ # Routing configuration
│ ├── indexRouter.js # Main route definitions
│ └── …

├── views/ # 📄 Pages / Screens
│ ├── dashboard/ # Dashboard homepage
│ ├── appointments/ # Appointment management
│ ├── patients/ # Patient management
│ ├── doctors/ # Doctor management
│ ├── encounters/ # Patient encounters
│ ├── billing/ # Billing & invoices
│ └── settings/ # System settings

├── components/ # 🧩 Reusable UI components
│ ├── atoms/ # Basic components (Button, Input)
│ ├── molecules/ # Small combinations
│ ├── organisms/ # Complex components
│ ├── Table/ # Data tables
│ ├── forms/ # Form components
│ └── modals/ # Modal dialogs

├── api/ # 🔌 API service layer
│ ├── appointmentService.js
│ ├── patientService.js
│ ├── doctorService.js
│ └── …

├── hooks/ # 🪝 Custom React hooks
│ ├── useCurrentUser.js
│ ├── usePermissions.js
│ └── …

├── context/ # React Context providers
│ ├── AuthContext.js
│ └── …

├── layout/ # Layout components
│ ├── DefaultLayout.jsx
│ ├── Sidebar.jsx
│ └── Header.jsx

├── utils/ # 🛠️ Utility functions
│ ├── helpers.js
│ ├── constants.js
│ └── validators.js

└── assets/ # Static assets
├── scss/ # Stylesheets
│ ├── kivicare.scss # Main styles
│ ├── custom.scss # Custom styles
│ └── rtl.scss # RTL support
├── images/ # Images
└── fonts/ # Custom fonts

Location: app/dashboard/main.jsx
When to edit: Rarely — only for global configuration changes.


vite.config.js — Build Configuration

Configures the Vite build tool.

JAVASCRIPT
export default {
  plugins: [react(), v4wp()],
  server: { port: 8080 },
  resolve: { alias: {...} }
}

Location: Root directory
When to edit: When adjusting build settings, aliases, or plugins.


package.json — Node Dependencies

Defines JavaScript dependencies and scripts.

JAVASCRIPT
{
  "scripts": {
    "dev": "vite",
    "build": "vite build"
  },
  "dependencies": {
    "react": "^19.2.0"
  }
}

Location: Root directory
When to edit: When adding or updating npm packages.


composer.json — PHP Dependencies

Defines PHP dependencies and autoloading.

JAVASCRIPT
{
  "autoload": {
    "psr-4": {
      "App\\": "./app"
    }
  }
}

Location: Root directory
When to edit: When adding PHP libraries.


Where to Add Custom Code

Custom React Component

Create in:
app/dashboard/components/custom/MyComponent.jsx

JAVASCRIPT
import React from 'react';

export const MyComponent = () => {
  return <div>My Custom Component</div>;
};

Custom Page

Create in:
app/dashboard/views/custom/MyPage.jsx

Register the route in:
app/dashboard/router/indexRouter.js


Custom API Service

Create in:
app/dashboard/api/myService.js

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

export const useMyData = () => {
  return useQuery({...});
};

Custom Styles

Edit:
app/dashboard/assets/scss/custom.scss

JAVASCRIPT
.my-custom-class {
  background: #7016d0;
  padding: 1rem;
}

Custom PHP Controller

Create in:
app/controllers/api/MyController.php

JAVASCRIPT
<?php
namespace App\controllers\api;

class MyController extends WP_REST_Controller {
  // Your controller logic
}

Build Output (dist/)

These files are generated automatically — do not edit them.

dist/
├── dashboard.js
├── dashboard.css
├── manifest.json
└── assets/

Generated when:

  • npm run dev (development)
  • npm run build (production)

PHP Backend (app/)

app/
├── baseClasses/
├── controllers/
│ └── api/
├── models/
├── database/
└── admin/

Work here when building backend logic, database features, or REST API endpoints.


Configuration Files

  • vite.config.js — Build tool configuration
  • .eslintrc.json (if present) — JavaScript linting rules
  • composer.json — PHP autoloading and dependencies

Important Paths

PurposePath
Entry Pointapp/dashboard/main.jsx
Routesapp/dashboard/router/indexRouter.js
Pagesapp/dashboard/views/{module}/
Componentsapp/dashboard/components/
API Servicesapp/dashboard/api/
Custom Stylesapp/dashboard/assets/scss/custom.scss
Build Configvite.config.js
Build Outputdist/

Path Aliases

Use aliases instead of long relative paths.

JAVASCRIPT
// ❌ Avoid
import { Button } from '../../../components/atoms/Button';

// ✅ Recommended
import { Button } from '@components/atoms/Button';

Available aliases (defined in vite.config.js):

  • @appapp/dashboard
  • @apiapp/dashboard/api
  • @componentsapp/dashboard/components
  • @shortcodesapp/shortcodes
  • @elementorapp/elementor/widgets

Next Steps

Ready to customize?

→ Continue to First Customization


Quick Reference

TaskLocation
Add new pageapp/dashboard/views/custom/MyPage.jsx
Add componentapp/dashboard/components/custom/MyComponent.jsx
Add API serviceapp/dashboard/api/myService.js
Custom stylesapp/dashboard/assets/scss/custom.scss
Add PHP endpointAdd a PHP endpoint

Suggestions & Improvements

Your email address will not be published. Required fields are marked *