Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// This can be used to network with other containers or with the host.
"forwardPorts": [3000, 3001, 5432, 5555],
"forwardPorts": [3001, 3002, 5432, 5555],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",
Expand Down
8 changes: 4 additions & 4 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
DATABASE_URL="postgresql://postgres:password@localhost:5432/classroom"
#if you are on gitpod, MOCK_USER_DATA_URL is https://30001-XXXXX.XXXXX.gitpod.io/data
#if you are on gitpod, MOCK_USER_DATA_URL is https://3002-XXXXX.XXXXX.gitpod.io/data
MOCK_USER_DATA_URL = "http://localhost:3001/data"
#if you are on gitpod, NEXTAUTH_URL is https://3000-XXXXX.XXXXX.gitpod.io/
NEXTAUTH_URL="http://localhost:3000"
#if you are on gitpod, NEXTAUTH_URL is https://3001-XXXXX.XXXXX.gitpod.io/
NEXTAUTH_URL="http://localhost:3001"

#set NEXTAUTH_SECRET with random string (can create via commandline `openssl rand -base64 32`)
#https://next-auth.js.org/configuration/options#secret
Expand All @@ -12,7 +12,7 @@ NEXTAUTH_SECRET=abcdefghijlmnopqrstuvwxyz
#If you are a dev contributing to the project, it is easier to setup a github provider than an Auth0 one.
#Auth0 will be the only provider allowed on production however.
#https://docs.github.com/en/developers/apps/building-oauth-apps/creating-an-oauth-app
#If running on your local machine, the callback URL will normally be https://localhost:3000/api/auth/callback/github
#If running on your local machine, the callback URL will normally be http://localhost:3001/api/auth/callback/github

GITHUB_ID=
GITHUB_SECRET=
Expand Down
5 changes: 4 additions & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ image: gitpod/workspace-postgres
ports:
- port: 5432 #postgres
onOpen: ignore
- port: 3000 #http
- port: 3001 #http (classroom app)
onOpen: notify
visibility: public
- port: 3002 #mock data server
onOpen: ignore
visibility: public

tasks:
- init: >
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ If you have used GitHub Codespaces in other projects, doing the same in freeCode

Within freeCodeCamp Classroom, GitHub Codespaces is on par with Gitpod so that you can use either.

This [video](https://www.loom.com/share/37dcb9555ad642618d82619277daaa38?sid=c17189b2-5798-44c9-8b74-38749f3578e1) walks through the setup process on Github Codespaces. Note that this video was recorded on Feb 10, 2025. It is not guaranteed to be up to date with any new setup instructions added after that date.
This [video](https://www.loom.com/share/37dcb9555ad642618d82619277daaa38?sid=c17189b2-5798-44c9-8b74-38749f3578e1) walks through the setup process on Github Codespaces. Note that this video was recorded on Feb 10, 2025. It is not guaranteed to be up to date with any new setup instructions added after that date.

### Optional - GitPod Dev Environment

Expand Down Expand Up @@ -95,6 +95,8 @@ postgresql://postgres:password@localhost:5432/classroom
8. Run `npm run mock-fcc-data`
9. Run `npx prisma studio`

**Note:** The classroom app runs on port 3001 and mock data on port 3002 to avoid conflicts with freeCodeCamp's main platform (ports 3000/8000).

Need more help? Ran into issues? Check out this [guide](https://docs.google.com/document/d/1apfjzfIwDAfg6QQf2KD1E1aeD-KU7DEllwnH9Levq4A/edit) that walks you through all the steps of setting up the repository locally, without Docker.

### Join us in our [Discord Chat](https://discord.gg/qcynkd4Edx) here.
Expand Down
10 changes: 5 additions & 5 deletions codespace-instructions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ Almost done! Just need to set up a NextAuth Provider and run the app.
https://docs.github.com/en/developers/apps/building-oauth-apps/creating-an-oauth-app

The mock user data URL is:
https://${CODESPACE_NAME}-3001.app.github.dev/data
https://${CODESPACE_NAME}-3002.app.github.dev/data

The homepage is:
https://${CODESPACE_NAME}-3000.app.github.dev
https://${CODESPACE_NAME}-3001.app.github.dev

The callback URL is:
https://${CODESPACE_NAME}-3000.app.github.dev/api/auth/callback/github
https://${CODESPACE_NAME}-3001.app.github.dev/api/auth/callback/github

2.) Set NEXTAUTH_URL in .env to https://${CODESPACE_NAME}-3000.app.github.dev
2.) Set NEXTAUTH_URL in .env to https://${CODESPACE_NAME}-3001.app.github.dev

3.) To setup GITHUB_ID and GITHUB_SECRET after setting up the OAuth app:
-Your Client ID is shown in the OAuth app page. Copy and paste it to GITHUB_ID.
Expand All @@ -38,7 +38,7 @@ Additional Steps to take After Finishing Codespaces Setup:

6.) Run npm run mock-fcc-data

7.) Go to the ports tab and set the visibility to public for the 3000 and 3001 ports.
7.) Go to the ports tab and set the visibility to public for the 3001 and 3002 ports.

8.) Optional: To connect to a PostgreSQL server in a db container via psql PostgreSQL client in this app container

Expand Down
8 changes: 4 additions & 4 deletions gitpod-instructions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ echo 1.\) For dev environments, we have enabled use of the Github Provider. Plea
echo https://docs.github.com/en/developers/apps/building-oauth-apps/creating-an-oauth-app
echo
echo The mock user data URL is:
echo https://3001-${GITPOD_WORKSPACE_URL:8}/data
echo https://3002-${GITPOD_WORKSPACE_URL:8}/data
echo
echo The homepage is:
echo https://3000-${GITPOD_WORKSPACE_URL:8}
echo https://3001-${GITPOD_WORKSPACE_URL:8}
echo
echo The callback url is:
echo https://3000-${GITPOD_WORKSPACE_URL:8}/api/auth/callback/github
echo https://3001-${GITPOD_WORKSPACE_URL:8}/api/auth/callback/github
echo
echo 2.\) Set NEXTAUTH_URL in .env to https://3000-${GITPOD_WORKSPACE_URL:8}
echo 2.\) Set NEXTAUTH_URL in .env to https://3001-${GITPOD_WORKSPACE_URL:8}
echo
echo 3.\) To setup GITHUB_ID and GITHUB_SECRET after setting up the OAuth app:
echo -Your Client ID is shown in the OAuth app page. Copy and paste to GITHUB_ID.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"homepage": "https://github.com/freecodecamp/classroom#readme",
"scripts": {
"develop": "next dev",
"develop": "next dev -p 3001",
"build": "next build",
"start": "next start",
"test:watch": "jest --watch",
Expand All @@ -28,7 +28,7 @@
"lint:pretty": "prettier --ignore-path .gitignore --check .",
"format": "prettier --ignore-path .gitignore --write .",
"prepare": "husky install",
"mock-fcc-data": "npx json-server --watch mock-json-server/fccdata.json --port 3001"
"mock-fcc-data": "npx json-server --watch mock-json-server/fccdata.json --port 3002"
},
"dependencies": {
"@headlessui/react": "1.7.17",
Expand Down
Loading