diff --git a/README.md b/README.md index de63206..6ed82d8 100644 --- a/README.md +++ b/README.md @@ -6,106 +6,29 @@ This repository contains the backend and frontend setup for the Auction System. The backend consists of a Docker configuration file (`docker-compose.yml`) and a migration script that needs to be run during the first-time setup. -### Docker Configuration +### Built With +- (Node.js)[https://nodejs.org/] +- (Express)[https://expressjs.com/] +- (TypeScript)[https://www.typescriptlang.org/] +- (TypeORM)[https://typeorm.io/] +- (PostgreSQL)[https://www.postgresql.org/] -The backend is composed of two services: `postgres` and `web`. +### Guide +You can find full guide for the backend setup in the [Backend Readme](./backend/readme.md) -#### Postgres Service - -- Image: postgres:10.7 -- Environment variables: - - POSTGRES_USER: testuser - - POSTGRES_PASSWORD: testpass - - POSTGRES_DB: auction-system -- Ports: - - Host: 5432 - - Container: 5432 -- Volumes: - - ./postgres-data:/var/lib/postgresql/data - -#### Web Service - -- Build context: . -- Dockerfile: dev.Dockerfile -- Links: postgres -- Container name: jtr-auction-express -- Ports: - - Host: 3000 - - Container: 3000 -- Environment variables: - - PGHOST: postgres - - PGHOST_MIGRATION: postgres -- Volumes: - - ./:/app - - -### Environment Variables - -The required environment variables can be found in the `.env.example` file. Create a new `.env` file and copy the contents from `.env.example`. Modify the values of the variables as needed. - - -### First-time Setup - -To set up the backend for the first time, follow these steps: - -1. Ensure that Docker is installed on your system. -2. Navigate to the project root directory. -3. Run the following command to start the backend services: - -```shell -docker-compose up -``` - -4. After the services are up and running, open a new terminal window and navigate to the project root directory. -5. Run the following command to run the migration script: - -```shell -npm run migration:run -``` - -This will set up the necessary database schema and initial data. ## Frontend The frontend is built using React and TypeScript. The `package.json` file contains the dependencies and scripts required for the frontend setup. -### Dependencies - -The frontend dependencies can be found in `package.json` - -### Scripts - -The available scripts for the frontend are: - -- start: Starts the development server on port 3006. -- build: Builds the production-ready optimized bundle. -- test: Runs tests using the Jest testing framework. -- eject: Ejects the configuration and scripts from Create React App. - -### Development Environment - -The development environment is configured to support the following browsers: - -- Chrome (latest version) -- Firefox (latest version) -- Safari (latest version) - -## Getting Started - -To set up the frontend, follow these steps: - -1. Ensure that Node.js and npm (Node Package Manager) are installed on your system. -2. Navigate to the `frontend` directory. -3. Run the following command to install the dependencies: +## Built With -```shell -npm install -``` +- [React](https://reactjs.org/) - Front-end framework +- [TypeScript](https://www.typescriptlang.org/) - Typed JavaScript -4. Once the installation is complete, you can start the development server by running the following command: +### Guide +You can find full guide for the frontend setup in the [Frontend Readme](./frontend/readme.md) -```shell -npm start -``` +## Authors -This will start the frontend application on port 3006. +- [HendryZheng](https://github.com/xen-HendryZheng) \ No newline at end of file diff --git a/backend/dev.Dockerfile b/backend/dev.Dockerfile index a8bc7d6..58f10be 100644 --- a/backend/dev.Dockerfile +++ b/backend/dev.Dockerfile @@ -2,6 +2,6 @@ FROM node:18-slim WORKDIR /app -EXPOSE 3000 +EXPOSE $PORT CMD ["npm", "run", "start:dev"] \ No newline at end of file diff --git a/backend/docker-compose.yml b/backend/docker-compose.yml index 54f7e3e..992b940 100644 --- a/backend/docker-compose.yml +++ b/backend/docker-compose.yml @@ -11,6 +11,8 @@ services: volumes: - ./postgres-data:/var/lib/postgresql/data web: + env_file: + - .env build: context: . dockerfile: dev.Dockerfile @@ -18,7 +20,7 @@ services: - postgres container_name: jtr-auction-express ports: - - 3000:3000 + - "${PORT}:${PORT}" environment: - PGHOST=postgres - PGHOST_MIGRATION=postgres