Skip to content

Latest commit

 

History

History
312 lines (238 loc) · 9.33 KB

README.md

File metadata and controls

312 lines (238 loc) · 9.33 KB

Backend

Node.js Express.js TypeScript MySQL Sequelize JWT Bcrypt

Frontend

Angular TypeScript FontAwesome RxJS Supabase Animate.css Ngx Cookie Service Ngx Infinite Scroll NEWS API

Cook-It

Cook-It is a recipe application that facilitates users in discovering, creating, and managing recipes.

Table of Contents

Project Overview

Watch video overview of the project

Your Video

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.

Deployed Project Showcase

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:

Note

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. :)

Key Features

  1. User Authentication:

    • Users can register, log in, and log out securely.
    • JWT tokens are used for authentication.
  2. Recipe Management:

    • CRUD operations for recipes (Create, Read, Update, Delete).
    • Users can search for recipes by ingredients.
  3. User Interaction:

    • Users can like and bookmark recipes.
    • View user-specific recipes such as liked, bookmarked, and created recipes.

How It Works

  1. 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.
  2. Recipe Management:

    • Users can browse existing recipes.
    • They can create new recipes, edit existing ones, or delete recipes they own.
  3. 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.

Project Structure

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.

Running the Application

Clone the Repository

git clone https://github.com/didoslavov/cook-it.git

Server Setup

  1. Open a new Command Prompt or PowerShell window in the root directory of your project.

  2. Navigate to the server directory:

    cd server
  3. Create a new .env file in the server 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>
    
  4. Install server dependencies:

    npm install
  5. Start the server in development mode:

    npm run dev

Client Setup

  1. Open a new Command Prompt or PowerShell window in the root directory of your project.

  2. Navigate to the client directory:

    cd client
  3. Create a new .env file in the client 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>
    
  4. Install client dependencies:

    npm install
  5. Start the client in development mode:

    ng serve
  6. Client setup is completed! Open the following link in your web browser: http://localhost:4200

API Endpoints

Authentication

  • 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"
          }
      }

User Management

  • 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"
          }
      ]

License

This project is licensed under the MIT License - see the [LICENSE](https://opensource.org/license/mit/) file for details.