https://github.com/andismith/react-lambda-forms
React Forms with Hooks connected to Serverless NodeJS sharing the same field config and validation rules - all in a nice monorepo
https://github.com/andismith/react-lambda-forms
lambda nodejs react react-hooks serverless
Last synced: 5 months ago
JSON representation
React Forms with Hooks connected to Serverless NodeJS sharing the same field config and validation rules - all in a nice monorepo
- Host: GitHub
- URL: https://github.com/andismith/react-lambda-forms
- Owner: andismith
- License: mit
- Created: 2019-09-05T20:53:42.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-08T22:17:16.000Z (over 6 years ago)
- Last Synced: 2025-02-07T18:53:28.450Z (11 months ago)
- Topics: lambda, nodejs, react, react-hooks, serverless
- Language: JavaScript
- Homepage:
- Size: 1.31 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# React Lambda Forms
Building forms can be a pain. First you have to build the actual form fields; then the buttons; then handle the state of the form; handle the submission; write validation on the client and then write more validation on the server.
This repository shows you how you can build forms with a [simple configuration file](packages/shared/config/contact.js), and use the same configuration file and validation code on both the client and the server side.
On the client side, we're using React Hooks to manage the state of the form; while on the server side we're using a NodeJS Lambda; all packed in to a tidy monorepo.
I hope this helps you to make your forms less painful.
## Tech Stack
* React (+ Hooks)
* ES6 (Babel)
* NodeJS
* Serverless (Lambda)
* SCSS modules
* Jest
* Webpack
## Getting Started
To start, you'll need to have the following software installed:
- [Node.js](https://nodejs.org) (v10.x for Lambda support)
- [Yarn](https://yarnpkg.com) package manager
- [Serverless](https://serverless.com/) framework - `yarn global add serverless`
`yarn install` once from the root and yarn will install the required node_modules for every package.
### API
To run the API, navigate to the `packages/api` directory and run the following:
- `sls offline` to run the Lambda offline
### Client
To run the client, navigate to the `packages/client` directory and run the following:
- `yarn start` to start a local server, it'll launch the site so you can start to play around