Alpaca - JSON Forms for jQuery and Bootstrap
Alpaca provides the easiest and fastest way to generate interactive forms for the web and mobile devices. It runs simply as HTML5 or more elaborately using Bootstrap. Alpaca uses Handlebars to process JSON schema and provide developers with an extensible framework for implementing controls, wizards, layouts, I18N support and an custom data persistence.
The goal of Alpaca is to provide the open source community with a fantastic forms engine that rivals or beats what most proprietary vendors offer. Using Alpaca, you can host really nice forms for your back end services, whether they are proprietary, enterprise or SaaS offerings.
The philosophy behind Alpaca is that you should design your forms once and have them work on lots of different devices and UI engines without having to do the same work twice.
Here is a sample registration form written once and rendered using different approaches:
Alpaca is an open-source project licensed under Apache 2.0. It was started in 2010 and has been growing steadily since thanks to a really awesome community of customers, consultants and technology champions world-wide.Web Site, Documentation and CDN
For information, demos and documentation regarding Alpaca, please visit the the Alpaca Forms web site.
Going forward, all distribution assets are available via free CDN via jsDelivr.
For example -
https://cdn.jsdelivr.net/npm/alpaca@ should be filled in (example: 1.5.26).
For more information, visit the Alpaca Forms web site.
Sponsors
Cloud CMS is actively developed and maintained by Gitana Software, Inc. (https://gitana.io).
Cloud CMS is an API-First, JSON-friendly Content Management Platform for mobile and web applications. It provides the ideal backend for Alpaca forms design, capture and reporting. Stop by our web site to learn more about Cloud CMS.
The project also has a large number of customers who use Alpaca, contribute code and receive support, some of whom are listed on our web site.
Official Support
We offer paid support for your technical development and production environments. Paid support includes a service level agreement for priority response and bug fixes.
If you are interested in sponsoring or are interested in consulting services, please Contact Us.
Community
We have an awesome community. Everything is straight up out in the open and anyone can build or contribute. We keep everything under an Apache 2.0 license so that you're free to do whatever you please with Alpaca.
There are several ways to interact with the Alpaca community.
- Browse the documentation and try out the interactive examples. On each page, you'll find a Disqus forum that you can use to ask questions specific to that page. As others browse the documentation, they'll find your question and will have the context at hand to answer it.
- Visit the Alpaca.js web site and ask your question to the broader Alpaca community. Be sure to include code samples, URLs or http://jsfiddle.net/ links so that others can reproduce your scenario quickly. It's always best to empower others to help you.
- Add a GitHub Issue if you've found an actual bug or have a feature request that you'd like to get prioritized into the roadmap.
- Submit a Pull Request if you've fixed a bug and want to contribute code back to the Alpaca project. This is the most powerful and effective way to influence the product. Pull requests give you a way to write your own additions or adjustments to the code base and make it very easy for us to merge your changes into the product.
- Get Developer Assistance if you have an urgent issue and would like priority paid support. Cloud CMS and/or its partners provide fast and reliable developer assistance for your projects.
Extensibility
Alpaca is designed to be very extensible, allowing you to plug in new field implementations, DOM layouts, callbacks, CSS classes, I18N bundles and much more. It also integrates naturally to HTTP service backends using a connector layer.
Alpaca is ideal for consultants or organizations that wish to have a solid JavaScript form engine that provides a platform that they can grow into for current and future project needs.
Can I fork Alpaca and use it my own projects?
Yes, absolutely. That's the whole idea. Fork it, use it in your projects, make money from it, live a better life, spend more time with your kids. We hope that Alpaca is useful to you.
If you come up with something good (like a bug fix or a new feature), consider submitting a Pull Request back to the project so that others may benefit. And so that they too might, in turn, get more sleep, enjoy your work, be happier and get more out of this adventure called life.
Compatibility
The latest release of Alpaca is compatible with jQuery 1.9.1 and up. For a full breakdown of the third-party
libraries (and versions) that the optional fields integrate with, check site/package.json.
In general, we aspire to support the latest versions of our third-party dependencies. Some folks may want Alpaca to be
backward-compatible with earlier versions of dependencies and in general, it is our desire to have it be so. But in
cases where that is not possible, we will opt for the latest. In those cases, we recommend folks fall back to an
earlier version of Alpaca.
How to Build Alpaca
The first thing you should do is grab the source. We won't cover how to do that here but instead we recommend that you learn about Git and GitHub. You can pull the source down to your local machine to build things locally.
The command line for doing this is basically:
git clone https://github.com/gitana/alpaca.git
Build
All you need is Node.js (20 or later). Install the dependencies:
npm install
And then build:
npm run build
This will build to dist/alpaca (the directory that gets published) in well under a second. Handlebars
templates are precompiled and JS / CSS are minified with esbuild. The build script lives in scripts/build.mjs and the ordered list
of source files lives in scripts/sources.mjs.
| Command | What it does |
|----------------------|---------------------------------------------------------------------------|
| npm run build | Build the library into dist/alpaca |
| npm run watch | Build, then rebuild whenever src/ changes |
| npm test | Build, then run the test suite |
| npm run test:watch | Run the test suite in watch mode |
| npm run bench | Benchmark rendering, validation and refresh (--save / --compare a run) |
| npm run dev | Watch the library and serve the web site with live reload on :9999 |
| npm run site | Build the library and the web site into dist/site |
| npm run site:install | Reinstall the web site's third-party libraries (site/package.json) |
| npm run docs:api | Generate JSDoc API docs into build/jsdoc |
| npm run lint | Run JSHint over src/js |
| npm run clean | Remove build and dist |
| npm run bump | Bump the minor version in package.json (no git commit or tag) |
Tests
Tests use Vitest. Each test boots a fresh jsdom window with
jQuery, Handlebars and the built Alpaca bundle loaded as browser globals (see tests/harness.js), so they exercise
exactly what ships in dist/alpaca. Test suites cover both the web and bootstrap distributions.
npm test
Building the Web Site
The web site (site/) is built with Eleventy using Liquid templates and Markdown. The site's
third-party libraries (jQuery, Bootstrap, CKEditor, etc.) are declared in site/package.json and published under
/lib. They're installed automatically the first time you build or serve the site.
Build it to dist/site:
npm run site
Or run it locally with live reload at http://localhost:9999 (this also rebuilds Alpaca as you edit src/):
npm run dev
Only files that start with front matter (---) are treated as templates; everything else under site/ is copied
as-is. Field documentation pages can include to have schema and options
tables generated from the field's implementation.
Alpaca Distributions
The build produces two sets of assets and they are placed in:
dist/alpaca/web(for basic web forms and layout)dist/alpaca/bootstrap(for bootstrap enabled forms and layout)
Each JS file is UMD ready and will work within both an AMD and CommonJS container, or as a plain that
defines a global Alpaca.
Releasing
Bump the minor version with npm run bump (or use npm version patch / major). Then run ./deploy.sh to build, tag, publish to npm and push the web site.
Contributors
Here is a long list of our project's brothers and sisters in arms. These folks have made numerous contributions to Alpaca over the years:
+ @cloudcms + @uzquiano + @harrymoore + @yaworsw + @drq + @Maethorin + @jlanders68 + @JocelynDelalande + @Ognian + @globocom + @urba + @colegatron + @Kirosoft + @1337 + @jkernagis2 + @ASchriever + @hooflung64 + @Shadowsrik + @deviant32 + @vikramsawant786 + @tylerperyea + @picsoung + @jmcgdz + @ytaka + @jflowers45 + @paierh + @darmar + @arthurportas + @emircal + @xaviergonz + @musicist288 + @mschnee + @Uxio0 + @mll5 + @PoltoS + @billbarsch + @vittala + @robustified + @cniesen + @degenhard + @robsiera + @cheeweep + @j123b567 + @scadams + @ryanmark + @techbrew-mc + @st3v + @basvandenheuvel + @simonemedasfedro + @78Gills + @PirateSteve + @dthompsonza + @ousou + @azahid + @neilyoung + @apanagio + @marcostorto + @ToreOlavKristiansen + @sachatrauwaen + @sfesiura + @Felttrip + @gertingold + @sivapalan + @caluwaertp + @ambischof + @hcmabreu + @AzuraGroup + @mlarman70 + @christoph007 + @MaZZly + @maximzmushko + @DavidePastore + @hauntingEcho + @ml2439 + @bradh
...and many others via the Alpaca Web Site and Alpaca Issues!