Skip to content

bmqube/teebay

Repository files navigation

Teebay

A marketplace application where users can buy, sell, and rent products.

What You Need

  • Node.js (version 16 or higher)
  • Docker
  • pnpm (package manager)

How to Run This Project

Follow these steps in order:

Step 1: Install Dependencies

Open your terminal in the project folder and run:

pnpm install

This will download and install all the required packages for both the frontend and backend.

Step 2: Start the Database

The project uses PostgreSQL as its database, which runs in a Docker container.

Start the PostgreSQL container:

docker compose up -d postgres

Wait a few seconds for the database to fully start up.

Step 3: Configure the Environment

Create a .env file in the apps/server folder with the database connection:

cd apps/server

Create a file named .env and add this line:

DATABASE_URL=postgres://teebay:123@localhost:5432/teebay

Step 4: Set Up the Database Tables

Run the database migrations:

npx prisma migrate dev

This creates all the necessary tables in your database.

Step 5: Start the Application

Go back to the root folder and start everything:

cd ../..
docker compose up

This command starts both:

  • The backend server
  • The frontend web application

Step 6: Open the Application

Once everything is running, open your browser and go to:

http://localhost:8000

The backend API will be running at:

http://localhost:5173

Stopping the Application

Press Ctrl + C in the terminal where docker compose up is running.

To stop all containers completely:

docker compose down

Common Issues

Problem: Database connection errors
Solution: Make sure the PostgreSQL container is running with docker compose up -d postgres

Problem: Port already in use
Solution: Stop any other applications using ports 8000 or 5173

Problem: Changes to database not showing
Solution: Run migrations again: cd apps/server && npx prisma migrate dev

Project Structure

This project uses a monorepo setup, which means multiple applications live in one repository and share dependencies.

What's a Monorepo?

Instead of having separate repositories for the frontend and backend, everything is in one place. This makes it easier to:

  • Share code between applications
  • Manage dependencies in one place
  • Run everything together with a single command

Folder Layout

teebay/
├── apps/
│   ├── server/              # Backend API (Node.js + GraphQL)
│   │   ├── prisma/          # Database schema and migrations
│   │   ├── src/             # Server source code
│   │   └── .env             # Database configuration
│   └── web/                 # Frontend application (React)
│       ├── src/             # Frontend source code
│       └── public/          # Static files
├── docker-compose.yaml      # Defines all containers (database, server, frontend)
├── package.json             # Root dependencies and scripts
└── pnpm-workspace.yaml      # Tells pnpm this is a monorepo

How It Works Together

  • apps/server: Handles all the business logic, database operations, and provides a GraphQL API
  • apps/web: The user interface that talks to the server API
  • Docker Compose: Runs everything in containers so you don't need to manually start each service
  • pnpm workspaces: Manages all dependencies for both apps from the root folder

Features

  • User registration and login
  • List products for sale or rent
  • Browse available products
  • Buy products
  • Rent products for specific durations
  • View product details and statistics
  • Manage your own products

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages