BanBds is a web application for buying and selling real estate properties in Vietnam.
You can check out a live demo of this application here.
- Clone my repo
git clone https://github.com/agneskrivers/BanBds.git
cd BanBds
- Install the required packages:
npm install
- Set up the database:
- Download the MongoDB image from docker hub
- Run the following command to start the MongoDB container:
docker run --name mongodb -p 27017:27017 -d mongo:your-version
Replace your-version
with the version of MongoDB you're using (e.g. 4.4
).
- Load demo:
- Download the demo data from Demo
- Unzip file banbds.zip
- Copy folder
public
to folder project - Run the following command to import the demo data into the database:
mongoimport --host localhost:27017 --db your-db-name --collection districts --drop --file path/to/MongoDB/district.json
mongoimport --host localhost:27017 --db your-db-name --collection images --drop --file path/to/MongoDB/images.json
mongoimport --host localhost:27017 --db your-db-name --collection investor --drop --file path/to/MongoDB/investor.json
mongoimport --host localhost:27017 --db your-db-name --collection news --drop --file path/to/MongoDB/news.json
mongoimport --host localhost:27017 --db your-db-name --collection posts --drop --file path/to/MongoDB/posts.json
mongoimport --host localhost:27017 --db your-db-name --collection projects --drop --file path/to/MongoDB/projects.json
mongoimport --host localhost:27017 --db your-db-name --collection regions --drop --file path/to/MongoDB/regions.json
mongoimport --host localhost:27017 --db your-db-name --collection requests --drop --file path/to/MongoDB/requests.json
mongoimport --host localhost:27017 --db your-db-name --collection wards --drop --file path/to/MongoDB/wards.json
Replace your-db-name
with the appropriate values for your setup
- Build the application:
npm run build
- Start the development server:
npm run dev
- Open your web browser and navigate to http://localhost:1998
This web application has the following features:
- User authentication and authorization
- Ability to post new property listings
- Search for properties by location, price, and other criteria
- View detailed information about individual properties
- Contact the seller of a property through the website
This application uses a few environment variables that you'll need to set:
PORT
: The port to run the application on (default is1998
)MONGO_URI
: The URL of your MongoDB databaseMONGO_STORE_URI
: The URL of your MongoDB database session (If you do not define this environment variable, the application will use theMONGO_URI
variable to store sessions)SECRET_JWT
: A secret key used to sign JSON Web Tokens for user authenticationSECRET_COOKIE
: A secret key used to sign CookieSECRET_SESSION
:A secret key used to sign SessionNEXT_PUBLIC_LIMIT_RENEW_OTP
: Limit the number of times the user verification code is sentNEXT_PUBLIC_LIMIT_FAILED_OTP
: Limit the number of times you enter the wrong confirmation codeNEXT_PUBLIC_GOOGLE_API
: The API key for Google Map, a service of google mapsNEXT_PUBLIC_HOME_PAGE
: The URL of home pageESMS_API_KEY
: The API key for ESMS, a service used to send confirmation codes through the applicationESMS_SECRET_KEY
: The Secret key for ESMS, a service used to send confirmation codes through the application
You can set these environment variables in a .env file in the root directory of your project.
Note: If you are running on the development environment, there is no need to set the variable ESMS_API_KEY
, ESMS_SECRET_KEY
. The verification code will be logged on terminal
If you would like to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch for your changes.
- Make your changes and commit them with descriptive messages.
- Push your changes to your forked repository.
- Open a pull request.
This project is licensed under the MIT License.
This project was inspired by similar real estate applications like BatDongSan and Meey Land.
- [] Fix bug
- [] Create RESTful API for Admins
- [] Create admin page