GenericSuite Example Application
ExampleApp is a full-stack example application demonstrating a modern web application architecture with multiple backend services and a React-based frontend implementing GenericSuite.
It is inspired by the principles of Caloric Deficit. The purpose is to achieve weight loss goals and maintain a better lifestyle, based on proper nutrition.
ExampleApp let users:
- Record their preferred food ingredients, recipes, and daily meals
- Keep track their calorie consumption
- AI-powered experiences to the users by letting them to communicate by voice, text, or image uploads to a specialized assistant called ExampleApp Bot, which is based on large language models, speech-to-text, text to image and image to text technologies.
The application is structured as a monorepo using TurboRepo.
🚀 Features
-
Frontend: Modern React application with Vite
-
Backend Options:
-
FastAPI (Python)
- Flask (Python)
-
Chalice (Python)
-
Development Tools:
-
pnpm for package management
- TurboRepo for monorepo management
- Environment-based configuration
🛠️ Prerequisites
Software
- Git
- Node version 18+, installed via NVM (Node Package Manager) or NPM and Node install (version specified in
.nvmrc
). - pnpm (version 10.12.4 or compatible)
- Python >= 3.9 and < 4.0 (version specified in
.python-version
) - Pipenv (for Python dependency management)
- Make: Mac | Windows
Services
Database
If you plan to use MongoDB:
- MongoDB Atlas account, see free tier.
- MongoDB community, see self-hosted MongoDB.
AWS account and credentials
If you plan to deploy the App in the AWS Cloud and/or use DynamoDB:
- AWS account, see free tier.
- AWS Token, see Access Keys.
- AWS Command-line interface, see awscli.
- API Framework and Serverless Deployment, see Chalice.
🚀 Getting Started
Installation
- Clone the repository:
git clone https://github.com/tomkat-cr/genericsuite-basecamp.git
cd genericsuite-basecamp
- Install dependencies:
# Install pnpm if not already installed
npm install -g pnpm
Configuration
- Copy environment files:
# Automatically copy environment files
make exampleapp-init-env-files
# Manually copy environment files
# cp apps/ui/.env.example apps/ui/.env
# cp apps/api-fastapi/.env.example apps/api-fastapi/.env
# Repeat for other services as needed (api-flask, api-chalice)
-
Update the environment variables in each
.env
file according to your setup. -
To select the backend implementation (FastAPI, Flask, Chalice), in the
apps/ui/.env
file set theBACKEND_LOCAL_PORT
variable to the port of the API you want to use.
# Chalice API
BACKEND_LOCAL_PORT=5001
# FastAPI API
# BACKEND_LOCAL_PORT=5011
# Flask API
# BACKEND_LOCAL_PORT=5021
**Note:** Once changed the `BACKEND_LOCAL_PORT` variable, press Ctrl-C to stop the development servers and run `make exampleapp-run` again.
- Use https: by default the application will use http (non-secure), if you want to use https:
- Set the
RUN_PROTOCOL
variable tohttps
in theapps/ui/.env
,apps/api-fastapi/.env
,apps/api-flask/.env
,apps/api-chalice/.env
files. - Generate a self-signed certificate and keys (only once):
- Set the
make exampleapp-create-ssl-certs
**Note:** Once changed the `RUN_PROTOCOL` variable, press Ctrl-C to stop the development servers and run `make exampleapp-run` again.
-
Use "webpack": by default the application will use "vite", if you want to use "webpack":
- Uncomment the line
RUN_METHOD="webpack"
in theapps/ui/.env
.
Note: Once changed the
RUN_METHOD
variable, press Ctrl-C to stop the development servers and runmake exampleapp-run
again. - Uncomment the line
🏃♂️ Running the Application
Development Mode
Start the development servers:
make exampleapp-run
Start a new GenericSuite project
In the following instructions, we will create a new GenericSuite project using the GenericSuite Basecamp repository as a template. Let's say we want to create a new project called "myapp" and the base directory is "~/dev".
- Start a new project directory. E.g. "myapp":
mkdir ~/dev/myapp
cd ~/dev/myapp
git init
npm init -y
# or pnpm init -y
- Clone the GenericSuite Basecamp repository:
cd ~/dev
git clone https://github.com/tomkat-cr/genericsuite-basecamp.git
cd genericsuite-basecamp
- Copy the sample app:
cp -r genericsuite-basecamp/docs/Sample-Code/exampleapp ~/dev/myapp
- Install dependencies:
cd ~/dev/myapp
make install
-
Configure the environment variables following the instructions in the Configuration section.
-
Run the application:
make run
📂 Project Structure
The exampleapp
directory is located in the ./docs/Sample-Code directory. It contains the following structure:
exampleapp/
├── apps/
│ ├── api-chalice/ # AWS Chalice backend API
│ ├── api-fastapi/ # FastAPI backend API
│ ├── api-flask/ # Flask backend API
│ ├── config_dbdef/ # Database configuration
│ └── ui/ # React frontend application
├── packages/ # Shared packages
├── scripts/ # Utility scripts
├── .gitignore
├── package.json
├── pnpm-lock.yaml
└── turbo.json
🤝 Contributing
- Fork the GenericSuite Basecamp repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
📄 License
This project is licensed under the terms of the MIT license.
👏 Acknowledgements
Credits
This project is developed and maintained by Carlos J. Ramirez. For more information or to contribute to the project, visit GenericSuite on GitHub.
Happy Coding!