Skip to content

Takeoff-Tec/task.ify-backend

Repository files navigation

task.ify-backend

Contributors Forks Stargazers Issues MIT License


Logo

Task.ify: Streamlining your tasks with AI-curated playlists in a click.

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

The backend of this project is built using Node.js and Express.js, two popular frameworks for building server-side applications in Typescript. It serves as the server-side component responsible for handling incoming requests from clients, processing data, interacting with the database, and sending back appropriate responses. The backend serves as the backbone of the application, allowing the frontend and other client applications to communicate with the database and external services seamlessly alongside the security provided by the Spotify OAuthentication. It plays a crucial role in providing a reliable and efficient service to users, managing data, and enabling the main features of the application to function smoothly.

Take a Look @ Task.ify: https://taskify-frontendhost-2277661894f3.herokuapp.com/

Built With

npm
Express.js
TypeScript
PostgreSQL
Sequelize
Jest
supertest
ts-jest
sequelize-mock
jest-mock-axios
Axios
nodemon
dotenv
cors
SQLite
Redis

Getting Started

This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.

Installation

  1. Get a OpenAI API Key at [https://platform.openai.com/docs/api-reference/introduction)
  2. Get a Spotify API Key at [https://developer.spotify.com/documentation/web-api)
  3. Clone the repo
    git clone https://github.com/Takeoff-Tec/task.ify-backend
  4. Install NPM packages
    npm install
  5. Create and Enter your Open AI API KEY and Spotify Client Secret/ID in .env
    GPT_SECRETKEY = 'ENTER YOUR API';
    CLIENT_ID = 'ENTER YOUR API';
    CLIENT_SECET = 'ENTER YOUR API';
    
  6. Setup Database and Backend Server URL in .env
    DB_USER = 'ENTER YOUR LOCAL DB USERNAME';
    DB_HOST = 'ENTER YOUR LOCAL DB HOST';
    DB_NAME = 'ENTER YOUR LOCAL DB NAME';
    DB_PASSWORD = 'ENTER YOUR LOCAL DB PASSWORD';
    BACKEND_BASE_URL = 'ENTER YOUR LOCAL SERVER';
    FRONTEND_ASE_URL = 'ENTER YOUR LOCAL FRONTEND HOST';
    

Usage

Spotify OAuth and Redis Implementation

  • Spotify OAuth: Leveraged to authenticate users, this integration gave us direct access to users' Spotify profiles. This allowed us to craft a personalized experience based on users' musical preferences and listening histories.
  • Redis Integration: Incorporated as our choice of in-memory data structure store, Redis was pivotal in caching user session data. This ensured rapid application interactions, drastically reducing latency during recurring data access operations.

Sequilize Implementation

  • Object-Relational Mapping (ORM): Tables were effortlessly defined as objects for each model, enabling a clear representation of our database structure.
  • TypeScript Compatibility: Seamless integration with TypeScript ensured that our models were strongly typed, enhancing code reliability and predictability.
  • Relationships Made Easy: Defining the relationships between tables became intuitive, as evident in the associations between the 'User', 'Playlist', and 'Task' models.
  • Simplifying Queries: Gone are the days of lengthy SQL queries. With Sequelize, common tasks are abstracted into straightforward functions, streamlining database operations.
Screenshot of playlistRoute code displaying Spotify Playlist Creation Screenshot of playlistRoute code displaying Spotify Playlist Creation with Tracks

Playlist and Track Creation Process

  • GPT API Response: The initial response from the GPT API provides crucial information, which includes a suggested playlist name and an array of track details.
  • Extraction Process: From this GPT API response, we extract the recommended playlist name and the associated array of tracks.
  • Playlist Creation with Spotify API: Using the extracted playlist name, we make a request to the Spotify API to create a new playlist directly within the user's Spotify account.
  • Mapping Through Tracks: Post playlist creation, we iterate or map through the provided array of tracks.
  • Track Insertion: For each track in the array, we utilize the Spotify API again to add (or insert) these tracks into the newly created playlist on the user's Spotify account.

Roadmap

  • Spotify OAuthentication API
  • OpenAI API Generated Playlist Name and Tracks
  • Creation of Playlist with Tracks inserted in Spotify API
  • Task CRUD operations
    • Retrieves Spotify Cover

See the open issues for a full list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Pierre Johnson - linkedin - pierrelasaine@gmail.com

Camila Naranjo - linkedin - camilavnaranjoa@gmail.com

Maria Fernanda Palacios Martinez - linkedin - 03fernanda.palacios@gmail.com

Project Links

Backend Project Link: https://github.com/Takeoff-Tec/task.ify-backend

Frontend Project Link: https://github.com/Takeoff-Tec/task.ify-frontend

Deployed Site Link: https://taskify-frontendhost-2277661894f3.herokuapp.com/

Acknowledgments