ThoughtSwap is a real-time classroom discussion tool that facilitates anonymous peer review of short answers ("thoughts") using Canvas for authentication.
- Client: React (Vite) + Tailwind CSS
- Server: Node.js (Express) + Socket.io + Prisma (PostgreSQL)
- Node.js (v18+ recommended)
- npm
- Docker & Docker Compose
- A Canvas LMS instance (or a Free-for-Teacher account) for developer keys.
The easiest way to build and deploy ThoughtSwap locally is using Docker Compose. This spins up the Postgres database, API server, and Client UI automatically.
-
Configure Environment: Copy the example environment file to
.env:cp env.example .env
Open
.envand populate the Canvas Configuration section (Client ID, Secret, URL). You can generally leave the Database and Port configurations at their defaults. -
Start the Application: Run the following command to build the images and start the services:
docker-compose up --build
Note: The server container will automatically apply database migrations upon startup.
-
Access:
- Client: http://localhost:5173
- Server: http://localhost:8000
-
Optional: Seed Data To create the "Dev Teacher" account without a real Canvas login, run the seed command inside the running server container:
docker-compose exec server npx prisma db seed
If you prefer to run the Node applications directly on your host machine (while using Docker for the database), follow these steps.
-
Clone the repository:
git clone https://github.com/victor-hugo-dc/thoughtswap-ts.git cd thoughtswap-ts -
Install dependencies: This will install dependencies for the root, client, and server workspaces.
npm install
-
Environment Configuration: Create a
.envfile in the root directory (orpackages/server/.envdepending on your preference, but the docker setup expects it at root or server level).# Server Configuration PORT=8000 DATABASE_URL="postgresql://user:password@localhost:5432/thoughtswap?schema=public" FRONTEND_URL="http://localhost:5173" # Canvas OAuth Configuration # Obtain these from Canvas Admin -> Developer Keys CANVAS_CLIENT_ID="your_client_id" CANVAS_CLIENT_SECRET="your_client_secret" CANVAS_BASE_URL="https://<your-canvas-instance>.instructure.com" # IMPORTANT: Must match exactly what is configured in Canvas CANVAS_REDIRECT_URI="http://localhost:8000/accounts/canvas/login/callback/"
Use Docker to spin up the PostgreSQL database defined in docker-compose.yml.
docker-compose up -d postgresApply the Prisma schema to your database and seed the initial dev user.
# Run from the root
npm run dev --workspace=packages/server
# OR specifically for migrations:
cd packages/server
npx prisma migrate dev
npx prisma db seedThe seed command creates a "Dev Teacher" account (teacher@dev.com) which allows you to test teacher features without a real Canvas login.
Run both the client and server concurrently from the root directory.
npm run dev- Client: http://localhost:5173
- Server: http://localhost:8000