3.0 KiB
3.0 KiB
Freedge
Freedge is a web application that generates personalized recipes based on the ingredients available in the user's fridge. The application is built on a modern fullstack architecture with a lightweight and fast backend, an integrated database, and a smooth user interface.
Tech Stack
- Frontend: React.js + TailwindCSS + ShadCN
- Backend: Fastify + Prisma + SQLite
- AI: ChatGPT API for recipe generation
- Payments: Stripe (subscriptions)
Project Structure
freedge/
├── frontend/ # React frontend application
│ ├── public/ # Static assets
│ └── src/ # Source code
│ ├── components/ # Reusable UI components
│ ├── pages/ # Application pages
│ ├── services/ # API service integrations
│ └── utils/ # Utility functions
│
├── backend/ # Fastify API server
│ ├── prisma/ # Prisma schema and migrations
│ └── src/ # Source code
│ ├── routes/ # API route definitions
│ ├── controllers/ # Request handlers
│ ├── services/ # Business logic
│ └── models/ # Data models
│
└── README.md # Project documentation
Getting Started
Prerequisites
- Node.js (v16+)
- npm or yarn
- SQLite
Installation
-
Clone the repository
git clone https://github.com/yourusername/freedge.git cd freedge -
Install backend dependencies
cd backend npm install -
Set up environment variables
- Create a
.envfile in the backend directory (or modify the existing one) - Add your OpenAI API key and Stripe keys
- Create a
-
Set up the database
npx prisma migrate dev --name init npx prisma generate -
Install frontend dependencies
cd ../frontend npm install -
Start the development servers
In the backend directory:
npm run devIn the frontend directory:
npm run dev -
Open your browser and navigate to
http://localhost:5173
Features
- User authentication with JWT
- Ingredient management
- AI-powered recipe generation
- Subscription management with Stripe
- Recipe history
API Routes
All routes are prefixed with /api.
Authentication
POST /auth/register- Create a new user accountPOST /auth/login- Login and get JWT token
Profile Management
GET /profile- Get user profilePUT /profile- Update user profile
Ingredients
GET /ingredients- Get user's ingredientsPOST /ingredients- Add a new ingredientDELETE /ingredients/:id- Delete an ingredient
Recipes
POST /recipes/generate- Generate a recipe based on ingredientsGET /recipes/history- Get recipe historyGET /recipes/:id- Get a specific recipe
Subscriptions
POST /subscriptions/create-checkout-session- Create a Stripe checkout sessionGET /subscriptions/status- Get subscription status
License
MIT