Skip to main content
Version: 1.0

Philosophy

logo

Motivation

Forms are hard. They are tough to get right and maintain. We usually end up with dozens of form artefacts spread across our projects, from inputs, styling, validation, submission logic, user input behavior, etc. We used Formik as our main form management library, it is a great way for writing form inputs and manage their lifecycle. But what if we want to reuse the whole reasonning that goes with creating a one, fully functional form, to other views in our app? The answer to that question if what led to the creation of Felwine.

What is Felwine?

Felwine aims to simplify form building across various front-end frameworks. Felwine is not a form library itself, it defines a protocol for defining form inputs as a sole source of truth (data type, behaviour, validation) in json. That definition can be interpreted by any felwine engine on any compatible front-end framework. Any input declares the component type it needs to collect the user's input. Any Felwine engine renders the said input by requesting the component from libraries (components) and rendering them with a standardized api.

Principles

Convention over configuration

Convention over configuration (also known as coding by convention) is a software design paradigm used by software frameworks that attempts to decrease the number of decisions that a developer using the framework is required to make without necessarily losing flexibility and don't repeat yourself (DRY) principles.
Wikipedia

Break the Form into Small Reusable Components

One of the fundamental principles of React is the concept of componentization. Apply this principle to your forms by breaking them down into small, reusable components. Each component should encapsulate a specific piece of the form’s functionality. This approach makes your code more modular and easier to maintain, and when combined with TypeScript, it enables strong type checking for each component. Read more

Standardize Input Interfaces: “value” and “onChange”

To ensure consistency and compatibility, follow the standard input interface of providing “value” and “onChange” handlers for your form inputs. This approach allows React Hook Form to seamlessly integrate with your components while providing TypeScript with the necessary information to perform type checking. Read more

Don't repeat yourself (DRY)

"Don't repeat yourself" (DRY) is a principle of software development aimed at reducing repetition of information which is likely to change, replacing it with abstractions that are less likely to change, or using data normalization which avoids redundancy in the first place.
Wikipedia

Extreme refactoring

Refactor mercilessly
Felwine takes refactoring to the extreme by decluttering the app from the underlying features that different models use into a single package called feature. Contrarily to a middleware or an extension, a feature is a high level, conventioned, Predictable and versioned piece of code that provides a functional feature. Extreme refactoring with features yield extreme reusability from the ground-up by instilling a feature driven culture in your teams.
Variable → Function → Class → Module → Extension → Feature
Extreme refactoring

Functional programming

(over object programming)

Functional programming is a paradigm of building computer programs using expressions and functions without mutating state and data. By respecting these restrictions, functional programming aims to write code that is clearer to understand and more bug resistant.

Other influences

Should you use Felwine?

Felwine is likely a good fit for you if

  • You want to quickly build a form for your project
  • You want to reuse an input over different forms without copying it over and over