PHPackages                             tonka/astro - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. tonka/astro

ActiveProject[Framework](/categories/framework)

tonka/astro
===========

Tonka Framework InertiaJs ReactJs Starter Kit

v1.10.0(3mo ago)05MITSCSS

Since Feb 23Pushed 3mo agoCompare

[ Source](https://github.com/clicalmani/astro)[ Packagist](https://packagist.org/packages/tonka/astro)[ RSS](/packages/tonka-astro/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (21)Versions (3)Used By (0)

Tonka Astro ⚛️
==============

[](#tonka-astro-️)

The official **React Starter Kit** for the [**Tonka Framework**](https://clicalmani.github.io/tonka).

`Tonka Astro` provides a seamless integration between your PHP backend and your React frontend. It comes pre-configured with **InertiaJS**, **DriftQL**, and **Tonka Router**, offering a development experience similar to Laravel's Inertia stack, but optimized for the Tonka ecosystem.

🌟 Key Features
--------------

[](#-key-features)

- ⚛️ **React + Vite**: A modern, blazing-fast frontend environment with Hot Module Replacement (HMR).
- 🚀 **InertiaJS**: Build single-page applications without building an API. Server-side routing meets client-side rendering.
- 🧠 **DriftQL Integration**: Access your Elegant ORM models directly in your JSX with the powerful `` component.
- 🛣️ **Tonka Router**: Use your backend named routes in your React components effortlessly.
- 🛠️ **Zero Config**: Out-of-the-box configuration for TypeScript, Tailwind CSS (optional), and build tools.

📦 Installation
--------------

[](#-installation)

Install the package via Composer into your Tonka project:

```
composer create-project tonka/astro astro-app
```

Navigate to the `astro-app` directory, then run:

```
npm install
```

This will scaffold the frontend structure and install NPM dependencies.

🚀 Quick Start
-------------

[](#-quick-start)

Once installed, your `resources/js` directory is ready to go.

### 1. The Entry Point

[](#1-the-entry-point)

Your React app is automatically wired to your backend via Inertia.

```
// resources/js/App.tsx
import { usePage } from '@inertiajs/react';
import { route } from 'tonka-router'; // Auto-imported via Spark

export default function App() {
  return (

      Welcome to Tonka Astro
      Login

  );
}
```

### 2. Fetching Data with DriftQL

[](#2-fetching-data-with-driftql)

Query your backend database without writing API calls. Use the `` component to bind data to DOM elements or use Render Props.

```
import { Elegant } from 'driftql-react';

export default function UserProfile() {
  return (

      My Profile

      {/* Auto-Binding: Fills src automatically from DB */}

      {/* Render Props: Full control */}

        {(loading, error, posts) => (
          loading ? Loading... : (

              {posts.map(post => {post.title})}

          )
        )}

  );
}
```

### 3. Navigation with Tonka Router

[](#3-navigation-with-tonka-router)

Navigate using your backend route names. Tonka Router handles URL generation automatically based on your Spark configuration.

```
import { route, current } from 'tonka-router';

export default function Navbar() {
  return (

      Home
      Posts

      {/* Highlight active link */}

        Profile

  );
}
```

📁 Project Structure
-------------------

[](#-project-structure)

The kit organizes your frontend code cleanly within the Tonka structure:

```
tonka-project/
├── app/                # Backend Logic (Controllers, Models)
├── resources/
│   ├── js/             # React Frontend (Scaffolded by Astro)
│   │   ├── App.tsx
│   │   ├── Pages/      # Inertia Pages
│   │   └── Components/ # Reusable React Components
│   └── views/          # Twig Templates (for initial load)
├── public/             # Public Assets
└── vite.config.js      # Vite Configuration

```

⚙️ Configuration
----------------

[](#️-configuration)

### Frontend Config (`drift.config.js`)

[](#frontend-config-driftconfigjs)

Located at the root of your project, generated by Astro.

```
export default {
  baseURL: '/api/bridge',
  bridge_public_key: 'your-key-here',
  // ...
};
```

### Backend Config (`config/spark.php`)

[](#backend-config-configsparkphp)

Configure which routes are visible to the frontend and apply access policies.

```
return [
    'only' => [
        ['name' => 'home', 'policy' => null],
        ['name' => 'admin.*', 'policy' => \App\Contracts\DriftQL\AdminPolicy::class],
    ],
];
```

🛠️ Development
--------------

[](#️-development)

Start the Vite development server:

```
npm run dev
```

Build for production:

```
npm run build
```

📚 Learn More
------------

[](#-learn-more)

- **[Tonka Framework Docs](https://clicalmani.github.io/tonka)**: Learn about the backend.
- **[DriftQL Docs](https://github.com/clicalmani/driftql-react)**: Master the frontend ORM.
- **[Tonka Router Docs](https://github.com/clicalmani/tonka-router)**: Understand dynamic routing.
- **[InertiaJS Docs](https://inertiajs.com)**: Learn the client-side protocol.

📝 License
---------

[](#-license)

MIT

---

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance82

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~31 days

Total

2

Last Release

97d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7316d2003f9fbef5b19aaa8caa3983f37742f2b1872e72a5390077c2975fc2e6?d=identicon)[honorable85](/maintainers/honorable85)

---

Top Contributors

[![clicalmani](https://avatars.githubusercontent.com/u/16488123?v=4)](https://github.com/clicalmani "clicalmani (4 commits)")

---

Tags

frameworkreactjsinertiajstonka

### Embed Badge

![Health badge](/badges/tonka-astro/health.svg)

```
[![Health](https://phpackages.com/badges/tonka-astro/health.svg)](https://phpackages.com/packages/tonka-astro)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.0k](/packages/laravel-framework)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[silverstripe/framework

The SilverStripe framework

7313.7M2.8k](/packages/silverstripe-framework)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

21866.0M1.7k](/packages/drupal-core)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6942.5M419](/packages/drupal-core-recommended)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
