This guide provides step-by-step instructions on how to set up and run the Bidding App API. This API allows users to create, manage, and participate in auctions, placing bids on various items
Before you begin, ensure you have the following installed on your machine:
- Node.js (v18 or higher)
- Docker
- PostgreSQL (local instance or access to a remote server provided by vercel etc.)
Clone the repository from GitHub to your local machine using the following command:
https://github.com/chuphal/Bidding-App.gitNavigate into the project directory:
cd Bidding-AppInstall the required dependencies using npm:
npm installCreate a .env file in the root directory of the project and configure the necessary environment variables. Use the provided .env.example file as a template:
# Server port
PORT=5000
# JWT secret key for authentication
JWT_SECRET=your_jwt_secret_key
# Provide the pg service url..
POSTGRES_URL= your_POSTGRES_UR
or
# if using local pg Server
DB_USER= your_user
DB_PASSWORD= your_password
DB_HOST= your_host
DB_PORT=5432
DB_DATABASE= your_database
NODE_ENV =development
EXPIRES_IN=30d
SERVICE_EMAIL= your_email
CLIENT_ID= your_Client_id
CLIENT_SECRET= your_client_secret
REDIRECT_URI=https://developers.google.com/oauthplayground
REFRESH_TOKEN= your_refresh_token
ACCESS_TOKEN=your_access_token
[https://www.youtube.com/watch?v=i4HZg2TufcM&ab_channel=BackCoding]
Run the queries:
path -- backend/db/queries.sql
Start the server using the following command:
npm run server
#or
npm startBefore this, provide the environment variables to the docker-compose.yaml file.
docker compose up --builddocker image lsdocker run -p {PORT}:{Port} <imageId of bidding-app>Open your browser and navigate to http://localhost:3000/api-docs to access the API documentation (if Swagger is set up). You can also use Postman or another API client to test the endpoints.
The API documentation provides detailed information about the available endpoints, request/response formats, and authentication mechanisms. Access it at http://localhost:3000/api-docs.
- "backend/" - Contains the source code
- "controllers/" - Route handlers
- "db/" - sql queries and db config
- "errors/" - error handlers
- "logger/" - winston logger config
- "routes/" - API routes
- "middlewares/" - Middleware functions
- "nodemailer/" - mailer config and oauth2 config
- "upload/" - images store
- "socket/" - sockets
- "utils/" - Utility functions
- "npm start" - Start the server
- "npm run server" - start the server with nodemon
- "npm test" - run mocha tests
- Create two users and get their id's.
- Create an item by one user.
- Go to the: -
path -- backend/socket/socket.js
-
Uncomment the testing one and comment the above one.
-
Now, go to postman and create two client.
-
Pass the cookie, jwt in the headers: - copy while login or register from cookie.

-
Now, connect both the client to the server.
-
Send "userId" as the listener to the server.
-
Now, go to events and turn on the "notification" listener.
-
Now, place the bid on the item (use the client who is not the owner of the item).
-
You can see real-time notification.
Run the test suite using:
npm test
You can test the API's without setup.
- Go to the link: [https://bidding-app-h0xs.onrender.com]
- Click on documentation
You can also use the postman to test the endpoints.
Email: - [cchuphal4@gmail.com]

