This repository contains a full stack web application template that runs on the FARM solution stack, which stands for:
The FARM stack is more or less an extension of the LAMP stack with these notable changes:
Flask is used to write the web APIs / middleware that can communicate between the web UI and the web backend / database. This is the core of the entire application that glues the pieces of the full stack application together.
Note that this particular template does not use an ORM, and instead uses the pymysql
module. This means developers need to write SQL queries, but can maximize the complexity of the queries they need to run on the database.
AWS is the cloud service which the application can be hosted on. We can host the entire software stack on the following services:
This means that developers can keep everything on one platform and minimize DevOps / IT work.
React is the framework which the web UI runs on. The React application may also be run on AWS Lambda with NodeJS.
This template uses JavaScript / JSX, but TypeScript may be used as well.
MySQL is the relational database which the web backend uses. This can also be hosted on AWS through its RDS service.
To run this web application, the following needs to be done:
db/
To set up the MySQL instance, follow these steps:
mysql
on the Linux command line interface.sample.sql
within the instance. It will create a schema called SampleInventory
and then initialize a table called Inventory
.The codebase for the Flask API can be found in the api/
directory.
virtualenv farm-stack
after navigating to that directory.source farm-stack/bin/activate
api/
and run pip3 install -r requirements.txt
to install all Python modules necessary for the API.dbcreds.py
in the api/
directory and edit database credentials as needed.python3 app.py
to run the API on http://localhost:8080
.The codebase for the React UI can be found in the ui/
directory. This template uses yarn
as its package manager; it is crucial that developers do not mix other package managers like npm
when adding new modules.
Note that packages like react-bootstrap
are missing from this template.
yarn install
to install all dependencies required.yarn start
to run in development mode.http://localhost:3000
on the browser.