Skip to content

hoangsonww/Moodify-Emotion-Music-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

580 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Moodify - Emotion-Based Music Recommendation App

With the rise of personalized music streaming services, there is a growing need for systems that can recommend music based on users' emotional states. Realizing this need, Moodify is being developed by Son Nguyen in 2024 to provide personalized music recommendations based on users' detected emotions.

Moodify Logo

The Moodify project is an integrated emotion-based music recommendation system that combines frontend, backend, AI/ML models, and data analytics to provide personalized music recommendations based on user emotions. The application analyzes text, speech, or facial expressions and suggests music that aligns with the detected emotions.

Supporting both desktop and mobile platforms, Moodify offers a seamless user experience with real-time emotion detection and music recommendations. The project leverages React for the frontend, Django for the backend, and three advanced, self-trained AI/ML models for emotion detection. Data analytics scripts and Apache Spark and Hadoop are also used to visualize emotion trends and model performance. Users open recommended tracks in Deezer's free web player straight from the Results page 🎸πŸ₯πŸŽΉ.

Python Node.js TypeScript JavaScript HTML5 CSS3 React Material UI Emotion React Router Three.js React Three Fiber WebGL Axios Webpack Babel ESLint Prettier Jest Testing Library Django Django REST Framework FastAPI Pydantic MongoEngine PyJWT Swagger Redoc Gunicorn WhiteNoise Pytest MongoDB MongoDB Atlas Redis Deezer API PyTorch TensorFlow Keras Transformers Hugging Face Hub Pandas Scikit Learn NumPy SciPy MLflow FER OpenCV Librosa React Native Expo EAS Hermes JS AsyncStorage Spark Hadoop Matplotlib NGINX Docker Kubernetes Helm Argo CD Terraform Jenkins GitHub Actions Vercel Modal Netlify AWS GCP Oracle Cloud JWT PBKDF2 CORS Git GitHub npm Postman

Important

⚠️ Impersonation Alert
Be aware that there may be fake accounts or handles (current known impersonator: @MoodifyAPP on X) claiming to be me and soliciting investments or personal information. I am only β€œSon Nguyen” at hoangsonww on GitHub and on any other platforms linked here in this repo.

β€’ Do not send money or personal data to anyone else.

β€’ Always verify you’re interacting with one of the links in this README.

β€’ If you have any questions or concerns, please contact me directly, before taking any action.

Single-command developer entry point

This repo ships a Makefile that wraps every common dev / ops task. From the repo root:

make help               # menu of every target
make install            # install all four workspaces
make dev                # run backend + frontend together
make test               # run jest + django + pytest
make deploy-prod        # Modal deploy + Vercel deploy (web + api)
make perf-smoke         # k6 smoke against prod

Self-host paths (Kubernetes, AWS / GCP / OCI / Azure, Argo CD, Helm) live under terraform/ (modules: vpc, eks, gke, aks, rds, redis, s3, monitoring, argocd), helm/ (moodify-backend, moodify-frontend, monitoring umbrella), kubernetes/, argocd/, k8s-addons/, aws/ (terraform/, kubernetes/production/, iam/, cloudwatch/), gcp/ (terraform/, kubernetes/, monitoring/), oracle-cloud/, and nginx/ (modular edge with snippets/, scripts/, exporter/). Each directory has its own README. The canonical production path is Vercel + Modal β€” see DEPLOYMENT.md.

Table of Contents

🎡 Overview

Moodify provides personalized music recommendations based on users' emotional states detected through text, speech, and facial expressions. It interacts with a Django-based backend, AI/ML models for emotion detection, and utilizes data analytics for visual insights into emotion trends and model performance.

System Architecture Overview

graph TB
    subgraph "Client Layer"
        A[Web App - React]
        B[Mobile App - React Native]
    end

    subgraph "Load Balancer Layer"
        C[NGINX Load Balancer]
    end

    subgraph "Application Layer"
        D[Django Backend API]
        E[AI/ML Service - Flask]
    end

    subgraph "AI/ML Models"
        F[Text Emotion Model<br/>BERT-based]
        G[Speech Emotion Model<br/>CNN + LSTM]
        H[Facial Emotion Model<br/>ResNet50]
    end

    subgraph "External Services"
        I[Deezer Search API]
    end

    subgraph "Data Layer"
        J[(MongoDB)]
        K[(Redis Cache)]
        L[(MongoDB Atlas)]
    end

    subgraph "Analytics Layer"
        M[Apache Spark]
        N[Apache Hadoop]
        O[Data Visualization]
    end

    A -->|HTTPS| C
    B -->|HTTPS| C
    C -->|Load Balance| D
    D -->|REST API| E
    E --> F
    E --> G
    E --> H
    D -->|Fetch Music| I
    D --> J
    D --> K
    D --> L
    J -.->|Analytics| M
    M <--> N
    M --> O

    style A fill:#61DAFB
    style B fill:#61DAFB
    style C fill:#009639
    style D fill:#092E20
    style E fill:#000000
    style F fill:#FF6F00
    style G fill:#FF6F00
    style H fill:#FF6F00
    style I fill:#1DB954
    style J fill:#47A248
    style K fill:#DC382D
    style M fill:#E25A1C
    style N fill:#66CCFF
Loading

Data Flow Architecture

sequenceDiagram
    participant U as User
    participant FE as Frontend
    participant LB as Load Balancer
    participant BE as Backend API
    participant AI as AI/ML Service
    participant DB as MongoDB
    participant SP as Deezer API
    participant CH as Redis Cache

    U->>FE: Input (Text/Speech/Image)
    FE->>LB: Send Request
    LB->>BE: Route to Backend
    BE->>CH: Check Cache
    alt Cache Hit
        CH-->>BE: Return Cached Result
    else Cache Miss
        BE->>AI: Forward for Analysis
        AI->>AI: Process with ML Model
        AI-->>BE: Return Emotion
        BE->>SP: Request Music Recommendations
        SP-->>BE: Return Tracks
        BE->>DB: Store User History
        BE->>CH: Cache Result
    end
    BE-->>FE: Return Recommendations
    FE-->>U: Display Results
Loading

🌐 Live Deployment

The Moodify app is currently live and deployed on Vercel. You can access the live app using the following link: https://moodify-app.vercel.app.

Feel free to also visit the backend at Moodify Backend API.

For your information, the front-end's production (deployment) branch is frontend-deployment/production, and the backend's production (deployment) branch is main-deployment-branch/production.

