Code Monkey home page Code Monkey logo

ticktack's Introduction

Instructions

How to run the program

  1. Clone the repository
  2. Open the terminal and navigate to the directory where the repository is located
  3. Run the command npm install to install the dependencies
  4. Run the command npm start to start the program or npm run dev to start the program in development mode Note: The server will run on port 4000 by default. If you want to change the port, you can do so by changing the value of the PORT variable in the .env file

Project Structure

Describe the frontend

Frontend Framework

  • React, React Native (for the mobile app)
  • Redux, Redux Toolkit (for state management)
  • React Navigation (for navigation)
  • React Native Paper (for UI)
  • Axios (for making HTTP requests) -- still not installed
  • FlashList (replace for FlatList)
  • AsyncStorage (replace for LocalStorage)
  • Lodas (for functions)

How it works

  • The app is divided into 3 main parts: components, pages and navigators
  • Components are reusable UI components
  • Pages are the screens of the app
  • Navigators are the navigators of the app
  • The app uses Redux for state management

How to add a new page

  1. Create a new folder in the pages folder
  2. Create a new file in the folder you just created
  3. Add the code to the file you just created
  4. Modify the config object in the src/app.tsx file to add the new page to the app
  5. Add new page name to type AppStackParamList in the src/AppNavigator.tsx file
  6. Add Stack.Screen to AppStack in the src/navigators/AppNavigator.tsx file to add the new page to the app Note: Remember to import the new page in the src/AppNavigator.tsx file

How to use Jest to make unit tests

  1. Create a new file in the src folder

PostgreSql Database Instructions

  1. Create a .env file in the backend folder with the following content:
DB_USER=postgres
DB_HOST=localhost
DB_NAME=ticktack
DB_PORT=5432
DB_PASS=your-password-here
JWT_SECRET=jwts3cr3t
GOOGLE_REFRESH_TOKEN=your-refresh-token-here
GOOGLE_CLIENT_ID=your-client-id-here
GOOGLE_CLIENT_SECRET=your-client-secret-here
GOOGLE_REDIRECT_URI=https://developers.google.com/oauthplayground
GOOGLE_DRIVE_FOLDER_ID=your-folder-id-here
COOKIE_PARSER_SECRET=cookieparsersecret
  1. As we use python to insert data into the database, you need to install the following packages:
pip install psycopg2
pip install json
pip install python-dotenv
pip install pathlib
pip install numpy
  1. Open pgAdmin and create a new database named "ticktack"
  2. Run the sql script in the backend/src/database folder to create the tables
  3. Run the python script in the backend/src/database folder to insert the data into the tables

How to start the recommender

Run on your own

  1. Change the directory to the recommender folder
  2. Create a virtual environment in the recommender folder with python 3.10
python -m venv venv
  1. Activate the virtual environment
venv/Scripts/activate
  1. Install the required packages
pip install -r requirements.txt
  1. Run the 2 scripts in the recommender folder separately
python .\model_builder.py
python .\recommender.py

Run on docker

  1. Change the directory to the recommender folder
  2. Build the docker image for the first time or after changes
docker compose up --build
  • If you want to run the docker image without building it
docker compose up

If successfully run, the recommender will be available at http://127.0.0.1:8080/recommend. The request format is as follows: http://127.0.0.1:8080/recommend?userId=1&number=5. The userId is the user id and the number is the number of recommendations to be returned.

model_builder.py will track the changes in the database and update the model accordingly. recommender.py will start a flask server to serve the recommendations.

ticktack's People

Contributors

cokavn11 avatar lactquan avatar giathinn avatar tuongthoai avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.