LyricsIntelliect is a web application that analyzes song lyrics to provide meaningful insights. Simply enter an artist and song title, and the application will fetch the lyrics, provide a brief summary of what the song is about, and identify any countries mentioned in the lyrics.
- Song Analysis: Get a concise one-sentence summary of what a song is about
- Country Detection: Identify countries mentioned in song lyrics
- User Authentication: Secure login/registration system
- History Tracking: View your previously analyzed songs
- Reanalysis: Re-run the analysis for a song you have already submitted
- Responsive Design: Works on desktop and mobile devices
- Framework: Django 5.1.7 with Django REST Framework 3.16.0
- Database: PostgreSQL 16.2
- Task Queue: Celery 5.5.0 with Redis
- Authentication: JWT (djangorestframework-simplejwt)
- API Documentation: drf-spectacular
- Lyrics Source: Musixmatch API
- Text Analysis: OpenAI GPT API
- Framework: React 19 with TypeScript
- Build Tool: Vite 6.2
- UI Components: shadcn/ui with Tailwind CSS 4.0
- Form Handling: react-hook-form with zod validation
- HTTP Client: Axios
- Router: react-router 7
- State Management: SWR for data fetching
- Backend Hosting: AWS EC2
- Frontend Hosting: Netlify
- Containerization: Docker Compose
- Docker and Docker Compose
- Node.js (v18+)
- npm or yarn
- Git
-
Clone the repository:
git clone https://github.com/abdullahmujahidali/LyricsIntelliect.git cd LyricsIntelliect -
Create a
.envfile in the backend directory based on the.env.example:cd backend cp .env.example .env -
Update the
.envfile with your database credentials, API keys, and other configurations:DB_NAME=lyricsintelliect DB_USER=yourusername DB_PASSWORD=yourpassword DB_HOST=db DB_PORT=5432 REDIS_URL=redis://redis:6379/1 CELERY_BROKER_URL=redis://redis:6379/0 CELERY_RESULT_BACKEND=django-db MUSIXMATCH_API_KEY=your_musixmatch_api_key OPENAI_API_KEY=your_openai_api_key OPENAI_MODEL=gpt-3.5-turbo ACCESS_TOKEN_LIFETIME_MINUTES=60 REFRESH_TOKEN_LIFETIME_DAYS=1 -
Start the backend services using Docker Compose:
docker-compose up -d
-
The backend will be available at http://localhost:8000
-
Navigate to the frontend directory:
cd ../frontend -
Install dependencies:
npm install # or yarn -
Create a
.env.localfile:VITE_API_BASE_URL=http://localhost:8000
-
Start the development server:
npm run dev # or yarn dev -
The frontend will be available at http://localhost:5173
Once the backend is running, you can access the API documentation at:
- Swagger UI: http://localhost:8000/docs/
- ReDoc: http://localhost:8000/redoc/
-
Connect to your EC2 instance:
ssh -i your-key.pem ec2-user@your-ec2-instance-ip
-
Clone the repository and set up the environment as described in the backend setup.
-
Configure Nginx as a reverse proxy:
server { listen 80; server_name your_domain_or_ip; location / { proxy_pass http://127.0.0.1:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } } -
Start the Docker Compose services.
-
Connect your GitHub repository to Netlify.
-
Configure the build settings:
- Build command:
npm run buildoryarn build - Publish directory:
dist
- Build command:
-
Set the environment variables:
VITE_API_BASE_URL=http://your_backend_url
-
Deploy the site.
The application uses JWT-based authentication. When a user logs in, they receive an access token and a refresh token. The access token is used to authenticate API requests, while the refresh token is used to obtain a new access token when the current one expires.
backend/
βββ core/ # Django project settings and configuration
βββ songs/ # Song analysis app
β βββ models.py # Song data model
β βββ services.py # External API integrations (Musixmatch, OpenAI)
β βββ tasks.py # Celery tasks for asynchronous processing
β βββ views.py # API endpoints for song analysis
β βββ serializers.py # Data serialization/deserialization
βββ users/ # User management app
βββ docker-compose.yml # Docker configuration for services
βββ requirements.txt # Python dependencies
frontend/
βββ public/ # Static files
βββ src/
β βββ components/ # Reusable UI components
β βββ context/ # React context for global state
β βββ hooks/ # Custom React hooks
β βββ layout/ # Layout components
β βββ lib/ # Utility functions and client config
β βββ services/ # API service functions
β βββ types/ # TypeScript type definitions
β βββ views/ # Page components
βββ package.json # Node.js dependencies
DB_NAME,DB_USER,DB_PASSWORD,DB_HOST,DB_PORT: Database connection detailsREDIS_URL,CELERY_BROKER_URL,CELERY_RESULT_BACKEND: Celery and Redis configurationMUSIXMATCH_API_KEY: API key for MusixmatchOPENAI_API_KEY: API key for OpenAIOPENAI_MODEL: OpenAI model to use for analysis (default: "gpt-3.5-turbo")ACCESS_TOKEN_LIFETIME_MINUTES,REFRESH_TOKEN_LIFETIME_DAYS: JWT token configuration
VITE_API_BASE_URL: URL of the backend API
To run backend tests:
cd backend
python manage.py testTo create a superuser:
cd backend
python manage.py createsuperuserTo run linting:
cd frontend
npm run lint
# or
yarn lintTo build for production:
cd frontend
npm run build
# or
yarn build- Fork the repository
- Create your feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add some amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a pull request
- Musixmatch API for providing song lyrics
- OpenAI GPT API for text analysis capabilities
- shadcn/ui for the beautiful UI components
- Tailwind CSS for styling
- Django REST Framework for API development
- Vite for frontend build tooling