Important

Note: The Django API is deployed to Vercel and the ML inference service runs on Modal with memory snapshots + scale-to-zero, so the first request after idle may take ~1-2 s while a container is restored. Subsequent calls hit a warm container.

Important

Cold-start note: Modal scales to zero when idle, so the very first inference call after a quiet period may take a couple of seconds while a memory snapshot restores. The text/speech/facial endpoints never fail closed -- a model failure returns the neutral fallback emotion + a curated track list instead of a 500.

Note

There is no guarantee of uptime or performance with the current deployment, unless I have more resources (money) to upgrade the server :( Feel free to contact me if you encounter any issues or need further assistance.

Live Statuses

Deployed with Vercel Django on Vercel Inference on Modal AI/ML Tests Passing Netlify Backup OK Docker Container OK Jenkins Build Status Kubernetes Deployment OK GitHub Repo Size

🌟 Features

The Moodify project aims to provide the following features:

  • 🎯 Online reinforcement learning β€” every user trains their own playlist ranker in real time. A "Was this right?" widget records per-user mood corrections, and πŸ‘ / πŸ‘Ž / open-in-Deezer signals feed a Thompson-Sampling contextual bandit over a Beta-Bernoulli posterior that re-ranks every subsequent recommendation list. Mood-calibration map kicks in after 3 same-direction corrections; bandit kicks in after 20 logged signals. New and anonymous users see the rule-based pipeline unchanged.
  • πŸ” Passwordless sign-in with passkeys (WebAuthn / FIDO2) β€” users enroll multiple passkeys (Face ID, Touch ID, Windows Hello, Android screen lock, or a hardware security key) and sign in without a password. Passkeys are managed on a dedicated Account β†’ Passkeys page (add, rename, delete), a styled prompt offers setup right after sign-up, and a verified assertion mints the same JWT pair as password login. See Passkeys (WebAuthn).
  • User registration and login functionality.
  • Input analysis through text, speech, and facial expressions.
  • Real-time music recommendations based on emotion detection.
  • Visualization of emotion detection results and user history.
  • Data analytics scripts for emotion trends and model performance.
  • AI/ML models for text, speech, and facial emotion detection.
  • User profile management and customization.
  • Mobile app version for seamless user experience.
  • Progressive Web App (PWA) features for offline support.
  • Admin panel for managing users, recommendations, and data analytics.
  • And so much more!

Personalisation pipeline (RL layer)

Layer What it does Where
L1 β€” per-user mood calibration Persistent {predicted: {actual: count}} map on UserProfile. After β‰₯ 3 same-direction corrections, the text-emotion view rewrites the predicted label for that user only. Anonymous callers unaffected. backend/api/calibration.py, applied in api/views.py:text_emotion
L2 β€” disagreement / signal log Two MongoDB time-series collections, mood_feedback and track_feedback, capture every POST /api/feedback/ event for analysis and future LoRA fine-tunes. backend/api/feedback_store.py
L3 β€” Thompson-Sampling bandit re-rank Beta-Bernoulli posterior over a fixed 22-dim feature vector (emotionΓ—6, decadeΓ—7, durationΓ—4, popularity-quintileΓ—5). πŸ‘ β†’ +1 Ξ±, πŸ‘Ž β†’ +1 Ξ², open-in-Deezer β†’ +0.5 Ξ±. Re-orders the candidate list returned by the EWMA + Markov base scorer; can never inject, drop, or invent tracks. backend/api/bandit.py + backend/api/track_features.py, applied in api/views.py:music_recommendation

All three layers are user-scoped and authentication-gated. The feedback endpoint is POST /api/feedback/ and accepts both {kind: "mood", ...} and {kind: "track", ...} payloads (see backend/openapi.yaml).

Passkeys (WebAuthn)

Moodify supports passwordless sign-in with passkeys (WebAuthn / FIDO2) layered on top of the existing JWT auth β€” passwords keep working unchanged.

  • Multiple passkeys per account. Enroll a phone, a laptop, and a hardware security key; each is stored as its own credential.
  • Manage them in-app. A dedicated Account β†’ Passkeys page (the "Log Out" button becomes an Account dropdown when signed in β†’ Passkeys / Log Out) lets users add, rename, and delete passkeys, with device + "Synced" badges and last-used times.
  • Set-up prompt after sign-up. A styled, on-brand modal (never a browser alert) offers passkey creation right after registration.
  • Usernameless login. The login screen has a "Sign in with a passkey" option that works with discoverable credentials β€” no username required.

How it works (each ceremony is two calls):

register/begin   β†’  server issues PublicKeyCredentialCreationOptions + a single-use flowId
                    (the user's existing passkeys go in excludeCredentials)
register/complete→  server verifies the attestation (py_webauthn) and stores the public key
login/begin      β†’  server issues PublicKeyCredentialRequestOptions + flowId
login/complete   β†’  server verifies the assertion, advances the signature counter,
                    and returns the same { access, refresh } JWT pair as /users/login/

The server-issued challenge is persisted as a single-use, expiring record keyed by the opaque flowId, so the two-step handshake works statelessly across serverless instances. Verification is delegated to the audited py_webauthn library; the login begin response never discloses whether a username exists.

Setting Default Production value
WEBAUTHN_RP_ID localhost your frontend domain, e.g. moodify-app.vercel.app (bare host, no scheme)
WEBAUTHN_RP_NAME Moodify shown in the OS passkey sheet
WEBAUTHN_EXPECTED_ORIGINS http://localhost:3000,http://localhost:3001 comma-separated full origins, e.g. https://moodify-app.vercel.app
WEBAUTHN_CHALLENGE_TTL_SECONDS 300 how long a begun ceremony stays valid

Important

The RP id and expected origins must point at the frontend domain the browser is on β€” not the backend API host β€” because WebAuthn binds a passkey to the page's origin. Full endpoint reference lives in openapi.yaml (the Passkeys tag) and the live Swagger UI.

πŸ› οΈ Technologies

Here is the list of technologies used in the Moodify project:

Frontend:

  • React: For building the user interface.
  • Axios: For making HTTP requests to the backend.
  • Material UI: For styling and UI components.
  • React Router: For client-side routing.
  • Redux: For state management.
  • Jest: For unit testing.
  • React Testing Library: For testing React components.

Backend:

  • Django: For building the backend API.
  • Django REST Framework (DRF): For creating RESTful APIs.
  • MongoEngine: For MongoDB integration with Django.
  • JWT: For user authentication and authorization.
  • py_webauthn: For WebAuthn / FIDO2 passkey registration and assertion verification.
  • Deezer API: For fetching music recommendations (free, keyless).
  • Swagger: For API documentation.
  • Redoc: For API documentation.
  • Flask: For serving the AI/ML models as APIs.
  • Gunicorn: For serving the Django application.
  • NGINX: For load balancing and reverse proxy.

Databases:

  • MongoDB: For storing user data and music recommendations.
  • Redis: For caching and session management.
  • PostgreSQL: For production database (optional, can be configured).

AI/ML Models:

  • PyTorch: For building and training AI/ML models.
  • TensorFlow: For building and training AI/ML models.
  • Keras: For building and training AI/ML models.
  • HuggingFace: For using pre-trained models and transformers.
  • Pandas: For data manipulation and analysis.
  • Scikit Learn: For machine learning algorithms.
  • NumPy: For numerical computations.
  • MLflow: For tracking experiments and managing models.
  • FER: For facial emotion recognition.

Data Analytics:

  • Matplotlib: For data visualization.
  • Apache Hadoop: For big data processing and analytics.
  • Apache Spark: For distributed data processing and analytics.
  • PySpark: For using Spark with Python.

Mobile (in progress):

  • React Native: For building the mobile application.
  • Expo: For building and deploying the React Native app.
  • Expo Go: For testing the React Native app on mobile devices.

Containerization, Deployment, and CI/CD:

  • Docker: For containerizing the application.
  • Kubernetes: For orchestrating the containers.
  • Jenkins: For continuous integration and deployment.
  • Vercel: For hosting the Django API and React frontend.
  • Modal: For hosting the ML inference service (memory snapshots, scale-to-zero).
  • Vercel: For hosting the frontend application.
  • Netlify: For hosting the frontend application (backup).
  • GitHub Actions: For automating CI workflows and deployments.
  • Docker Compose: For managing multi-container application.

πŸ–ΌοΈ User Interface

Landing Page

Polished with WebGL + Three.js + React Three Fiber 3D components for a wonderful & appealing user experience!

Landing Page

Home Page

Home Page

Home Page

Home Page

Home Page - Dark Mode

Home Page - Dark Mode

Text Input

Text Input

Speech Input

Speech Input

Facial Expression Input

Facial Input

Text File Upload

Facial Input

Audio File Upload

Audio File Upload

Image File Upload

Image File Upload

Profile Page

Profile Page

Results - Recommendations Page

Results Page

Explore Page

Explore Page

Passkeys Management Page

Passkeys Management Page

Login Page

Login Page

Registration Page

Registration Page

Forgot Password Page

Forgot Password Page

Reset Password - Once the User Has Verified Their Account Ownership

Reset Password

Privacy Policy Page

Privacy Policy Page

Terms of Service Page

Terms of Service Page

Responsive Design - Mobile View

Mobile View

πŸ“‚ Complete File Structure

The project has a comprehensive file structure combining frontend, backend, AI/ML models, and data analytics components:

Moodify-Emotion-Music-App/
β”œβ”€β”€ frontend/                      # React frontend for the web application
β”‚   β”œβ”€β”€ public/
β”‚   β”‚   β”œβ”€β”€ index.html             # Main HTML file
β”‚   β”‚   β”œβ”€β”€ manifest.json          # Web app manifest
β”‚   β”‚   └── favicon.ico            # Favicon for the app
β”‚   β”‚
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/            # Contains all React components
β”‚   β”‚   β”œβ”€β”€ pages/                 # Contains main pages of the app
β”‚   β”‚   β”œβ”€β”€ styles/                # Contains global styles and themes
β”‚   β”‚   β”œβ”€β”€ context/               # Contains React Context API
β”‚   β”‚   β”œβ”€β”€ App.js                 # Main App component
β”‚   β”‚   β”œβ”€β”€ index.js               # Entry point for React
β”‚   β”‚   └── theme.js               # Material UI theme configuration
β”‚   β”‚ 
β”‚   β”œβ”€β”€ .gitignore                 # Git ignore file
β”‚   β”œβ”€β”€ Dockerfile                 # Dockerfile for containerization
β”‚   β”œβ”€β”€ package.json               # NPM dependencies and scripts
β”‚   └── README.md                  # Project documentation
β”‚ 
β”œβ”€β”€ backend/                       # Django backend for API services and database management
β”‚   β”œβ”€β”€ manage.py                  # Django's command-line utility
β”‚   β”œβ”€β”€ requirements.txt           # Backend dependencies
β”‚   β”œβ”€β”€ backend/
β”‚   β”‚   β”œβ”€β”€ settings.py            # Django settings for the project
β”‚   β”‚   β”œβ”€β”€ urls.py                # URL declarations for the project
β”‚   β”‚   β”œβ”€β”€ users/                 # User management components
β”‚   β”‚   └── api/                   # Emotion detection and recommendation APIs
β”‚   β”‚
β”‚   β”œβ”€β”€ .gitignore                 # Git ignore file
β”‚   β”œβ”€β”€ Dockerfile                 # Dockerfile for containerization
β”‚
β”œβ”€β”€ ai_ml/                         # AI/ML models for emotion detection
β”‚   β”œβ”€β”€ data/                      # Datasets for training and testing
β”‚   β”œβ”€β”€ models/                    # Trained models for emotion detection
β”‚   β”œβ”€β”€ src/                       # Source files for emotion detection and recommendation
β”‚   β”‚   β”œβ”€β”€ api/                   # API scripts for running emotion detection services
β”‚   β”‚   β”œβ”€β”€ recommendation/        # Music recommendation logic
β”‚   β”‚   └── data_processing/       # Data preprocessing scripts
β”‚   β”‚
β”‚   β”œβ”€β”€ Dockerfile                 # Dockerfile for containerization
β”‚   └── README.md                  # AI/ML documentation
β”‚
β”œβ”€β”€ data_analytics/                # Data analytics scripts and visualizations
β”‚   β”œβ”€β”€ emotion_distribution.py    # Script for visualizing emotion distribution
β”‚   β”œβ”€β”€ training_visualization.py  # Script for visualizing training and validation metrics
β”‚   β”œβ”€β”€ predictions_analysis.py    # Script for analyzing model predictions
β”‚   β”œβ”€β”€ recommendation_analysis.py # Script for visualizing music recommendations
β”‚   β”œβ”€β”€ spark-hadoop/              # Spark and Hadoop integration scripts
β”‚   └── visualizations/            # Generated visualizations
β”‚
β”œβ”€β”€ kubernetes/                    # Kubernetes deployment files
β”‚   β”œβ”€β”€ backend-deployment.yaml    # Deployment file for the backend service
β”‚   β”œβ”€β”€ backend-service.yaml       # Deployment file for the backend service
β”‚   β”œβ”€β”€ frontend-deployment.yaml   # Deployment file for the frontend service
β”‚   β”œβ”€β”€ frontend-service.yaml      # Deployment file for the frontend service
β”‚   └── configmap.yaml             # ConfigMap for environment variables
β”‚ 
β”œβ”€β”€ aws/                           # AWS deployment and infrastructure as code (IaC) files
β”œβ”€β”€ gcp/                           # GCP deployment and infrastructure as code (IaC) files
β”‚
β”œβ”€β”€ mobile/                        # React Native mobile application
β”‚   β”œβ”€β”€ App.js                     # Main entry point for React Native app
β”‚   β”œβ”€β”€ index.js                   # App registry for React Native
β”‚   β”œβ”€β”€ package.json               # NPM dependencies and scripts
β”‚   β”œβ”€β”€ components/                # React Native components
β”‚   β”‚   β”œβ”€β”€ Footer.js              # Footer component
β”‚   β”‚   β”œβ”€β”€ Navbar.js              # Header component
β”‚   β”‚   β”œβ”€β”€ Auth/                  # Authentication components (e.g., Login, Register)
β”‚   β”‚   └── Profile/               # Profile-related components
β”‚   β”‚
β”‚   β”œβ”€β”€ context/                   # React Context API for state management
β”‚   β”‚   └── DarkModeContext.js     # Dark mode context provider
β”‚   β”‚
β”‚   β”œβ”€β”€ pages/                     # Main pages of the app
β”‚   β”‚   β”œβ”€β”€ HomePage.js            # Home page component
β”‚   β”‚   β”œβ”€β”€ ProfilePage.js         # Profile page component
β”‚   β”‚   β”œβ”€β”€ ResultsPage.js         # Results page component
β”‚   β”‚   β”œβ”€β”€ LandingPage.js         # Landing page component
β”‚   β”‚   └── (and more...)
β”‚   β”‚
β”‚   β”œβ”€β”€ assets/                    # Images, fonts, and other assets
β”‚   β”œβ”€β”€ styles/                    # Styling files (similar to CSS for web)
β”‚   β”œβ”€β”€ .gitignore                 # Git ignore file
β”‚   β”œβ”€β”€ package.json               # Dependencies and scripts
β”‚   └── README.md                  # Mobile app documentation
β”‚
β”œβ”€β”€ nginx/                         # NGINX configuration files (for load balancing and reverse proxy)
β”‚   β”œβ”€β”€ nginx.conf                 # Main NGINX configuration file
β”‚   └── Dockerfile                 # Dockerfile for NGINX container
β”‚
β”œβ”€β”€ images/                        # Images used in the README documentation 
β”œβ”€β”€ docker-compose.yml             # Docker Compose file for containerization
└── README.md                      # Comprehensive README file for the entire project

πŸ› οΈ Getting Started

Prerequisites

  • Node.js (v14 or higher)
  • Python 3.8 or later
  • MongoDB
  • Virtual Environment (venv)
  • .env File (for environment variables - you create your own credentials following the example file or contact me for mine.)

1. Setup and Train AI/ML Models

Start with setting up and training the AI/ML models, as they will be required for the backend to function properly.

Or, you can download the pre-trained models from the Google Drive links provided in the Pre-Trained Models section. If you choose to do so, you can skip this section for now.

  1. Clone the repository:

    git clone https://github.com/hoangsonww/Moodify-Emotion-Music-App.git
  2. Navigate to the AI/ML directory:

    cd Moodify-Emotion-Music-App/ai_ml
  3. Create and activate a virtual environment:

    python -m venv venv
    source venv/bin/activate   # For macOS/Linux
    .\venv\Scripts\activate    # For Windows
  4. Install dependencies:

    pip install -r requirements.txt
  5. Edit the configurations in the src/config.py file:

    • Visit modal_inference/config.py if you need to override defaults. Music recommendations come from Deezer's public, keyless API -- no Spotify credential is required.
    • Visit the individual model training scripts in the src/models directory and update the paths to the datasets and output paths as needed.
    • Ensure all paths are correctly set before training the models!
  6. Train the text emotion model:

    python src/models/train_text_emotion.py

    Repeat similar commands for other models as needed (e.g., facial and speech emotion models).

  7. Ensure all trained models are placed in the models directory, and that you have trained all necessary models before moving to the next step!

  8. Test the trained AI/ML models as needed:

    • Run the src/models/test_emotion_models.py script to test the trained models.
    • Ensure the models are providing accurate predictions before moving to the next step.

2. Set Up the Backend

Once the AI/ML models are ready, proceed with setting up the backend.

  1. Navigate to the backend directory:

    cd ../backend
  2. Create and activate a virtual environment:

    python -m venv venv
    source venv/bin/activate   # For macOS/Linux
    .\venv\Scripts\activate    # For Windows
  3. Install dependencies:

    pip install -r requirements.txt
  4. Configure your secrets and environment:

    • Create a .env file in the backend directory.
    • Add the following environment variables to the .env file:
      SECRET_KEY=your_secret_key
      DEBUG=True
      ALLOWED_HOSTS=<your_hosts>
      MONGODB_URI=<your_mongodb_uri>
      # Passkeys / WebAuthn β€” defaults below work for local dev as-is.
      # In production set the RP id/origins to your FRONTEND domain.
      WEBAUTHN_RP_ID=localhost
      WEBAUTHN_RP_NAME=Moodify
      WEBAUTHN_EXPECTED_ORIGINS=http://localhost:3000,http://localhost:3001
      
    • Visit backend/settings.py and add SECRET_KEY & set DEBUG to True.

Caution

Ensure these steps are completed before running the backend server.

  1. Run database migrations:

    python manage.py migrate
  2. Start the Django server:

    python manage.py runserver

    The backend server will be running at http://127.0.0.1:8000/.

3. Install and Run the Frontend

Finally, set up the frontend to interact with the backend.

  1. Navigate to the frontend directory:

    cd ../frontend
  2. Install dependencies using Yarn:

    npm install
  3. Start the development server:

    npm start

    The frontend will start at http://localhost:3000.

Note

If you encounter any problems or need my .env file, feel free to contact me.

πŸ“‹ API Endpoints

User Endpoints

HTTP Method Endpoint Description
POST /users/register/ Register a new user
POST /users/login/ Login a user and obtain a JWT token
GET /users/user/profile/ Retrieve the authenticated user's profile
PUT /users/user/profile/update/ Update the authenticated user's profile
DELETE /users/user/profile/delete/ Delete the authenticated user's profile
POST /users/recommendations/ Save recommendations for a user
GET /users/recommendations/<str:username>/ Retrieve recommendations for a user by username
DELETE /users/recommendations/<str:username>/<str:recommendation_id>/ Delete a specific recommendation for a user
DELETE /users/recommendations/<str:username>/ Delete all recommendations for a user
POST /users/mood_history/<str:user_id>/ Add a mood to the user's mood history
GET /users/mood_history/<str:user_id>/ Retrieve mood history for a user
DELETE /users/mood_history/<str:user_id>/ Delete a specific mood from the user's history
POST /users/listening_history/<str:user_id>/ Add a track to the user's listening history
GET /users/listening_history/<str:user_id>/ Retrieve listening history for a user
DELETE /users/listening_history/<str:user_id>/ Delete a specific track from the user's history
POST /users/user_recommendations/<str:user_id>/ Save a user's recommendations
GET /users/user_recommendations/<str:user_id>/ Retrieve a user's recommendations
DELETE /users/user_recommendations/<str:user_id>/ Delete all recommendations for a user
POST /users/verify-username-email/ Verify if a username and email are valid
POST /users/reset-password/ Reset a user's password
GET /users/verify-token/ Verify a user's token

Passkey Endpoints (WebAuthn / FIDO2)

Every ceremony is two calls β€” begin returns server options + an opaque flowId, complete posts the signed credential back. A verified login assertion returns the same {access, refresh} JWT pair as /users/login/.

HTTP Method Endpoint Auth Description
POST /users/passkeys/register/begin/ Bearer Start enrolling a passkey (returns creation options)
POST /users/passkeys/register/complete/ Bearer Verify the attestation and store the new passkey
POST /users/passkeys/login/begin/ none Start a passkey sign-in (username-scoped or usernameless)
POST /users/passkeys/login/complete/ none Verify the assertion and issue a JWT pair
GET /users/passkeys/ Bearer List the signed-in user's passkeys
PATCH /users/passkeys/<str:passkey_id>/ Bearer Rename a passkey
DELETE /users/passkeys/<str:passkey_id>/ Bearer Delete a passkey

Emotion Detection Endpoints

HTTP Method Endpoint Description
POST /api/text_emotion/ Analyze text for emotional content
POST /api/speech_emotion/ Analyze speech for emotional content
POST /api/facial_emotion/ Analyze facial expressions for emotions
POST /api/music_recommendation/ Get music recommendations based on emotion

Speech and facial uploads bypass Django and hit the Modal inference service directly with the user's JWT β€” see modal_inference/README.md for the direct-upload contract.

Observability Endpoints

HTTP Method Endpoint Auth Description
GET /api/health/ none Django liveness probe
GET /api/metrics/?window=1h&endpoint=... service token Aggregated error rates + p50/p95/p99 latency + throughput (Django side)
GET Modal /health none Modal liveness + cache + rate-limit stats
GET Modal /metrics?window=1h&endpoint=... service token Aggregated SRE metrics from the Modal inference service
GET Modal / none Welcome JSON with links + endpoint catalogue + rate-limit ceilings

Both /metrics endpoints persist one row per request to a MongoDB Atlas time-series collection (30-day TTL), so trends survive container restarts and scale-to-zero. See modal_inference/README.md#sre-metrics and backend/README.md#sre-metrics for the full design (schema, resilience model, cost math).

Admin Interface Endpoints

HTTP Method Endpoint Description
GET /admin/ Django admin (local-only β€” see Admin Interface)

The admin is local-only. It is gated behind ENABLE_ADMIN=True (auto-on whenever DEBUG=True). The Vercel deploy ships with ENABLE_ADMIN=False, so /admin/ returns 404 in production β€” by design, since production has no SQL database.

Documentation Endpoints

HTTP Method Endpoint Description
GET /swagger/ Access the Swagger UI API documentation
GET /redoc/ Access the Redoc API documentation
GET / Access the API root endpoint (Swagger UI)

Admin Interface (local only)

Production runs on Vercel with no SQL database, so the classic Django admin is intentionally disabled there. Locally it's a single env-flag away β€” flip it on, apply migrations once, create a superuser, and the familiar admin login page lives at /admin/.

  1. Opt in (auto-on whenever DEBUG=True):
    export ENABLE_ADMIN=True       # or set DEBUG=True
  2. One-time SQLite + admin tables:
    python manage.py migrate
  3. Create a superuser:
    python manage.py createsuperuser
  4. Run the server and open the admin:
    python manage.py runserver
    open http://127.0.0.1:8000/admin/

User-facing data (mood history, listening history, saved recommendations) lives in MongoDB Atlas and is managed through the REST API, not the admin. The admin only sees Django's own auth.User table β€” the superuser you create with createsuperuser.

Admin Login

Admin Login

πŸš€ Backend APIs Documentation

Our backend APIs are all well-documented using Swagger UI and Redoc. You can access the API documentation at the following URLs:

  • Swagger UI: https://moodify-backend-api.vercel.app/swagger/.
  • Redoc: https://moodify-backend-api.vercel.app/redoc/.

Important

Our backend server may spin down after a period of inactivity, so it may take a few seconds to load initially!

Alternatively, you can run the backend server locally and access the API documentation at the following endpoints:

  • Swagger UI: http://127.0.0.1:8000/swagger.
  • Redoc: http://127.0.0.1:8000/redoc.

Regardless of your choice, you should see the following API documentation if everything is running correctly:

Swagger UI:

Swagger UI

Redoc:

Redoc

πŸ€– About the AI/ML Models

AI/ML Models Overview

The AI/ML models are built using PyTorch, TensorFlow, Keras, and HuggingFace Transformers. These models are trained on various datasets to detect emotions from text, speech, and facial expressions.

The emotion detection models are used to analyze user inputs and provide real-time music recommendations based on the detected emotions. The models are trained on various datasets to capture the nuances of human emotions and provide accurate predictions.

  • Text Emotion Detection: Detects emotions from text inputs.
  • Speech Emotion Detection: Analyzes emotions from speech inputs.
  • Facial Emotion Detection: Detects emotions from facial expressions.

The models are integrated into the backend API services to provide real-time emotion detection and music recommendations for users.

Training the AI/ML Models

The models must be trained first before using them in the backend services. Ensure that the models are trained and placed in the models directory before running the backend server. Refer to the (Getting Started)[#getting-started] section for more details.

AI/ML Models Examples of training the text emotion model.

To train the models, you can run the provided scripts in the ai_ml/src/models directory. These scripts are used to preprocess the data, train the models, and save the trained models for later use. These scripts include:

  • train_text_emotion.py: Trains the text emotion detection model.
  • train_speech_emotion.py: Trains the speech emotion detection model.
  • train_facial_emotion.py: Trains the facial emotion detection model.

Ensure that you have the necessary dependencies, datasets, and configurations set up before training the models. Specifically, make sure to visit the config.py file and update the paths to the datasets and output directories to the correct ones on your system.

Important

By default, these scripts will prioritize using your GPU with CUDA (if available) for faster training. However, if that is not available on your machine, the scripts will automatically fall back to using the CPU for training.

To ensure that you have the necessary dependencies for GPU training, install PyTorch with CUDA support using the following command:

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

Testing the AI/ML Models

After that, you can run the test_emotion_models.py script to test the trained models and ensure they are providing accurate predictions:

python src/models/test_emotion_models.py

Alternatively, you can run the simple Flask API to test the models via RESTful API endpoints:

python ai_ml/src/api/emotion_api.py

The endpoints are as follows:

  • /text_emotion: Detects emotion from text input
  • /speech_emotion: Detects emotion from speech audio
  • /facial_emotion: Detects emotion from an image
  • /music_recommendation: Provides music recommendations based on the detected emotion

Important

For more information about training and using the models, please refer to the AI/ML documentation in the ai_ml directory.**

Pre-Trained Models

However, if training the model is too resource-intensive for you, you can use the following Google Drive links to download the pre-trained models:

These have been pre-trained on the datasets for you and are ready to use in the backend services or for testing purposes once downloaded and correctly placed in the models directory.

Feel free to contect me if you encounter any issues or need further assistance with the AI/ML models.

πŸ“Š Analytics Scripts

The data_analytics folder provides data analysis and visualization scripts to gain insights into the emotion detection model's performance.

  1. Run All Analytics Scripts:

    python data_analytics/main.py
  2. View generated visualizations in the visualizations folder.

  3. Here are some example visualizations:

Emotion Distribution Emotion Distribution Visualization

Training Loss Curve Visualization Training Loss Curve Visualization

πŸ“± Mobile App Version

There is also a fully-featured native mobile app built with React Native (Expo SDK 51). It runs from a single codebase on iOS 18+ and Android 15+, talks to the same Django REST API and Modal inference service as the web client, and ships with JWT auth, silent token refresh, mood-tinted theming, and graceful offline-degraded inference.

πŸ“˜ Deep dive: see MOBILE_APPS.md for every screen, every diagram, and side-by-side iOS + Android captures. The short tour and dev setup live in mobile/README.md.

Highlights

  • Three inference modes β€” text, voice (.m4a), front-camera selfie.
  • JWT auth with silent refresh β€” collapsed concurrent 401s, single in-flight refresh.
  • Graceful degradation β€” Modal cold start or network failure still yields a curated fallback playlist (degraded: true).
  • Auto-detected market from device locale (16 countries + Global).
  • Per-mood gradient theming with 13 distinct mood palettes.
  • Custom blurred pill tab bar floating above the content.

Screen tour β€” iOS + Android side-by-side

Login Home β€” Text Home β€” Voice Home β€” Face
Results Sort sheet Market sheet Profile
Settings Edit email Change password Register
Forgot β€” Verify Forgot β€” Reset
Explore β€” iOS Explore β€” Android

Mobile architecture

flowchart LR
    subgraph Device[πŸ“± iOS / Android]
        UI[React Native UI]
        Ctx[AuthContext]
        Store[(AsyncStorage)]
        Cam[expo-camera]
        Mic[expo-av]
    end
    UI --> Ax[Axios + interceptors]
    Ctx <--> Store
    Cam --> UI
    Mic --> UI
    Ax -- "auth, profile, history" --> API[Django REST API]
    Ax -- "text, audio, image" --> Modal[Modal inference]
    UI -- "open URL" --> Deezer[(Deezer search)]
Loading

Run it

cd mobile
npm install                              # or yarn install
cp .env.example .env                     # set EXPO_PUBLIC_API_URL / EXPO_PUBLIC_MODAL_API_URL
npx expo start                           # press i (iOS), a (Android), w (web), or scan the QR with Expo Go
# port collision?  npx expo start --port 8083

For production builds, use EAS Build β€” see mobile/README.md for the full flow.

Feel free to explore the mobile app and test its functionalities!

πŸ”— Load Balancing

The project uses NGINX and Gunicorn for load balancing and serving the Django backend. NGINX acts as a reverse proxy server, while Gunicorn serves the Django application.

  1. Install NGINX:

    sudo apt-get update
    sudo apt-get install nginx
  2. Install Gunicorn:

     pip install gunicorn
  3. Configure NGINX:

    • Update the NGINX configuration file (if needed) at /nginx/nginx.conf with your configuration.
  4. Start NGINX and Gunicorn:

    • Start NGINX:
      sudo systemctl start nginx
    • Start Gunicorn:
      gunicorn backend.wsgi:application
  5. Access the backend at http://<server_ip>:8000/.

Feel free to customize the NGINX configuration and Gunicorn settings as needed for your deployment.

🐳 Containerization

The project can be containerized using Docker for easy deployment and scaling. You can create Docker images for the frontend, backend, and AI/ML models.

Container Architecture

graph LR
    subgraph "Docker Compose Stack"
        subgraph "Application Containers"
            A[Frontend Container<br/>React:3000]
            B[Backend Container<br/>Django:8000]
            C[AI/ML Container<br/>Flask:5000]
        end

        subgraph "Database Containers"
            D[MongoDB Container<br/>:27017]
            E[Redis Container<br/>:6379]
        end

        subgraph "Infrastructure"
            F[NGINX Container<br/>:80]
        end
    end

    F -->|Proxy| A
    F -->|Proxy| B
    A -->|API Calls| B
    B -->|ML Requests| C
    B -->|Data| D
    B -->|Cache| E

    style A fill:#61DAFB
    style B fill:#092E20
    style C fill:#000000
    style D fill:#47A248
    style E fill:#DC382D
    style F fill:#009639
Loading
  1. Build the Docker images:

    docker compose up --build
  2. The Docker images will be built for the frontend, backend, and AI/ML models. Verify the images using:

    docker images

If you encounter any errors, try to rebuild your image without using the cache since Docker's cache may cause issues.

docker-compose build --no-cache

User Authentication Flow

sequenceDiagram
    participant U as User
    participant FE as Frontend
    participant BE as Backend API
    participant DB as MongoDB
    participant JWT as JWT Service
    participant CH as Redis

    U->>FE: Login Request
    FE->>BE: POST /users/login/
    BE->>DB: Verify Credentials
    alt Valid Credentials
        DB-->>BE: User Found
        BE->>JWT: Generate Tokens
        JWT-->>BE: Access + Refresh Tokens
        BE->>CH: Cache Session
        BE-->>FE: Return Tokens
        FE->>FE: Store in localStorage
        FE-->>U: Redirect to Dashboard
    else Invalid Credentials
        DB-->>BE: User Not Found
        BE-->>FE: 401 Unauthorized
        FE-->>U: Show Error
    end

    Note over U,CH: Subsequent Requests
    U->>FE: Make Request
    FE->>BE: Request + Bearer Token
    BE->>CH: Validate Token
    alt Valid Token
        CH-->>BE: Token Valid
        BE->>BE: Process Request
        BE-->>FE: Return Data
    else Invalid Token
        CH-->>BE: Token Invalid
        BE-->>FE: 401 Unauthorized
        FE->>BE: Refresh Token
        BE->>JWT: Generate New Access Token
        JWT-->>BE: New Access Token
        BE-->>FE: Return New Token
        FE->>FE: Update Token
    end
Loading

πŸ§ͺ Testing

Moodify uses Jest for backend API testing and Jest with React Testing Library for frontend component testing. The tests ensure that the APIs and components are functioning correctly.

Backend API and AI/ML Model Tests

The project includes unit tests for the backend APIs and AI/ML models. You can run the tests to ensure everything is working correctly.

  1. Navigate to the backend directory:

    cd backend
  2. Run the tests:

    pytest -q

This will run all the tests in the API and AI/ML model directories. Ensure that all tests pass before deploying the application.

Frontend Tests

The frontend also includes unit tests for the React components. You can run the tests using the following command:

cd frontend

# Run the frontend tests (default mode)
npm test

# Run the frontend tests in watch mode (will re-run tests on file changes)
npm test:watch

# Run the frontend tests in coverage mode (generates a coverage report)
npm test:coverage

This will run all the tests in the frontend directory and generate a coverage report. Ensure that all tests pass before deploying the frontend application.

Snapshot Tests

Every screen in the app is covered by a snapshot test under frontend/src/__tests__/snapshots/ (one file per screen: Landing, Home, Profile, Results, Recommendations, Not Found, Forgot Password, Passkeys, Privacy Policy, and Terms of Service). Each renders the screen inside the providers it needs (dark-mode context, router, toast) and asserts the rendered markup with toMatchSnapshot(), so unintended UI changes surface in the diff. The committed baselines live in the adjacent __snapshots__/ directory.

cd frontend

# Run only the snapshot suite
npm test -- src/__tests__/snapshots

# Update the snapshots after an intentional UI change
npm test -- -u

After a deliberate UI change, run npm test -- -u to refresh the baselines, then commit the updated .snap files alongside your change.

☸️ Kubernetes

We also added Kubernetes deployment files for the backend and frontend services. You can deploy the services on a Kubernetes cluster using the provided YAML files.

Kubernetes Deployment Architecture

graph TB
    subgraph "Kubernetes Cluster"
        subgraph "Ingress Layer"
            ING[Ingress Controller<br/>NGINX]
        end

        subgraph "Service Layer"
            SVC1[Frontend Service<br/>ClusterIP]
            SVC2[Backend Service<br/>ClusterIP]
            SVC3[AI/ML Service<br/>ClusterIP]
            SVC4[MongoDB Service<br/>ClusterIP]
            SVC5[Redis Service<br/>ClusterIP]
        end

        subgraph "Deployment Layer"
            subgraph "Frontend Pods"
                FE1[Frontend Pod 1]
                FE2[Frontend Pod 2]
                FE3[Frontend Pod 3]
            end

            subgraph "Backend Pods"
                BE1[Backend Pod 1]
                BE2[Backend Pod 2]
                BE3[Backend Pod 3]
            end

            subgraph "AI/ML Pods"
                AI1[AI/ML Pod 1]
                AI2[AI/ML Pod 2]
            end

            subgraph "StatefulSets"
                DB1[MongoDB Pod]
                RD1[Redis Pod]
            end
        end

        subgraph "Storage Layer"
            PV1[(Persistent Volume<br/>MongoDB)]
            PV2[(Persistent Volume<br/>Models)]
        end

        subgraph "ConfigMaps & Secrets"
            CM[ConfigMap]
            SEC[Secrets]
        end
    end

    ING -->|Route /| SVC1
    ING -->|Route /api| SVC2
    SVC1 --> FE1 & FE2 & FE3
    SVC2 --> BE1 & BE2 & BE3
    SVC3 --> AI1 & AI2
    SVC4 --> DB1
    SVC5 --> RD1
    BE1 & BE2 & BE3 -->|Connect| SVC3
    BE1 & BE2 & BE3 -->|Connect| SVC4
    BE1 & BE2 & BE3 -->|Connect| SVC5
    DB1 --> PV1
    AI1 & AI2 --> PV2
    FE1 & FE2 & FE3 -.->|Config| CM
    BE1 & BE2 & BE3 -.->|Config| CM
    BE1 & BE2 & BE3 -.->|Credentials| SEC

    style ING fill:#009639
    style SVC1 fill:#326CE5
    style SVC2 fill:#326CE5
    style SVC3 fill:#326CE5
    style SVC4 fill:#326CE5
    style SVC5 fill:#326CE5
    style FE1 fill:#61DAFB
    style FE2 fill:#61DAFB
    style FE3 fill:#61DAFB
    style BE1 fill:#092E20
    style BE2 fill:#092E20
    style BE3 fill:#092E20
    style AI1 fill:#FF6F00
    style AI2 fill:#FF6F00
    style DB1 fill:#47A248
    style RD1 fill:#DC382D
Loading
  1. Deploy the backend service:

    kubectl apply -f kubernetes/backend-deployment.yaml
  2. Deploy the frontend service:

     kubectl apply -f kubernetes/frontend-deployment.yaml
  3. Expose the services:

    kubectl expose deployment moodify-backend --type=LoadBalancer --port=8000
    kubectl expose deployment moodify-frontend --type=LoadBalancer --port=3000
  4. Access the services using the LoadBalancer IP:

    • You can access the backend service at http://<backend_loadbalancer_ip>:8000.
    • You can access the frontend service at http://<frontend_loadbalancer_ip>:3000.

Feel free to visit the kubernetes directory for more information about the deployment files and configurations.

πŸ”— Jenkins

We have also included Jenkins pipeline script for automating the build and deployment process. You can use Jenkins to automate the CI/CD process for the Moodify app.

CI/CD Pipeline Architecture

graph LR
    subgraph "Source Control"
        A[GitHub Repository]
    end

    subgraph "CI/CD Pipeline - GitHub Actions & Jenkins"
        B[Trigger on Push/PR]
        C[Run Tests]
        D[Build Docker Images]
        E[Security Scanning]
        F[Push to Registry]
        G[Deploy to Staging]
        H[Integration Tests]
        I[Deploy to Production]
    end

    subgraph "Container Registry"
        J[Docker Hub/ECR/GCR]
    end

    subgraph "Deployment Targets"
        K[Kubernetes Cluster]
        L[AWS/GCP]
        M[Vercel Frontend]
        N[Vercel Backend]
    end

    subgraph "Monitoring"
        O[Health Checks]
        P[Rollback on Failure]
    end

    A -->|Webhook| B
    B --> C
    C -->|Pass| D
    D --> E
    E -->|Pass| F
    F --> J
    J --> G
    G --> H
    H -->|Pass| I
    I --> K
    I --> L
    I --> M
    I --> N
    K & L & M & N --> O
    O -->|Failure| P
    P --> G

    style A fill:#181717
    style B fill:#2088FF
    style C fill:#34A853
    style D fill:#2496ED
    style E fill:#FF6B6B
    style F fill:#4CAF50
    style G fill:#FFA000
    style H fill:#34A853
    style I fill:#4CAF50
    style J fill:#2496ED
    style K fill:#326CE5
    style L fill:#FF9900
    style M fill:#000000
    style N fill:#46A2F1
Loading

Deployment Workflow

stateDiagram-v2
    [*] --> CodeCommit
    CodeCommit --> BuildStage
    BuildStage --> TestStage
    TestStage --> SecurityScan
    SecurityScan --> BuildImages
    BuildImages --> PushRegistry
    PushRegistry --> StagingDeploy
    StagingDeploy --> IntegrationTest

    state TestStage {
        [*] --> UnitTests
        UnitTests --> IntegrationTests
        IntegrationTests --> E2ETests
        E2ETests --> [*]
    }

    state IntegrationTest {
        [*] --> HealthCheck
        HealthCheck --> SmokeTests
        SmokeTests --> [*]
    }

    IntegrationTest --> ApprovalGate
    ApprovalGate --> ProductionDeploy: Approved
    ApprovalGate --> [*]: Rejected

    state ProductionDeploy {
        [*] --> BlueGreenDeploy
        BlueGreenDeploy --> CanaryRelease
        CanaryRelease --> FullRollout
        FullRollout --> [*]
    }

    ProductionDeploy --> MonitoringAlerts
    MonitoringAlerts --> Healthy: All Clear
    MonitoringAlerts --> Rollback: Issues Detected

    Rollback --> StagingDeploy
    Healthy --> [*]
Loading
  1. Install Jenkins on your server or local machine.

  2. Create a new Jenkins pipeline job:

    • Create a new pipeline job in Jenkins.
    • Configure the pipeline to use the Jenkinsfile in the jenkins directory.
  3. Run the Jenkins pipeline:

    • Run the Jenkins pipeline to build and deploy the Moodify app.
    • The pipeline will automate the build, test, and deployment process for the app.

Feel free to explore the Jenkins pipeline script in the Jenkinsfile and customize it as needed for your deployment process.

πŸš€ OpenAPI Specification

The backend APIs are documented using the OpenAPI Specification (OAS) format. The openapi.yaml file contains the API documentation in the OAS format, which can be used to generate client libraries, server stubs, and mock servers.

Using the openapi.yaml File

  1. View the API Documentation
  • Open Swagger Editor.
  • Upload the openapi.yaml file or paste its content.
  • Visualize and interact with the API documentation.
  1. Test the API
  • Import openapi.yaml into Postman:
    • Open Postman β†’ Import β†’ Select openapi.yaml.
    • Test the API endpoints directly from Postman.
  • Or use Swagger UI:
    • Provide the file URL or upload it to view and test endpoints.
  1. Generate Client Libraries
  • Install OpenAPI Generator:
    npm install @openapitools/openapi-generator-cli -g
  • Generate a client library:
    openapi-generator-cli generate -i openapi.yaml -g <language> -o ./client
  • Replace <language> with the desired programming language.
  1. Generate Server Stubs
  • Generate a server stub:
    openapi-generator-cli generate -i openapi.yaml -g <framework> -o ./server
  • Replace <framework> with the desired framework.
  1. Run a Mock Server
  • Install Prism:
    npm install -g @stoplight/prism-cli
  • Start the mock server:
    prism mock openapi.yaml
  1. Validate the OpenAPI File
  • Use Swagger Validator:
    • Upload openapi.yaml or paste its content to check for errors.

This guide enables you to view, test, and utilize the API.

πŸ”§ Contributing

  • Contributions are welcome! Feel free to fork the repository and submit a pull request.

  • Note that this project is still under active development, and any contributions are appreciated.

  • If you have any suggestions, feature requests, or bug reports, feel free to open an issue here.

πŸ“ License

  • This project is licensed under the MIT License. Please see the LICENSE file for details.
  • If you use or build upon this project, please provide the necessary attribution and references.

πŸ“§ Contact


Happy Coding and Vibin'! 🎢

Created with ❀️ by Son Nguyen in 2024.


πŸ” Back to Top

About

🎹 Moodify - an emotion-based music recommendation system that uses AI/ML models to analyze text, speech, and facial expressions, providing personalized music recommendations across web and mobile platforms.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors