npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@famgia/omnify

v0.12.9

Published

Complete Laravel + React solution: Schema-to-TypeScript generation + Runtime helpers for forms

Readme

@famgia/omnify

Complete Laravel + React solution: Schema-to-TypeScript generation + Runtime helpers for forms

Features

🎯 Build-time (Code Generation)

  • ✅ Convert Omnify schema-lock.json to TypeScript types
  • ✅ Generate enum types and options
  • ✅ Generate model interfaces with relations
  • ✅ Generate Enums Context Provider with type-safe helpers
  • ✅ Watch mode for auto-regeneration

🚀 Runtime (React Helpers)

  • useFormSubmit - Auto Laravel validation error mapping
  • createLaravelAxios - Pre-configured axios for Laravel
  • getCsrfCookie - CSRF token helper
  • ✅ Full TypeScript support

Installation

npm install @famgia/omnify

Usage

1. Generate Types (Build-time)

# In frontend project
npx omnify-build --output src/omnify

# Watch mode
npx omnify-build --output src/omnify --watch

2. Use Generated Types & Enums

import { User, Company } from '@/omnify/models';
import { useEnums } from '@/omnify';

function MyForm() {
  const { getOptions, getPrefecturesAsNumbers } = useEnums();
  
  const accountTypeOptions = getOptions('ApplicationForm', 'account_type');
  const prefectureOptions = getPrefecturesAsNumbers();
  
  return <Select options={accountTypeOptions} />;
}

3. Use Runtime Helpers

import { useFormSubmit, getCsrfCookie } from '@famgia/omnify';
import { Form, Button } from 'antd';

function MyForm() {
  const [form] = Form.useForm();
  const apiUrl = process.env.NEXT_PUBLIC_API_URL;

  const { handleSubmit, loading } = useFormSubmit({
    form,
    submitFn: createUser,
    getCsrfToken: () => getCsrfCookie(apiUrl!),
    onSuccess: (response) => {
      message.success('Success!');
    },
  });

  return (
    <Form form={form} onFinish={handleSubmit}>
      <Form.Item name="email">
        <Input />
      </Form.Item>
      <Button type="primary" htmlType="submit" loading={loading}>
        Submit
      </Button>
    </Form>
  );
}

API

useFormSubmit<TResponse>(options)

Hook for form submission with automatic Laravel validation error mapping.

Options:

  • form: FormInstance - Ant Design form instance
  • submitFn: (values) => Promise<TResponse> - API call function
  • getCsrfToken?: () => Promise<void> - CSRF token getter
  • onSuccess?: (response, values) => void - Success callback
  • onError?: (error, values) => void - Custom error handler
  • errorMessages?: { 500?, 401?, 403?, default? } - Custom error messages

Returns:

  • handleSubmit: (values) => Promise<void> - Submit handler
  • loading: boolean - Loading state
  • setLoading: (loading) => void - Set loading manually

createLaravelAxios(baseURL)

Create pre-configured axios instance for Laravel API.

import { createLaravelAxios } from '@famgia/omnify';

const axios = createLaravelAxios('https://api.example.com');

getCsrfCookie(baseURL)

Get CSRF cookie for Laravel Sanctum.

import { getCsrfCookie } from '@famgia/omnify';

await getCsrfCookie('https://api.example.com');

Benefits

  • 🚀 Reduce 100+ lines of boilerplate per form
  • 🛡️ Type-safe enums and models
  • 🔄 Auto-sync with backend schema
  • 📝 Consistent error handling
  • ⚡ Build-time code generation
  • 🎯 Runtime helpers for common tasks

License

MIT