create a prompt for me to generate a fully functionaly deployable app with cursor - for an app that asks questions about your daily diet and gives feedback on what you could improve on the same dishes you use.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Here's a well-crafted prompt you can use with Cursor (or any AI code generation tool) to create a fully functional, deployable web app. This prompt is designed to generate a complete application based on your description: an app that asks users about their daily diet and provides feedback on improving the same dishes. I've structured it to ensure the output includes a frontend for user interaction, a backend for logic and data handling, a simple database for storing user data, and deployment instructions. The tech stack suggested is React for the frontend (for a responsive UI), Node.js with Express for the backend (for simplicity and ease of deployment), and SQLite for a lightweight database. This keeps the app straightforward to build, run, and deploy.
Prompt for Cursor:
code
Create a complete, fully functional, and deployable web application that helps users track their daily diet and receive personalized feedback on how to improve the nutritional value of the dishes they consume. The app should be built using modern web technologies: React for the frontend to handle user interfaces, Node.js with Express for the backend to manage API requests and logic, and SQLite for a simple database to store user data and feedback history. Ensure the app is responsive, user-friendly, and includes basic error handling.
Key features to implement:
1. **User Registration and Login:** Allow users to sign up and log in using email and password. Use JWT (JSON Web Tokens) for authentication to keep sessions secure.
2. **Diet Input Form:** After logging in, users should be able to answer questions about their daily diet. This could be a multi-step form or a single page with fields for meals (e.g., breakfast, lunch, dinner). Users should input dish names or descriptions (e.g., "pizza", "salad").
3. **Feedback Generation:** Based on the user's input, the app should provide feedback on how to improve the dishes. Use a predefined set of rules or a simple database lookup for common foods. For example:
- If the user inputs "pizza", suggest "Use whole wheat crust and add more vegetables for better fiber and nutrients."
- Include a JSON file or database table with common foods and improvement suggestions to keep it simple and avoid external APIs.
- Make the feedback personalized by referencing the user's specific input.
4. **History and Tracking:** Store users' past diet entries and feedback in the database. Provide a dashboard where users can view their history, see trends, and get summary feedback (e.g., "You've had high-carb meals lately—try balancing with more proteins").
5. **User Interface Elements:**
- A clean, intuitive React-based UI with forms, buttons, and modals.
- Use libraries like React Router for navigation (e.g., pages for login, diet input, feedback, and history).
- Add basic styling with CSS or a framework like Tailwind CSS for a professional look.
6. **Backend API Endpoints:**
- POST /api/register and POST /api/login for authentication.
- POST /api/diet to submit daily diet data.
- GET /api/feedback to retrieve feedback based on submitted data.
- GET /api/history to fetch user's past entries.
- Ensure the backend handles validation, sanitization, and error responses.
7. **Database Schema:** Use SQLite with a simple schema:
- Users table: id, email, password (hashed), created_at.
- DietEntries table: id, user_id, meal_type (e.g., breakfast), dish_description, date.
- Feedback table: id, diet_entry_id, feedback_text (or store feedback logic in code).
8. **Security and Best Practices:**
- Hash passwords using bcrypt.
- Protect routes with authentication middleware.
- Handle CORS for frontend-backend communication.
- Ensure the app is secure against common vulnerabilities like SQL injection (use parameterized queries).
The output should include:
- A full codebase organized into folders (e.g., /client for React frontend, /server for Node.js backend).
- A package.json file for both frontend and backend with all necessary dependencies (e.g., react, express, sqlite3, jsonwebtoken, bcrypt).
- Scripts to run the app locally (e.g., "npm start" for frontend and backend).
- A README.md file with step-by-step instructions on:
- How to install dependencies (using npm install).
- How to run the app locally (e.g., start backend server and frontend dev server).
- How to deploy the app to a platform like Heroku, including any necessary environment variables (e.g., for database connection or JWT secret).
- Any additional setup, such as seeding the database with initial food feedback data.
Make the app deployable with minimal configuration. Aim for a simple, efficient implementation that can be extended later. Generate the code in a way that's easy to copy and paste into Cursor or a code editor, and ensure it's well-commented for clarity.
How to Use This Prompt in Cursor:
Copy and paste this prompt directly into Cursor's chat or prompt input.
Cursor should generate a complete codebase. Review the generated code for any issues, as AI outputs can sometimes have bugs.
Once generated, you can run the app locally by following the README instructions in the output.
For deployment, the prompt specifies including instructions for Heroku (a free and easy platform). If you prefer another platform (e.g., Vercel for frontend-only or AWS), you can modify the prompt accordingly.
This prompt ensures the app is comprehensive yet simple, focusing on core functionality while being deployable. If you need adjustments (e.g., adding AI features or changing the tech stack), let me know!