A SAAS platform that allows gym-goers to vote for their favorite songs, dynamically updating the playlist based on the real-time votes. Built using Next.js, Prisma ORM, and Postgres as the database.
This project is a Software as a Service (SAAS) that enhances the gym experience by letting gym members vote for the songs they want to hear. The playlist is dynamically updated based on these votes, ensuring that the gym’s music keeps everyone energized!
- Live Voting System: Users can vote for songs in real-time via the platform.
- Dynamic Playlist: The playlist updates automatically based on current votes, ensuring the most popular songs are played.
- Gym-Specific Playlists: Each gym can customize its song list based on preferred genres or user input.
- Mobile-Friendly: The platform works across devices – smartphones, tablets, and desktops.
- Secure Authentication: User login and voting are secured with authentication mechanisms.
- Admin Dashboard: Manage gyms, users, and songs via an intuitive admin interface.
- Next.js - React-based framework for building user interfaces
- TypeScript - Type-safe code for better maintainability and scaling
- Node.js - Server-side JavaScript runtime environment
- Prisma ORM - Database ORM for connecting to Postgres and performing database operations
- Postgres - Relational database to store song data, user info, votes, and more
- GraphQL (Optional) - For efficient querying of data between frontend and backend
- Docker - Containerized deployment
- CI/CD - Automated testing and deployment using GitHub Actions
.
├── prisma # Prisma schema & migrations
├── src # Source code
│ ├── components # React components
│ ├── pages # Next.js pages
│ ├── api # API routes for voting, playlists
│ ├── utils # Utility functions
│ ├── styles # Global CSS
│ └── prisma # Prisma client and database interactions
├── public # Static assets (images, etc.)
└── README.md # Project readme
- Node.js >= 14.x
- Postgres (Installed or use Docker for local development)
- Prisma (Install globally
npm install -g prisma
)
-
Clone the Repository:
git clone https://github.com/your-username/gym-music-voting-saas.git cd gym-music-voting-saas
-
Install Dependencies:
npm install
-
Set Up the Database:
-
Create a
.env
file with your Postgres connection string:DATABASE_URL=postgresql://user:password@localhost:5432/yourdbname
-
Initialize the database:
npx prisma migrate dev --name init
-
Generate Prisma client:
npx prisma generate
-
-
Start the Development Server:
npm run dev
The app will run at
http://localhost:3000
.
Here’s an example of what your prisma/schema.prisma
might look like:
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
votes Vote[]
}
model Song {
id Int @id @default(autoincrement())
title String
artist String
votes Vote[]
}
model Gym {
id Int @id @default(autoincrement())
name String
location String
songs Song[]
}
model Vote {
id Int @id @default(autoincrement())
user User @relation(fields: [userId], references: [id])
userId Int
song Song @relation(fields: [songId], references: [id])
songId Int
createdAt DateTime @default(now())
}
-
Docker: You can deploy this project using Docker by following these steps:
-
Create a
Dockerfile
anddocker-compose.yml
file. -
Build the Docker image:
docker-compose up --build
-
-
Vercel: If deploying on Vercel, simply link your repository and follow Vercel's setup process for Next.js apps.
Make sure to create a .env
file with the following environment variables:
DATABASE_URL
: The connection string for your Postgres database.NEXTAUTH_SECRET
: A secret key for authentication (if using NextAuth for user authentication).NEXT_PUBLIC_API_URL
: URL for API calls (for frontend to interact with backend).
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Push the branch (
git push origin feature-branch
). - Create a pull request.
This project is licensed under the MIT License.