Backend
Frontend
Cook-It is a recipe application that facilitates users in discovering, creating, and managing recipes.
- Project Overview
- Project Deployment
- Key Features
- How It Works
- Project Structure
- Running the Application
- API Endpoints
- License
- DEMO: Cook IT
Cook-It is designed to simplify the process of managing recipes, providing users with a platform to explore, create, and organize their favorite recipes. With features like user authentication, CRUD operations on recipes, and search functionality, Cook-It offers a seamless cooking experience for enthusiasts of all levels.
Cook-It services are deployed separately. The backend API and the frontend application is deployed on are deployed on Render. Database is deployed on Aiven Below are the deployment details:
Due to free nature of deployment plans, the api is put to sleep due to inactivity. It may take up to a minute to "wake up". Please give it a time. :)
-
User Authentication:
- Users can register, log in, and log out securely.
- JWT tokens are used for authentication.
-
Recipe Management:
- CRUD operations for recipes (Create, Read, Update, Delete).
- Users can search for recipes by ingredients.
-
User Interaction:
- Users can like and bookmark recipes.
- View user-specific recipes such as liked, bookmarked, and created recipes.
-
User Authentication:
- Users register for an account or log in if they already have one.
- Upon successful authentication, users receive a JWT token for subsequent requests.
-
Recipe Management:
- Users can browse existing recipes.
- They can create new recipes, edit existing ones, or delete recipes they own.
-
User Interaction:
- Users can like and bookmark recipes to save them for later reference.
- They can view their liked, bookmarked, and created recipes in their profile.
The project follows a structured organization to enhance maintainability and ease of navigation. Here's a brief overview of the main directories and their purposes:
-
/server
: Contains the backend application built with Node.js and Express./components
: Contain logic for separate components like Recipe, User etc./components/share
: Contain relational components, errors, middlewares, validations etc.
-
/client
: Contains the frontend application built with Angular./src
: Angular components, styles, and application logic.
Feel free to explore each directory for more detailed information on their contents. This structure is designed to enhance code organization, making it easier for developers to locate and work on specific aspects of the application.
git clone https://github.com/didoslavov/cook-it.git
-
Open a new Command Prompt or PowerShell window in the root directory of your project.
-
Navigate to the
server
directory:cd server
-
Create a new
.env
file in theserver
directory with the following content (Fill with your actual data):DATABASE_PORT=18031 DATABASE_HOST=<DATABASE HOST> DATABASE_NAME=<DATABASE NAME> DATABASE_USER=<DATABASE USER> DATABASE_PASSWORD=<DATABASE PASSWORD> JWT_SECRET=<JWT SECRET>
-
Install server dependencies:
npm install
-
Start the server in development mode:
npm run dev
-
Open a new Command Prompt or PowerShell window in the root directory of your project.
-
Navigate to the
client
directory:cd client
-
Create a new
.env
file in theclient
directory with the following content (Fill with your actual data):NG_APP_NEWS_API_KEY=<NEWS API KEY> NG_APP_NEWS_API_URL=https://newsapi.org/v2/everything NG_APP_API_URL=https://cook-it.onrender.com NG_APP_SUPABASE_URL=<SUPABASE URL> NG_APP_SUPABASE_BUCKET=/storage/v1/object/public/<SUPABASE BUCKET NAME>/ NG_APP_SUPABASE_API_KEY=<SUPABASE API KEY>
-
Install client dependencies:
npm install
-
Start the client in development mode:
ng serve
-
Client setup is completed! Open the following link in your web browser: http://localhost:4200
-
POST /users/register
- Description: Register a new user.
- Request:
{ "username": "string", "email": "string", "password": "string" }
- Response:
{ "user": { "id": "string", "firstName": "string", "lastName": "string", "img": "string", "email": "string" } }
-
POST /users/login
- Description: Authenticate and log in a user.
- Request:
{ "email": "string", "password": "string" }
- Response:
{ "user": { "id": "string", "firstName": "string", "lastName": "string", "img": "string", "email": "string" } }
-
GET /users
- Description: Get all users.
- Response:
[ { "id": "string", "firstName": "string", "lastName": "string", "img": "string", "email": "string" } ]
-
PATCH /users/:userId/update
- Description: Update user information.
- Request:
{ "firstName": "string", "lastName": "string", "img": "string" }
- Response:
{ "id": "string", "firstName": "string", "lastName": "string", "img": "string", "email": "string" }
-
GET /users/recipes
- Description: Get recipes associated with the user.
- Response:
[ { "id": "string", "title": "string", "description": "string", "ingredients": ["string"], "steps": ["string"], "createdAt": "string", "updatedAt": "string", "userId": "string" } ]
-
GET /users/recipes/liked
- Description: Get recipes liked by the user.
- Response:
[ { "id": "string", "title": "string", "description": "string", "ingredients": ["string"], "steps": ["string"], "createdAt": "string", "updatedAt": "string", "userId": "string" } ]
-
GET /users/recipes/bookmarked
- Description: Get recipes bookmarked by the user.
- Response:
[ { "id": "string", "title": "string", "description": "string", "ingredients": ["string"], "steps": ["string"], "createdAt": "string", "updatedAt": "string", "userId": "string" } ]
This project is licensed under the MIT License - see the [LICENSE](https://opensource.org/license/mit/) file for details.