Skip to content

Commit b6e488f

Browse files
authored
Merge pull request #21 from michiganhackers/dev
v1.0.1 Updates to docs, standardized .env usage within code for dev and prod environments
2 parents 828c90d + b66fa6c commit b6e488f

File tree

5 files changed

+44
-9
lines changed

5 files changed

+44
-9
lines changed

docs/CONTRIBUTING.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Contributing Guidelines
2+
3+
## Table of Contents
4+
5+
1. [Introduction](#introduction)
6+
2. [Development Process](#development-process)
7+
3. [Best Practices](#best-practices)
8+
4. [How to make a good issue/pull request?](#how-to-make-a-good-issuepull-request)
9+
10+
## Introduction
11+
The purpose of this document is to provide a general set of guidelines for contributing to Green Monster Jelly. It will consist of a guide to the development process, some best practices for improving the speed of getting your code shipped, and what constitutes a good issue or pull request. These are not rigid rules, and are meant to guide new contributors through making there first pull request.
12+
13+
## Development Process
14+
So, you set up your environment, played around with the app, and you discover a bug you'd like to fix, where should you start? Well, when you have decided you want to contribute, the very first step should be to make an issue on our [github page](https://github.com/michiganhackers/spotify-open-source-proj/issues). Here, you will include information about what you would like to add/change to the project as well as why you believe it will benefit the project. Check out [making a good issue/pull request](#how-to-make-a-good-issuepull-request) for more information on crafting a quality issue. From here, you will be contacted by a project maintainer who may either approve your request or follow up with questions and/or concerns. At some point, you will likely gain approval to submit a pull request to this issue, and will be assigned to the issue.
15+
16+
Alternatively, if you decide to attack an already posted issue, you should again request approval to be assigned to the issue.
17+
18+
After meticulously debugging the project and finally arriving at a suitable solution, you decide your code is suitable to be pushed to ~~main~~ dev. To do so, you should submit a pull request again on our [github](https://github.com/michiganhackers/spotify-open-source-proj/pulls). In here, you will document your changes to the code and how you've tested them. Expect to receive heavy feedback, including any requested changes. More info on making a good pull request [here](#how-to-make-a-good-issuepull-request). Eventually, your pull request may be approved and your code committed to our codebase. Congratulations!
19+
20+
21+
## Best Practices
22+
- Always work out of the dev branch.
23+
- Communicate your ideas early and often, there is no point in implementing and debugging code that doesn't comply with the goals of the project.
24+
- When attempting to resolve an issue on our github, make sure nobody has been assigned to it yet.
25+
- Before submitting a pull request, make sure you have removed all unnecessary comments, debugging logging statements, and any other changes that are not vital to the functionality.
26+
- Always provide a comprehensive list of how you tested your pull request, it will help to speed up maintainers' response times.
27+
28+
## How to make a good issue/pull request?
29+
Coming soon.

docs/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,13 @@ SPOTIFY_CLIENT_SECRET="<your-spotify-client-secret>"
6363

6464
### Next.js Application Setup
6565

66-
To run the development server:
66+
Install dependencies:
67+
68+
```
69+
npm i
70+
```
71+
72+
Run the development server:
6773

6874
```bash
6975
npm run dev
@@ -101,7 +107,7 @@ The responsibility of the client is to provide a web interface for which users c
101107

102108
#### 2. Next.js Server
103109

104-
The responsibility of the server is to maintain and arbitrate the state of a given session (as well as to serve front-end files that will be used by the client, but this is all done behind the scenes with Next so no need to worry too much about this). This means that any call that will interact with a user's Spotify queue must travel through the Next.js server via one of its api endpoints (defined in /api/spotify/). In addition to this, the server provides clear methods for initializing and connecting to sessions (/api/sessionDB/{connect | create}). This also means that the Next.js server is responsible for the destruction of said sessions and any related clean up calls to the database ** yet to be implemented **.
110+
The responsibility of the server is to maintain and arbitrate the state of a given session (as well as to serve front-end files that will be used by the client, but this is all done behind the scenes with Next so no need to worry too much about this). This means that any call that will interact with a user's Spotify queue must travel through the Next.js server via one of its api endpoints (defined in /api/spotify/). In addition to this, the server provides clear methods for initializing and connecting to sessions (/api/sessionDB/{connect | create}). This also means that the Next.js server is responsible for the destruction of said sessions and any related clean up calls to the database (/api/sessionDB/delete).
105111

106112
#### 2.1. Database!!
107113
Speaking of the database, a dedicated library of database focused functions are defined within the /database/db.ts file. These functions are available for access by both the Next.js server and its Websocket counterpart, but should **not** be utilized within any direct client component. In addition to this, you will find the schema of said database is accessible within the /database/ directory.

src/app/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default function Home() {
4848
sessionStorage.setItem("username", hostUsername); // change this to a nextjs cookie (server-side)
4949
sessionStorage.setItem("isHost", "true"); // change this to a nextjs cookie (server-side)
5050
const client_id : string | undefined = process.env.NEXT_PUBLIC_SPOTIFY_CLIENT_ID; // Spotify developer client id for API calls
51-
const redirect_uri : string = `${process.env.APP_SERVER}/api/spotify/getToken`
51+
const redirect_uri : string = `${process.env.NEXT_PUBLIC_APP_SERVER}/api/spotify/getToken`
5252
const scope : string = 'user-read-currently-playing user-read-playback-state user-modify-playback-state';
5353
handleSpotifyAuth(client_id, redirect_uri, scope); }
5454
}}>
@@ -89,7 +89,7 @@ async function connectToSession(guestCode : string, username : string, router :
8989
let stat;
9090
try {
9191

92-
await fetch(`${process.env.APP_SERVER}/api/sessionDB/connect`, {
92+
await fetch(`${process.env.NEXT_PUBLIC_APP_SERVER}/api/sessionDB/connect`, {
9393
method: 'POST',
9494
headers: {
9595
'Content-Type': 'application/json',

src/app/session/[id]/client.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ function Queue({ isHost, initQueue, socket, username, sid }: { isHost : boolean,
175175
// Handles song submission then clears input
176176
const handleAddSong = (songId : string) => {
177177

178-
fetch(`${process.env.APP_SERVER}/api/spotify/addSong`, { // Adds song to the database
178+
fetch(`${process.env.NEXT_PUBLIC_APP_SERVER}/api/spotify/addSong`, { // Adds song to the database
179179
method: 'POST',
180180
headers: {
181181
'Content-Type': 'application/json',
@@ -217,7 +217,7 @@ function Queue({ isHost, initQueue, socket, username, sid }: { isHost : boolean,
217217
return;
218218
}
219219
// Requests all similar song names
220-
fetch(`${process.env.APP_SERVER}/api/spotify/searchSongs`, {
220+
fetch(`${process.env.NEXT_PUBLIC_APP_SERVER}/api/spotify/searchSongs`, {
221221
method: 'POST',
222222
headers: {
223223
'Content-Type': 'application/json',

src/app/session/[id]/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default function SessionPage({ params } : { params: { id: string} }) {
2020
useEffect(() => {
2121
// Add host's name to DB now that session has been created
2222
if(sessionStorage.getItem('isHost') === "true") {
23-
fetch(`${process.env.APP_SERVER}/api/sessionDB/addHostName`, {
23+
fetch(`${process.env.NEXT_PUBLIC_APP_SERVER}/api/sessionDB/addHostName`, {
2424
method: "POST",
2525
headers: {
2626
'Content-Type': 'application/json'
@@ -43,7 +43,7 @@ export default function SessionPage({ params } : { params: { id: string} }) {
4343
}
4444
else{
4545
// This functionality below should be encompassed by initSession, including the clientNames and current queue state as well
46-
fetch(`${process.env.APP_SERVER}/api/sessionDB/getHostName?session_id=${params.id}`, {
46+
fetch(`${process.env.NEXT_PUBLIC_APP_SERVER}/api/sessionDB/getHostName?session_id=${params.id}`, {
4747
method: "GET",
4848
headers: {
4949
'Content-Type': 'application/json'
@@ -70,7 +70,7 @@ export default function SessionPage({ params } : { params: { id: string} }) {
7070

7171
useEffect(() => {
7272
const initSession = () => {
73-
fetch(`${process.env.APP_SERVER}/api/sessionDB/initSession`, {
73+
fetch(`${process.env.NEXT_PUBLIC_APP_SERVER}/api/sessionDB/initSession`, {
7474
method: 'POST',
7575
headers: {
7676
'Content-Type': 'application/json',

0 commit comments

Comments
 (0)