A comprehensive application for coffee enthusiasts to track their beans, recipes, and brewing methods.
This application allows coffee enthusiasts to:
- Track their coffee inventory
- Record brewing recipes
- Manage grinder settings
- Explore coffee news and varieties
- View coffee-growing regions on a map
The project is organized as follows:
api/
: Contains the Flask backend API codefrontend/
: Contains the React frontend codefunctions/
: Contains Cloudflare Worker functionsdocker-compose.yml
: Configures both the frontend and API servicesdeploy.sh
: Script for deploying to Cloudflare
- Node.js and npm/yarn
- Python 3.7+ and pip
- Docker and Docker Compose (for containerized deployment)
cd frontend
yarn install
yarn start
The frontend will be available at http://localhost:3000.
cd api
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
flask run
The API will be available at http://localhost:5000.
Docker Compose allows you to run both the frontend and backend in containers, which ensures consistency across development environments.
-
Make sure Docker and Docker Compose are installed on your system.
-
From the project root directory, run:
docker-compose up
This command will:
- Build the frontend and backend Docker images if they don't exist
- Create and start containers for both services
- Configure networking between them
- Map ports to your host machine
-
Access the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
-
To stop the containers, press
Ctrl+C
in the terminal or run:
docker-compose down
The docker-compose.yml
file configures:
- API service with Flask running on port 8000
- Frontend service with React running on port 3000
- Health checks to ensure the API is running before starting the frontend
- A bridged network for communication between services
- Volume mapping for live code updates during development
The project includes a deployment script that automates deployment to Cloudflare Pages and Workers.
-
Prerequisites:
- Cloudflare account
- Wrangler CLI installed and authenticated
- Node.js environment (Conda or other)
-
Run the deployment script:
chmod +x deploy.sh # Make the script executable (one-time setup)
./deploy.sh
The script will:
- Build the React frontend
- Deploy the frontend to Cloudflare Pages
- Set up and deploy a Cloudflare Worker for the API
- Configure routing and CORS
Once deployed, your application will be available at your Cloudflare Pages URL, with the API accessible through Cloudflare Workers.
If you prefer to deploy manually or to a different platform:
- Build the frontend:
cd frontend
npm run build
-
Deploy the
build
directory to your hosting platform. -
Set up the backend API on a server of your choice, ensuring it's accessible to your frontend.
-
Update the API URL in the frontend configuration.